Jump to content
Developer Wiki and Function Reference Links ×

publish script to turn off classes?


grant_PD

Recommended Posts

I have a client who needs me to publish full sets of plates without any dimensions or notes.  Lucky for me I keep all of my notes in a separate class.  But I'm wondering if there is a script I can use to toggle this global change?  Ideally I'd set up the drawing set, publish in pdf, publish in dwg, run the script to turn off the dims and notes, publish again, run the script to turn back on dims and notes.  

Link to comment

It's possible, though I would recommend just duplicating all your sheet layers, as technically your drawing set consists of two full sets of plates.  You may also want to adjust the title block to indicate if this is a sheet that should have notes or not.

 

To turn off your classes, use the Visibilities mode of the Organization dialog.  You should be able to toggle visibility in all your duplicated viewports at once.

 

When you Publish, save two sets of sheets, and you can easily toggle between the two in the Publish dialog.

 

-Josh

Link to comment

If you still want a script...:

 

Procedure ClassToggle;

CONST

kTestClass = 'NonPlot-Loci';

VAR
  VisStatus : INTEGER;

BEGIN

VisStatus := GetCVis(kTestClass);
IF VisStatus=0 THEN HideClass(kTestClass) ELSE ShowClass(kTestClass);

Layer(GetLName(ActLayer));

END;

RUN(ClassToggle);

 

(Just change "NonPlot-Loci" to be the Class you're wanting to control.

Edited by C. Andrew Dunning
  • Like 1
Link to comment

Good catch, Josh.

 

Try this, instead:

 

Procedure ClassToggle2;

CONST
 kTestClass = 'NonPlot-Loci';
 kClassON = 0;
 kClassOff = -1;
 kClassGray = 2;

VAR
 DialogVisState : BOOLEAN;
 VisState : INTEGER;

  PROCEDURE ClassSwitch(H:HANDLE);

  BEGIN
   IF SetVPClassVisibility(H,kTestClass,VisState) THEN BEGIN END;
  END;

BEGIN
 DialogVisState := YNDialog(Concat('Do you want the Class "',kTestClass,'" visible?'));
 IF DialogVisState THEN VisState := kClassON
   ELSE
  VisState := kClassOff;
 ForEachObject(ClassSwitch,(ST=REGVIEWPORT)); 
END;

RUN(ClassToggle2);

  • Like 1
Link to comment
  • 1 year later...
On 9/7/2017 at 8:05 PM, C. Andrew Dunning said:

If you still want a script...:

 

Procedure ClassToggle;

CONST

kTestClass = 'NonPlot-Loci';

VAR
  VisStatus : INTEGER;

BEGIN

VisStatus := GetCVis(kTestClass);
IF VisStatus=0 THEN HideClass(kTestClass) ELSE ShowClass(kTestClass);

Layer(GetLName(ActLayer));

END;

RUN(ClassToggle);

 

(Just change "NonPlot-Loci" to be the Class you're wanting to control.

 

Thanks for this. How do you add a Design Layer as well? So you can toggle a design layer + class.

Link to comment
On 11/2/2018 at 7:20 PM, C. Andrew Dunning said:

Christiaan -

 

It is the same syntax, except for using "GetLVis," "HideLayer," and "ShowLayer."

Make sense?

 

 

I tried this but I'm getting at error (have no idea what I'm doing!):

Procedure ClassToggle;
CONST
kTestClass = 'NonPlot-Brick grid';
VAR
  VisStatus : INTEGER;
BEGIN
VisStatus := GetCVis(kTestClass);
IF VisStatus=0 THEN HideClass(kTestClass) ELSE ShowClass(kTestClass);
Layer(GetLName(ActLayer));
END;
RUN(ClassToggle);

Procedure LayerToggle;
CONST
kTestLayer = 'BRICK GRID';
VAR
  VisStatus : INTEGER;
BEGIN
VisStatus := GetLVis(kTestLayer);
IF VisStatus=0 THEN HideLayer(kTestLayer) ELSE ShowLayer(kTestLayer);
Layer(GetLName(ActLayer));
END;
RUN(LayerToggle);

 

Link to comment

Try this:

 

Procedure LayerClassToggle;

CONST
 kClass = 'NonPlot-Brick grid';
 kLayer = 'BRICK GRID';
 kON = 0;
 kOff = -1;

VAR
 LayerVisStatus,ClassVisStatus : INTEGER;
 ActLayerName     : STRING;
 DialogVisState     : BOOLEAN;

BEGIN
 ActLayerName := GetLName(ActLayer);
 LayerVisStatus := GetLVis(GetLayerByName(kLayer));

 Layer(kLayer);
 IF LayerVisStatus=0 THEN HideLayer ELSE ShowLayer;

 ClassVisStatus := GetCVis(kClass);
 IF ClassVisStatus = 0 THEN HideClass(kClass) ELSE ShowClass(kClass);
 
 Layer(ActLayerName);
 END;

RUN(LayerClassToggle);

  • Like 2
Link to comment

Any idea how to make sure they're synced when the toggle is activated? As it stands if the layer is off and the class is on, it will simply swap this around to layer on, class off. 

 

The logic I'm after is:

1. If either layer or class is off, then toggle both layer and class on

2. If both layer and class is on, then toggle them both off

Link to comment

Here's what might be a better approach:

 

Procedure LayerClassToggle;

CONST
 kClass = 'NonPlot-Brick grid';
 kLayer = 'BRICK GRID';

VAR
 ActLayerName      : STRING;
 ClassLayerVisible   : BOOLEAN;

BEGIN
 ClassLayerVisible := YNDialog(Concat('Do you want the Class "',kClass,'" and the Layer "',kLayer,'" visible?'));

 ActLayerName := GetLName(ActLayer);
 
 IF ClassLayerVisible THEN
  BEGIN
   Layer(kLayer);
   ShowLayer;
   ShowClass(kClass);
  END
    ELSE
   BEGIN
    Layer(kLayer);
    HideLayer;
    HideClass(kClass);
   END;
 Layer(ActLayerName);
END;

RUN(LayerClassToggle);

  • Like 1
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...