Grasshopper

algorithmic modeling for Rhino

Hello,

i´m trying to develop some Utilities as components. what i want is my own tab with my own ribbons with my own tools. right now i wrote my first component and it works :). But then i added a second class to my c# Project to get a second Component, which doesn´t work. when i load the .gha file, only my first component appears.

so i have a C# Project with two classes like this:

namespace myUtilities
{
    public class My1stComponent : GH_Component
    {
        public My1stComponent()
            : base("My1stComponentName", "MFC", "do something", "myTab", "my1stToolBox")
        {
        }
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            //myInputs
        }

        protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
        {
           //myOutputs
        }

        protected override void SolveInstance(IGH_DataAccess DA)
        {

            //myAlgorithm
        }

public override Guid ComponentGuid
        {
            get { return new Guid("88e6231b-d998-4de2-85dc-451b0158c599"); }
        }

namespace myUtilities
{
    public class My2ndComponent : GH_Component
    {
        public My2ndComponent()
            : base("My2ndComponentName", "MSC", "do something else", "myTab", "my2ndToolBox")
        {
        }
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            //myInputs
        }

        protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
        {
           //myOutputs
        }

        protected override void SolveInstance(IGH_DataAccess DA)
        {

            //myAlgorithm
        }

public override Guid ComponentGuid
        {
            get { return new Guid("c5aaf8ea-3a02-4d6e-86ee-a8e35ba2b96d"); }
        }

Can anybody tell what´s wrong about that?

Another Problem i have is to to get my own icon. i added one to my c# Project like this:

protected override Bitmap Icon
        {
            get
            {
                return myUtilities.Properties.Resource_icon.myFirstComponent;
            }
        }

In Rhino 5 my icon appears, but not in rhino 4 :(.

Thanx for your answers.

Views: 945

Replies to This Discussion

Concerning the difference between Rhino4 and Rhino5, are you compiling your GHA library against .NET 4.0? You should compile against .NET 3.5 if you want to target both Rhino4 and Rhino5.

I can't see a mistake in your code that would invalidate your second component. I think you'll either need to post a fully functional project (you can remove the SolveInstance algorithms if you want) or a compiled GHA file so I can see for myself what is going wrong.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hello David,

Thanks for your quick reply. You are right i compiled against .NET 4.0. so the icon is not a problem anymore. I attached the Project files. It´s nothing special just simple utilities to get started.

Thanks for your help :)

Attachments:

Sorry, i have to ask again. i have several class files for several components in my c# project, but in grasshopper only one component appears. i really don´t know what is going wrong.

Thanks

Can you post the gha file? Don't use rar as it cannot be downloaded from Ning. Zip should work.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Sure, Thanks

Attachments:

You need to make your component classes public if they are to be accessible from the outside. Currently they are internal (Friend in Visual Basic).

--

David Rutten

david@mcneel.com

Poprad, Slovakia

oh... ooops... :) Thank you very much!!!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service