Grasshopper

algorithmic modeling for Rhino

Hi

I'm trying to bake a group by GH_GeometryGroup.BakeGeometry() and it works.

But I don't know how to get the index of the just created Rhino group.

Also, how does the obj_guid argument work ?

I set it to Guid.Empty before calling the method and it looks it hasn't changed.

Thanks

emilio

Views: 1709

Replies to This Discussion

Sorry ... forgot to mention.

This is a C# custom component

Baking was wrongly designed. I always assumed that when you call Bake you end up with a single object. For groups this is obviously not the case. That is why for groups the obj_guid thing doesn't work because it can only return a single id.

I'm afraid you'll have to unpack the geometry inside each group and bake them individually if you want to know the IDs and the group index.

--

David Rutten

david@mcneel.com

Tirol, Austria

Oh actually you could get the baked objects afterwards and examine the attributes to get the group index. You can use the AllObjectsSince() method on the RhinoDoc.Objects field.

--

David Rutten

david@mcneel.com

Tirol, Austria

Good, I'll use that.

BTW ... couldn't BakeGeometry() return the ID of one of the objects in the group ?

That way we could easily obtain all the other info about the group ... maybe a strange idea ...

Thank you David !

emilio

Hmmmm ... but there should be a way to get the _latest_ group of an object to be able to find the right group ... bad idea.

e.

Well ... that also applies to AllObjectsSince() ...

I think I'll have to bake the objects independently.

(Or is there a way to get the latest-added object group ?)

And talking about extracting the objects from the group:

I'd think to use the Objects property to get a list of IGH_GeometriGoo

... and then use IGH_GeometricGoo.CastTo() to find which kind of things they are.

Does that make sense ?

emilio

You can bake your IGH_GeometricGoo directly, just supply attributes which already have the grouping set. As long as you do it on individual geometry pieces then the obj_id will return the ID of the baked object.

Don't use CastTo(), that's for Grasshopper only. If you want to find out what sort of geometry an IGH_GeometricGoo instance is, use the is or as keywords. Also the GH_Convert class can help out as it will convert pretty much anything in Grasshopper and RhinoCommon into pretty much anything else.

The only time when it makes sense to use CastTo and CastFrom is when you may be dealing with data types that Grasshopper is unaware of.

--

David Rutten

david@mcneel.com

Tirol, Austria

I think I'm missing something ...

I see no BakeGeometry() method in IGH_GeometricGoo class.

Have I to do something else to bake the geometry ?

emilio

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