senorvalenz
(Steven Valenziano)
1
Or am I just mis-understanding how to use an optional parameter?
The line in question seems to always change the object to model space, with very unfortunate consequences if the user doesn’t realize it:
currentLayout = rs.ObjectLayout(obj,return_name=True)
Full script attached.
SV_SelectAllObjsOnObjLayers.py (1.3 KB)
dale
(Dale Fugier)
2
Hi @senorvalenz,
I can see the flaw in the code. I’ve logged the issue.
https://mcneel.myjetbrains.com/youtrack/issue/RH-65424
Here is the source, if you are curious what RhinoCommon methods are used:
– Dale
senorvalenz
(Steven Valenziano)
3
Thanks Dale. I’ll have to wrap my head around RhinoCommon before I can make use of it, but I look forward to the RhinoScript fix!
senorvalenz
(Steven Valenziano)
4
Hi @dale , I’m trying to fix this one but I’m running into trouble. I’m sure it’s because my understanding of using RhinoCommon within python is weak.
This guide didn’t help me much, do you have any other recommended resources?
Or can you suggest a fix to the attached script? I’m getting the following error: “Message: global name ‘rhutil’ is not defined”
SV_SelectAllObjsOnObjLayers.py (2.7 KB)
Thanks,
Steven
dale
(Dale Fugier)
5
Hi @senorvalenz,
In your script, replace rhutil
with rs
.
Also, don’t forget to import scriptcontext
.
– Dale
senorvalenz
(Steven Valenziano)
6
Excellent, that did the trick, thanks @dale ! Working script (command-formatted) attached:
SLAY_adn_cmd.py (3.1 KB)
Edit: updated script w following fix: rs.EnableRedraw(True) needs to be added before the return