Just as blocks in AutoCAD, I want to generate a library with standard geometry, that has specific properties like fill colour or the thickness of a “door”. Is there a way to store geometry where certain properties are defined?
A little context: I want to be able to choose items from a library/database/folder and add them. Then a new window has to be popped-up with object-specific parameter controls that a user without Grasshopper skills should be able to change.
Thanks in advance!
Hi J Vanderidder,
you should check up Elefront ( https://www.food4rhino.com/app/elefront ), which is a very nice plugin, to control rhino. You can also create blocks and reference the 3dm-file ( your library for example ) in a new definition. So I would create the basic geometries as blocks, with their defined attributes and save it as a 3dm-file. In another definition, you can reference the library, and bring them back to grasshopper. So you are importing the block definitions, without adding the geometries in the document. In the next step, you can deconstruct the blocks, and reconstruct with the new user-defined parameters. It is possible but needs a little bit of effort.
Thanks a lot Bumaye, this sounds exactly as what I need.
So far it doesn’t seem my attributes get stored well. In the upper blue square I define the block, named Block01, save it as block_test2.3dm with some attributes that get stored well in the file.
In the bottom blue square I import the block via Elefronts “Import Linked Block”, and try to get the attributes. It gets the geometry (as seen in the image as well), but it loses the attributes.
Am I missing something? I really hope you can help!
I believe its pulling the original block from the file, one that doesn’t have attributes The top level attributes would be instance based. The ImportLinkedBlock looks like its pulling the definition.
I haven’t worked with linked blocks, but i think if you have attributes the geometry inside said block, it will work as expected.
Hey J Vanderidder,
Right now I am not sitting at a desktop, but did you tried to explode the block to get the attributes? Another approach would be to bake the geometry with the attributes first and make them to blocks. But I have to admit, at the first glance your example seems fine .
Edit: I think with import linked block you are referencing the whole file as a block. You have to explode it, to get the desired block.
Hi Bumaye, thanks for answering! I tried, but sadly this doesn’t work. Luckily I’ve found a workaround: to consider the grasshopper files of the blocks as the block themselves and changing the parameters (e.g. number slider values) from a central grasshopper program. It’s works quite nice i think. If you’re interested I can send you the gh files.
It should work. From what it looks like in your first image you are storing the Attributes on the block instance. You will need to store the attributes on the geometry inside the block. Rhino has two ways of storing attributes, Document User Text where attributes are stored in the file and object user text where attributes are stored on specific pieces of geometry. From what I can tell Elefront is using the object user text, so what you need to do is store the info on the geometry and recall it from that geometry inside the block. Like this. The pink being the definition to assign the attributes to the geometry and the purple is recalling it from the linked block.
Excellent, Nelson, this worked perfectly. Many thanks!