Here’s what I am looking for.
I have a graphical scale with a text on one cm and a text on 5cm. I would like it to be a block, and when I input the scale to a block attribute, I would like those two texts to update to the correct value.
So if attribute scale was 200, then attribute “1cm” would be attr:scale÷100 = 2 and attribute “5cm” was attr:5×scale÷100 = 10.
At the moment, I need to edit 3 attributes…
Hi Nuno -
While you can perform such calculations (and other python operations) in text fields, it’s not possible to do this with blocks. The object IDs inside the block instances will vary and you can’t track those.
You could build all that and not make a block out of it and only have to change a single value of a user attribute but when you then would use these in a different place or file, you’d have to relink all text fields with the new source.
You could also try to build this in Grasshopper and make it a “GrasshopperPlayable” definition but there are no hatches in Grasshopper in Rhino 7. In Rhino 8, this would be doable.
That is a pity. You may want to look at how the attributes in AutoCAD work because this is possible there for a few decades.
I have run into a similar problem (maybe for another post) where I had blocks with polylines and a text area linked to the polyline. When I inserted the block (sometimes and not always) the link was broken and returned 0. When I redefined the block it worked for a while but at a certain point it would forget again…
This should be possible if the attributes you are referring to are on the block instance itself. Text fields can get values from their parent blocks for calculations. At least that was the design intent when we put this together. Many of the text fields that use a guid to reference an object can use the word “block” instead of a guid. In that case the text is trying to get data from the parent block instance
I was able to make it.
“Scale” is a BlockAttribute.
Those two are just texts, referring to BlockAttribute
During Insert a new block instance:
Great! That’s exactly what I was looking for, but I did not know the syntax…
Thanks a lot