Grasshopper

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.

Views: 4350

Replies to This Discussion

Until the VB experts arrive here, there's always the kludge of using the - sign to avoid dialog boxes while using code to issue command lines directly in Rhino's normal text command input box. This has the advantage of direct debugging feedback as it creates a real history of behavior in Rhino but the disadvantage of quirkiness that requires some trial and write to get the flow of multiline single command sequences right, and won't work if the command really needs viewport clicks.

I wonder if blocks would afford me a more robust (unbreakable) sort of history in modular symmetric jewelry design? I wasn't even aware of them. It's high time I re-review the whole long list of commands.

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. 

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