grant_PD Posted September 7, 2017 Share Posted September 7, 2017 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. Quote Link to comment
JBenghiat Posted September 7, 2017 Share Posted September 7, 2017 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 Quote Link to comment
grant_PD Posted September 7, 2017 Author Share Posted September 7, 2017 Thanks. I see the logic there. Quote Link to comment
C. Andrew Dunning Posted September 7, 2017 Share Posted September 7, 2017 (edited) 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 September 8, 2017 by C. Andrew Dunning 1 Quote Link to comment
JBenghiat Posted September 7, 2017 Share Posted September 7, 2017 Actually, not quite so easy if we're talking sheets and viewports. You have to step through each viewports and run GetVPClassVisibility() / SetVPClassVisibility() to toggle the class. Quote Link to comment
C. Andrew Dunning Posted September 8, 2017 Share Posted September 8, 2017 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); 1 Quote Link to comment
grant_PD Posted September 8, 2017 Author Share Posted September 8, 2017 OK. I'll give that a whirl. Speed demon coders! Quote Link to comment
Christiaan Posted November 2, 2018 Share Posted November 2, 2018 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. Quote Link to comment
C. Andrew Dunning Posted November 2, 2018 Share Posted November 2, 2018 Christiaan - It is the same syntax, except for using "GetLVis," "HideLayer," and "ShowLayer." Make sense? Quote Link to comment
Christiaan Posted November 5, 2018 Share Posted November 5, 2018 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); Quote Link to comment
C. Andrew Dunning Posted November 5, 2018 Share Posted November 5, 2018 Try this, instead: Procedure LayerToggle; CONST kTestLayer = 'BRICK GRID'; VAR VisStatus : INTEGER; ActLayerName : STRING; BEGIN ActLayerName := GetLName(ActLayer); VisStatus := GetLVis(GetLayerByName(kTestLayer)); Layer(kTestLayer); IF VisStatus=0 THEN HideLayer ELSE ShowLayer; Layer(ActLayerName); END; RUN(LayerToggle); 1 Quote Link to comment
Christiaan Posted November 6, 2018 Share Posted November 6, 2018 (edited) Thanks C, how do I include the layer ("BRICK GRID") and the class ("NonPlot-Brick grid") in the same script? Edited November 6, 2018 by Christiaan Quote Link to comment
C. Andrew Dunning Posted November 7, 2018 Share Posted November 7, 2018 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); 2 Quote Link to comment
Christiaan Posted November 7, 2018 Share Posted November 7, 2018 Perfect, thank you 🙏 Quote Link to comment
Christiaan Posted November 8, 2018 Share Posted November 8, 2018 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 Quote Link to comment
C. Andrew Dunning Posted November 8, 2018 Share Posted November 8, 2018 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); 1 Quote Link to comment
Christiaan Posted November 8, 2018 Share Posted November 8, 2018 Great, thanks, how do I get rid of the confirmation popup? Quote Link to comment
C. Andrew Dunning Posted November 8, 2018 Share Posted November 8, 2018 That pop-up by-passes testing which is visible or invisible (Class or Layer) and simply makes them both the state you choose. That way, VW doesn't have to read your mind... ;-) Quote Link to comment
Christiaan Posted November 8, 2018 Share Posted November 8, 2018 But it doesn't need to read my mind, it only needs to test for the following: 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 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.