Hi Ed - So, you’ve imported the RhinoscriptSyntax at the top of a Python script and are using it that way, is that how you’re getting to this function?
Given this, I’ve been trying to trying to use rs.Command(“Block…”) as an alternative, but I can’t seem to find the proper way to include the objects to be put in the block. For this piece of code:
I’m trying to build a model consisting of many objects and many blocks using scripting alone. If I have to hand select the objects using the mouse, it renders scripting useless for my purposes. Is there no way to construct a proper _Block command using scripting alone?
Sorry, I meant use RS.UnselectAllObjects() and RS.SelectObjects(). I cannot check right at the moment whether these are both implemented in Python but I would think so.
Thanks Mitch and Pascal. That works fine, but now it’s forcing me to give it a description and a URL. I’d rather not have to provide those (they’re supposed to be optional), but even if I want to provide them I can’t seem to figure out the proper syntax:
In the dialog that pops up, I can simply hit “enter” twice to indicate that I don’t want to use those options. Is there someway to insert two "Enter"s at the end of the command to indicate that I don’t want to enter those?
P.S. I have my notifications set to “Watching”, but I’m receiving email notification only for the first reply to my posts, not to any subsequent replies. Is there someway to continue to get notification to subsequent replies?
I am really halted on my project if I cannot create blocks. As I understand it, blocks are the only way to encapsulate several objects so that they can be moved and rotated as a unit.
Am I correct in my understanding of this essential function of blocks? Or is there some other mechanism I can use?
Is there any chance the AddBlock() method will get implemented soon?
In the meantime, can anybody tell me out how to get rs.Command("-_Block ") to work?
Use _Enter in the command input anytime you’d do that from Rhino to get past an option. Here’s a RhinoScript example I dredged up from my scripts:
Sub BlockSelected()
Dim aObj: aObj = Rhino.GetObjects("Select objects to Block",,, True)
If not IsArray(aObj) then exit sub
dim sObj, sPt
Rhino.EnableRedraw False
For each sObj in aObj
If not Rhino.IsBlockInstance(sObj) then
sPt = "W" & Rhino.Pt2Str(Rhino.BoundingBox(sObj, Rhino.WorldXYPlane())(0))
Rhino.UnselectAllObjects()
Rhino.SelectObject sObj
Rhino.Command "_-Block " & spt & " _Enter _Enter _Enter _Enter", False
End if
Next
Rhino.EnableRedraw True
Thank you @pascal Pascal. I’ve now managed to make blocks, and move/rotate them. But I’m a bit confused by your suggestion of groups as an alternative to blocks. As I understand it, groups (unlike blocks) are not objects, and I can’t seem to find any methods for moving or rotating groups. Am I missing something?