Grasshopper + Blocks + Materials

Lets say I have a flowing/curved surface and I want to orient a some (large quantity) high density mesh geometry onto it. This mesh is the same for every instance so making it a block would help reduce file size. Is there a way to use grasshopper to orient this mesh as a block? For my purposes, using blocks and being able to affect all instances by editing one instance is very useful, especially after populating the flowing/curved surface.

Along the same line, how do I get the material that has been applied to the mesh to remain on the mesh while in grasshopper, so that the geometry bakes with the material mapped properly?

I believe there are some plugins for GH that deal with Blocks, but Grasshopper itself does not. It would be fairly easy to write a C# script which takes a block name and bunch of planes, and then creates copies of that block at each plane orientation. Would that work for you?

blockinsert.gh (12.3 KB)

blockfile.3dm (1.8 MB)

1 Like

Thanks for the suggestion, but the example I gave was merely to convey my need for blocks. I am not necessarily orienting meshes onto a surface. What I would like is populate a model with blocks via grasshopper’s orient component and then bake them into existence (where position and rotation may be a result of other grasshopper calculations).

Any ideas about materials going through grasshopper?

That C# component might work. So I insert block name, plane and toggle boolean to bake?

Yup. Note that it takes a list of planes in one go, so if you want to match up a list of different block each with their own orientation, you need to make sure to graft both the Block and Planes input.

Thanks, the script works. I might try to convert it to python since that is my language of choice. But essentially, you use the block name to load the block into def, then you make a transform object with the planes, and finally add it to Rhino while referencing the transform object.

What I might try is having a boolean input to allow for grouping before adding to Rhino.

And the materials seems to have carried through properly because it was a block.

Yeah that’s the basic gist of it. I wasn’t entirely sure whether Block plane are always WorldXY or whether an InstanceDefinition can have it’s own orientation, but since I couldn’t find any methods for getting a custom plane I figured all blocks are ‘positioned’ on WorldXY.

Of course if you want a specific layer of the block objects (or indeed grouping) then you’ll need to also provide some attributes, but you seem to be on top of that :slight_smile:

So I finally got around to doing my own version of the script in python. I’ve never reference things from the Rhino document or bake things directly into Rhino, so I hit a road block right at the start of your script:

InstanceDefinition def = RhinoDocument.InstanceDefinitions.Find(Block, true);

I am also not familiar with C, but I think I saw clues that suggested that your RhinoDocument is actually Rhino.RhinoDoc. But when I type out Rhino.RhinoDoc.InstanceDefinition, the suggestion popup does not show Find as a method.

I found this page: http://developer.rhino3d.com/samples/rhinocommon/createblock/

Unfortunately when I do scriptcontext.doc there is no method InstanceDefinitions

Any ideas David?

A post was split to a new topic: Grasshopper block

Any plans to support blocks in GH2?

Recent discussion: Are Block Instances planned as an input parameter for GH2?