Grasshopper

algorithmic modeling for Rhino

Hi all,

Is it possible to operate on blocks in Grasshopper?

thanks,

JJ

Views: 19361

Replies to This Discussion

No.

--
David Rutten
david@mcneel.com
Robert McNeel & Associates
Hi David,

And what about some indirect way, using VB.Net components or combining them with Rhinoscript?

I tried to play with it a bit (see example below), but it seems that i don't get the concept behind those components just quite yet..

Here's what I tried to achieve:

1. Copies of geometry positioned, scaled and orientedon on a path,

2. Same thing but using block instances

I tried using "RhUtil.RhinoApp.Insertblock" but as it turns out it won't work.

It would be nice to get the result of a grasshopper definition as block instances. This is just an example but I think it could be very useful especially for further editing and exporting to other programs.

Q1: Is there a method to do it from within the VB.net component?

If not, the task could be achieved by exporting data (containg positions and transformation matrices) from GH to an external file, and later feeding the data to a script in Rhino.
Q2: Is all this worth the hustle, or am I just far up a blind alley?

Thanks again,

JJ

//should the discussion be moved to the VB corner?
Yes.

The following code should extract all breps in a block. Create a GUID parameter, right click on it and select 'set one Guid', then select the block instance. Connect the Guid parameter to the 'x' input of a VB component and use this code:

Dim brep_list As New List(Of OnBrep)
Dim objref As New MRhinoObjRef(New Guid(x))
Dim iref As IRhinoInstanceObject = MRhinoInstanceObject.ConstCast(objref.Object)
Dim idef As IRhinoInstanceDefinition = iref.InstanceDefinition
Dim objects(0) As irhinoobject
Dim count As Integer = idef.GetObjects(objects)
For i As Integer = 0 To count - 1
brep_list.Add(objects(i).Geometry.brepform)
Next
a = brep_list

The breps will be placed as if the block was inserted in the world origin.
Sorry, i misread your comment. You want to actually transform and add block instances, not just read it's geometry. Then i think you'll have to do everything inside a vb.net component. Try going through this code for that:
http://en.wiki.mcneel.com/default.aspx/McNeel/CCommandTestInsert
I feared you would redirect me to that page :)
It's a bit too complicated for me. At least for now.

Many thanks though!
And for the VB code for extracting breps from blocks - very useful.

can you help me tor write that in VB 
mine is giving compile error

Hi JJ,

it is possible to do this through a VB Script component. But blocks are not supported by any Grasshopper components.

The implementation of blocks in the Rhino SDK is pretty disgusting. I've only dabbled with it once or twice but it's really convoluted.
It's good to know that - another reason to leave it for the moment.

Thanks for the reply!

Hi Jacek,

Have you ever managed to solve this question ?

Is there a Rhinoscript method for "export block" ?

Cheers,

Arthur

 

Hi Arthur,

1. No, I haven't... It came out to be too difficult for me at that time. And it probably still is, depending on the "power of the comparison algorithm" as Hanno suggested.

2. What do you  mean "export block"?

J

Gents,

Almost 6 years after the last comment on this post. Have somebody managed to look into this solution yet?

Many thanks!

Alan

hey alan,

you can try the plugin Elefront . they added new components to the plugin to reference and bake blocks. you can even use native components to transform the blocks and then bake it as a block.

pretty nice,

greets

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service