algorithmic modeling for Rhino
Hi everyone.
I am trying to extract geometries from blocks. I know grasshopper doesn't support them, and I know there's a plugging (Human) that does. But due to the amount of blocks human keeps crashing so I am trying to code it.
I am trying to extract the points within the blocks, I have successfully done so, the output is rhino.docobject.pointobject but as soon as I try to use that grasshopper recognizes it as a goo object.
I have tried converting it inside the script but then the vb throws a conversion error
it can convert a rhinoobject into a 3d point.
This is the code:
Private Sub RunScript(ByVal T As Boolean, ByRef A As Object)
If t Then
Dim objlist As New List(Of Rhino.DocObjects.RhinoObject)
For Each rhobj As Rhino.DocObjects.RhinoObject In doc.Objects
' this selects only the blocks
If rhObj.ObjectType = ObjectType.InstanceReference Then
' this gets the objects in the block
Dim obarr() As Rhino.DocObjects.RhinoObject = rhobj.GetSubObjects
'here I put them in a list
For Each blockobj As Rhino.DocObjects.RhinoObject In obarr
objlist.add(blockobj)
Next
End If
Next
a = objlist
End If
I'm pretty stuck, any ideas would be much appreciated.
Thanks to everyone, and long live the grasshopper community.
Tags:
Do you have many unique blocks, or many instances of identical blocks? you might look at the "Block Info Only" right-click menu option on Human's "explode blocks" component - this will give you the transform information without actually grabbing the geometry inside the blocks. If you know the arrangement of points in the block definition you can just apply the transform to those points.
As for the issue of RhinoObjects to Geometry GH can use - you should be able to get the .Geometry property from any RhinoObject (like a PointObject) - and this should come into grasshopper as usable points. In your above example, change the line to objlist.add(blockobj.Geometry).
Hope that helps!
Thanks a lot,
I'll give the Human plugin another go.
If I change that code in the list it troughs a conversion error "cannot convert geometrybase to rhino object" If I change the type of list to be geometry base it tells me "geometry base is not defined"
This block issue is driving me mad.
Is there a possibility it might be easier in python? It seems to be more forgiving since you don't have to declare what things are if I understand correctly.
Great plug in by the way
You should be able to change the type of the list to be GeometryBase. The error you're getting just sounds like you mistyped something.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by