Grasshopper

algorithmic modeling for Rhino

David and I talked about starting this discussion, and I was going to wait until a more convenient time for him, but this topic came up again in a separate task today, so I'm getting a head start. (Apologies to David. If you are too busy for the next couple weeks, I can wait for your guidance.)

I'm hoping someone might be able to give me a hint about what direction to start looking, or what SDK/classes to look at in order to do this, but basically I want to add options to the menu that pops up on a component when you right-click on it.

There's a few different components I'd like to use this for, but for now, I'd like to make a component that can be used to input rhino geometry in nearly the same way as one can currently use the different input parameters. I want to be able to right click on the component and then wait for the user to select geometry. Once the geometry is chosen, this component would output a list of user strings attached to each geometry, as well as the geometry itself. I already know how to get user input, and to bring the geometry and user strings into grasshopper, I just don't know how to add this functionality to the right-click menu of the component.

Thanks for any help. If someone just wants to point me in the right direction, I'll dive into it, teach myself, and post progress as I go.

Views: 657

Attachments:

Replies to This Discussion

Not 100% sure about this, but I'd take a look at GH_Component.Menu_AppendCustomComponentItems. If that ain't it, then maybe one of the Menu_... methods will help you get to where you're going.

That being said, I think there's potentially a different way to approach this one. Why not just have a GUID input, then retrieve either the Rhino object or object reference from that guid. That may help as it may not be exactly obvious to the typical user that they need to open the menu for the component and pick an item. Just a thought...
Thanks Damien!

I'll definitely take a look at GH_Component.Menu_AppendCustomComponentItems and the other Menu_methods.

And yes, I think you are right about having a GUID input in this case. I didn't realize you could pass referenced geometry through a GUID parameter to access GUIDs, but that is certainly the best solution from a user point of view.

Nevertheless, being able to add menu items is still something I'd like to figure out, because there are certain functions I'd like to run only when the user wants them, but which are not included in the solve instance. I'll go ahead and look into the methods you've mentioned.
you should also take a look on
public override void Menu_AppendDerivedItems(System.Windows.Forms.ToolStripDropDown iMenu)
As a side note, the user text component is pretty much done. It was an easy and quick one. I'll post a link for download in the next week, but below is a picture of it in action. The user strings depicted are attributes from the dbf table of different GIS shapefiles. I'm using Python to translate shapefiles into rhino geometry and then add user strings from the GIS attribute table.
Attachments:
Man, I could've used some good GIS bridging tools about a month ago! Looking forward to this development.
we should have a basic set of plugins within the next two weeks, maybe sooner. I'll email you a download link as soon as they're ready.
I've been travelling, but I'm in Seattle now for the next few months. I'll write something about the issue we discussed soon.

--
David Rutten
david@mcneel.com
Seattle, WA

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service