I have a hundred or so block definitions in my file, each block containing somewhere between one and ten curves and points. I just realised that what I really want is to have the display colour of all those curves and points be ‘By Parent’ instead of ‘By Layer’. I can make the change manually by using BlockEdit on each block, selecting the geometry, changing the attributes and saving the block, but that’s a lot of tedious work.
Is there a command or button somewhere that allows me to set these properties en-masse?
Hi David, hope this script works. If you already have instances in the file then you may have to re-insert these if I recall correctly. This could also be scripted.
Dim arrBlocks, strBlock, arrObjects
arrBlocks = Rhino.BlockNames(True)
If IsArray(arrBlocks) Then
For Each strBlock In arrBlocks
arrObjects = Rhino.BlockObjects(strBlock)
If IsArray(arrObjects) Then
Call Rhino.ObjectColorSource (arrObjects, 3)
Yeah we can program it, but that’s not an option for most users.
Anyway, I also had to move all block definition elements into a separate layer so they wouldn’t get hidden when I change regular layers. So I went with a slightly adapted version of the above script.
blockNames = Rhino.BlockNames(True)
If (Not IsArray(blockNames)) Then
For Each blockName In blockNames
blockObjects = Rhino.BlockObjects(blockName)
If IsArray(blockObjects) Then
Call Rhino.ObjectColorSource(blockObjects, 3)
Call Rhino.ObjectLayer(blockObjects, "Block Elements")
I don’t think that there is a good “hard-coded” solution for all the properties the users may want to change. Like in your case… also changing the Layer. It is possible to change all properties manually which works for “most users”. If a user has to deal with more blocks than one can handle manually then it is time for a bit of scripting
I suppose there is a bit more overhead since the objects are no longer completely identical.
In a quick test here, with 5760 instances of the same block definition (amounting to 29ﾠ007ﾠ360 quadrilateral polygons and 46ﾠ368ﾠ000 triangular polygons), I get 19.57 FPS when the color of the object in the definition is “By Layer” and 19.33 FPS when it’s “By Parent”.
I get 1.13 FPS with your “test by parent.3dm” file, so, yes, something is going on with that one.
When I start a new document from the “Small Objects - Meters.3dm”, however, and import that file, I get 60.39 FPS.
Also, I can’t reproduce how you got to that state. I opened “test by layer.3dm” and ran that script but am not having issues with the display: