Jump to content

Hide class / hide layer tool


Recommended Posts

My plug in for picking a class or layer to hide isn't working. Can anyone familar with scripts looks at the following for a conflict with version 11? These tools are similar to the tools in Autocad 14's old "Bonus Tools". They are so basic I'm amazed they don't come standard in VW...unless I am missing something.

Thamk you...

Hide class script

Procedure show_hideClass;

VAR

pX, pY:REAL;

Objekth: HANDLE;

CurrentClassStr,ClassToHideStr:String;

Begin

GetPt(pX, pY);

Objekth:=PickObject(pX, pY);

IF Objekth<>NIL Then Begin

CurrentClassStr:=ActiveClass;

ClassToHideStr:=GetClass(Objekth);

IF ((GetCVis(ClassToHideStr))=-1) THEN Begin

ShowClass(ClassToHideStr);

AlrtDialog(Concat('The Class *',ClassToHideStr,'* is set to visible'));

END

ELSE Begin

HideClass(ClassToHideStr);

AlrtDialog(Concat('The Class *',ClassToHideStr,'* is set to invisible'));

END;

NameClass(CurrentClassStr);

IF (CurrentClassStr=ClassToHideStr) & ((GetCVis(ClassToHideStr))=-1) THEN

AlrtDialog('you have set the active Class to Invisible. Select a different Class in the menu bar to take effect of this action');

END

ELSE

AlrtDialog('No Object selected');

Redrawall;

END;

And now the hide layer script

Procedure show_hideLayer;

VAR

pX, pY:REAL;

Objekth: HANDLE;

CurrentLayerStr,LayerToHideStr:String;

Begin

GetPt(pX, pY);

Objekth:=PickObject(pX, pY);

IF Objekth<>NIL Then Begin

CurrentLayerStr:=GetLName(ActLayer);

LayerToHideStr:=GetLName(GetLayer(Objekth));

Layer(LayerToHideStr);

IF ((GetLVis(GetLayer(Objekth)))=-1) THEN Begin

ShowLayer;

AlrtDialog(Concat('The Layer *',LayerToHideStr,'* is set to visible'));

END

ELSE Begin

HideLayer;

AlrtDialog(Concat('The Layer *',LayerToHideStr,'* is set to invisible'));

END;

Layer(CurrentLayerStr);

IF (CurrentLayerStr=LayerToHideStr) & ((GetLVis(GetLayer(Objekth)))=-1) THEN

AlrtDialog('you have set the active Layer to Invisible. Select a different Layer in the menu bar to take effect of this action');

END

ELSE

AlrtDialog('No Object selected');

RedrawAll;

END;

Link to comment

How about adding 'RUN' to both? No, I did not test, but the code seems to be OK in other respects. Or do you get syntax errors?

However, eg. for just hiding classes the procedure could be simplified to work on a selected object (ie. the standard object-verb syntax) and shortened to

HIDECLASS(GETCLASS(FSACTLAYER));

which is what I use when I sort out imported AutoCAD drawings with 300+ classes and don't need any fancy and time-consuming dialogs. (Yes, it is one line only, no procedure name, no 'Run'.)

Anyway, on VectorDepot there are already several competing & complementing class management tool kits ( including some of mine which focus on the more esoteric CAD management aspects). I believe there are tools for the purpose of the above scripts.

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...