I am new to rhinosrcipt and i am trying to create small script that changes attributes of selected blocks objects.
That is how i see this but it didnt work out)
arrObjects = rhino.SelectedObjects
For Each strBlock In arrObjects
arrBgeo = Rhino.BlockObjects(strBlock)
Rhino.ObjectLayer arrBgeo, “Furniture”
Rhino.ObjectMaterialSource arrBgeo, 3
Next
It have to change block objects layer and material source.
Please show me what i am doing wrong.
Thank you in advance!
Option Explicit
Call Main()
Sub Main()
Dim arrObjects,strBlock,arrBgeo,strBlockName
arrObjects = rhino.SelectedObjects
For Each strBlock In arrObjects
strBlockName = Rhino.BlockInstanceName(strBLock)
arrBgeo = Rhino.BlockObjects(strBlockName)
Rhino.ObjectLayer arrBgeo, "Furniture"
Rhino.ObjectMaterialSource arrBgeo, 3
Next
End Sub
Please keep in mind this will not change the actual block instance layer, just the objects inside blocks.
Thank you very much!
Yeah, my goal was to set many blocks that i created previously that special way.
It was my first script in rhino and i am curious is there any kind of rhinoscript official tutorials besides f1 help?
Congratulations! You are about to open a world on new possibilities in Rhino.
By far the best learning resource is this:
Plus, ask away on the group here.
To be fair, most users and scripters will advice you to go with Python instead of RhinoScript, especially when you start clean. There is similar 101 guide for that available. Even thought I am a RhinoScripter mostly, I would also suggest you start with Python instead, as down the road it will open many new advanced possibilities that RhinoScript doesn’t have.