Grasshopper

algorithmic modeling for Rhino

Hi everyone!

I'm using GH SDK for high level operations. I need know if some GH_PARAMS are grouped or not 

Generic::IList<IGH_ActiveObject^> ^ pActiveObjects = pDocument->ActiveObjects();
for each (IGH_DocumentObject^ pActiveObject in pActiveObjects)
{
    IGH_Param ^ pParam = dynamic_cast<IGH_Param^>(pActiveObject);

    if (pParam != nullptr)

    {

        // Param Group Access here

        ...

    }

}

I have revised the SDK but I don't find any Group propierty or similar ¿any idea? ¿Chucks/Items traveling is a good approach?

Thanks!

Views: 607

Replies to This Discussion

Grouping information is not stored on the objects inside the Group, only the group itself knows what objects it contains. You'll need to iterate over all objects (IGH_DocumentObject) in GH_Document.Objects and find all Grasshopper.Kernel.Special.GH_Group instances.

Once you've cast your IGH_DocumentObject to a GH_Group, you can access the ObjectIDs property which returns a list objects IDS that are contained within the group. (Do not modify this list, as it is the actual object id list!)

You can also use the Objects() property which returns a list of IGH_DocumentObject. This list is created from the id list though.

If you want to get all objects contained in a group and also in any sub-groups, you can use the ObjectsRecursive() method.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ok, that's work!

Thanks David

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service