GioPet Posted June 29, 2010 Share Posted June 29, 2010 Here are the scripts for some simple tools to turn On/off a layer/class visibility by clicking on an object, or to set them as Active layer/class, or to turn off all the others. I was scripting these procedures to use them inside the script for one plugin, but I thought they could be useful also individual procedures. See the attached Plug-ins, the scripts on the following links: Hide the Layer of s Selected Object: http://pastebin.com/spkutw5t Hide the Class of a Selected Object: http://pastebin.com/PG3myeWF Set as Active the Layer of a Selected Object: http://pastebin.com/bBKiN6Z8 Set as Active the Class of a Selected Object: http://pastebin.com/9AnTzBsa Gio Quote Link to comment
GioPet Posted June 29, 2010 Author Share Posted June 29, 2010 Here are two more: Turn on ONLY the Layer of a Selected Object: http://pastebin.com/8LXxHXdR Turn on ONLY the Class of a Selected Object: http://pastebin.com/nE31S546 Quote Link to comment
orlando Teixeira Posted June 29, 2010 Share Posted June 29, 2010 (edited) Hello Gio, great resource, i was searching for this and you decided to post it. Thx very much i am an newbie at vectorscript but i am trying to change your script so that when the class is allready "isolated" , after you call the command it will un-isolate everything. But its not working the way i script it. can you help me ? PROCEDURE SetObjectClass; VAR h : HANDLE; Active_class : STRING; x, y :REAL; BEGIN IF SetClassOptions<>1 THEN BEGIN GetPt(x, y); h := PickObject(x, y); IF h<>NIL THEN BEGIN Active_class:= GetClass(h); NameClass(Active_Class); SetClassOptions(1); SetTool(-240); END; ELSE BEGIN SetClassOptions(5); SetTool(-240) END; END; END; Run(SetObjectClass); Edited June 29, 2010 by orlando Teixeira Quote Link to comment
MullinRJ Posted June 29, 2010 Share Posted June 29, 2010 Hi Orlando, In an IF THEN ELSE statement, you cannot have a semi-colon between END and ELSE. A semi-colon there tells the compiler that your IF statement ends after the THEN clause. The ELSE should be kicking an error. Use a semi-colon only after the last END. Use this format: IF ( ) THEN begin end ELSE begin end; I haven't run your script, so I cannot comment further. Happy scripting, Raymond Quote Link to comment
GioPet Posted June 29, 2010 Author Share Posted June 29, 2010 (edited) Hi Orlando. Great Idea! THis Works out: Introduce the var Class_Options to use the GetClassOptions command. PROCEDURE SetObjectClass; VAR h : HANDLE; Active_class :STRING; x, y :REAL; Class_Options :Integer; BEGIN GetPt(x, y); h := PickObject(x, y); IF h<>NIL THEN BEGIN Class_Options:=GetClassOptions; IF Class_Options<>1 Then Begin Active_class:= GetClass(h); NameClass(Active_Class); SetClassOptions(1); SetTool(-240); End else SetClassOptions(5); SetTool(-240); End; END; Run(SetObjectClass); Edited June 29, 2010 by Gio Pet Quote Link to comment
orlando Teixeira Posted June 29, 2010 Share Posted June 29, 2010 (edited) Hello Mulling and Gio , cant it be automatic ? like this: 1)see if classoptions is 1 2)and if it is then changes it to 5 and ignores the rest of the script... this is what i was trying to do but failed at if then else statement lol Edited June 29, 2010 by orlando Teixeira Quote Link to comment
GioPet Posted June 29, 2010 Author Share Posted June 29, 2010 (edited) ..that's what the last script i posted does.. IF Class_Options <>1 .. End else SetClassOptions(5); SetTool(-240); End; Edited June 29, 2010 by Gio Pet Quote Link to comment
orlando Teixeira Posted June 29, 2010 Share Posted June 29, 2010 (edited) yes i saw it but what script allways asks to select an object. cant he first GetClassOptions and if the result is 1 then he changes to 5 ? thx Edited June 29, 2010 by orlando Teixeira Quote Link to comment
GioPet Posted June 29, 2010 Author Share Posted June 29, 2010 I See!! you want this to work without object selection! then you only need this.. PROCEDURE SetObjectClass; VAR Class_Options :Integer; BEGIN Class_Options:=GetClassOptions; IF Class_Options<>1 Then Begin SetClassOptions(1); SetTool(-240); End else SetClassOptions(5); SetTool(-240); End; END; Run(SetObjectClass); Quote Link to comment
orlando Teixeira Posted June 29, 2010 Share Posted June 29, 2010 (edited) more like: but thats it thz very very much )) PROCEDURE SetObjectClass; VAR Class_Options :Integer; h : HANDLE; x, y :REAL; BEGIN Class_Options:=GetClassOptions; IF Class_Options<>1 Then Begin GetPt(x, y); h := PickObject(x, y); Active_class:= GetClass(h); NameClass(Active_Class); SetClassOptions(1); SetTool(-240); End else SetClassOptions(5); SetTool(-240); End; END; Run(SetObjectClass); Edited June 29, 2010 by orlando Teixeira Quote Link to comment
orlando Teixeira Posted June 29, 2010 Share Posted June 29, 2010 grrr why doesnt this work ? what am i doing wrong ? Quote Link to comment
GioPet Posted June 29, 2010 Author Share Posted June 29, 2010 THis is more like it: PROCEDURE SetObjectClass; VAR Class_Options :Integer; h :HANDLE; x, y :REAL; Active_class :String; BEGIN Class_Options:=GetClassOptions; IF Class_Options<>1 Then Begin GetPt(x, y); h := PickObject(x, y); Active_class:= GetClass(h); NameClass(Active_Class); SetClassOptions(1); SetTool(-240); End else SetClassOptions(5); SetTool(-240); END; Run(SetObjectClass); Quote Link to comment
GioPet Posted June 29, 2010 Author Share Posted June 29, 2010 I wonder if this would be more useful when it was switching the Visibility of the Classes from Visible to invisible... Quote Link to comment
orlando Teixeira Posted June 29, 2010 Share Posted June 29, 2010 thx , i will try it whenever i arrive at work. well now thats what i was looking for: sometimes it is handy to turn off all the classes except one. its usefull even when you are trying to copy something, this way i do not have to use selection by class anymore ))) perhaps one of this days i will have the time to study vectorscrit he!he!he! indeed its allways very usefull Thx againg for the help Quote Link to comment
orlando Teixeira Posted June 30, 2010 Share Posted June 30, 2010 (edited) Gio, its perfect, just like i want. Thx again very much Edited June 30, 2010 by orlando Teixeira Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.