Jump to content
Developer Wiki and Function Reference Links ×

Tools to set Class/Layer Visibility of a selected object


Recommended Posts

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

Link to comment

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 by orlando Teixeira
Link to comment

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

Link to comment

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 by Gio Pet
Link to comment

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);

Link to comment

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 by orlando Teixeira
Link to comment

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);

Link to comment

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

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...