billtheia Posted September 24, 2015 Share Posted September 24, 2015 I've just started using VW2015 and have discovered a problem with a script I created to toggle showing of 2d info in 3d views. The script is changing the setting as intended but the screen is not refreshing to show the new condition. The update only appears after I change views. Can someone help me figure out why this isn't working as it was in VW2014 & before? Thanks. Here's the script: PROCEDURE ToggleShow2D; BEGIN SetPref(95, not GetPref(95)); SetPref(102, TRUE); ReDrawAll; END; RUN(ToggleShow2D); See screen shot for the setting in question. Quote Link to comment
rDesign Posted September 24, 2015 Share Posted September 24, 2015 The script is changing the setting as intended but the screen is not refreshing to show the new condition. The update only appears after I change views. I don't have an answer to your script question, but I have also noticed in both Vw2015 & 2016 that the screen does not always refresh after changing something; It's like the change I made wasn't big enough to trigger a refresh. There's a chance your script might be working correctly and Vectorworks is just not redrawing as it should. Quote Link to comment
billtheia Posted September 24, 2015 Author Share Posted September 24, 2015 I thought that the ReDrawAll command would do the trick but it doesn't. When I change the setting through the Unified View dialog, though, the screen refreshes as expected. Quote Link to comment
MullinRJ Posted October 4, 2015 Share Posted October 4, 2015 Bill, Try pref# 94 instead of 95. It will work the way you describe, and you won't need the RedrawAll command. Raymond Quote Link to comment
billtheia Posted October 6, 2015 Author Share Posted October 6, 2015 Thanks, MullinRJ. That worked like a charm. Did NVW change the pref number? Quote Link to comment
billtheia Posted November 24, 2015 Author Share Posted November 24, 2015 OK. I'm starting to use VW2015 more now and Raymond's suggestion isn't doing what I need. It's actually just toggling stack layers on and off. I'm trying to toggle the display of 2d information in non-2d views, which is pref 95 not 94. My script appears to be changing the setting but I can't get the screen to refresh without manually changing views. Can anyone out there help me? Thanks. Quote Link to comment
MullinRJ Posted December 1, 2015 Share Posted December 1, 2015 Bill, There is definitely a change between VW 2014 and VW 2015. Pref 94 toggles Stacked Layers (Unified View) Pref 95 toggles Display Screen Objects (when Unified View is ON) I tried your script in VW 2014 and saw how it toggles, and it does not toggle the same (or at all) in VW 2015. I'd say it's broken in 2015. I'll submit a bug and reference this thread. If I find a workaround, I'll post back here, but I didn't see anything obvious offhand. Raymond Quote Link to comment
billtheia Posted December 5, 2015 Author Share Posted December 5, 2015 Thanks, Raymond. The odd thing is that the script actually does toggle the show 2d option (if you use the script and then go into unified view options you'll see that it has checked or unchecked the appropriate box) it just isn't refreshing the screen to show the new condition. Thanks for filing the bug. Unfortunately, I think that NVW has already issued the last service pack for VW2015 so I don't think this will get fixed. Quote Link to comment
Hippocode Posted December 5, 2015 Share Posted December 5, 2015 Have you tried ReDraw ? Quote Link to comment
billtheia Posted December 8, 2015 Author Share Posted December 8, 2015 Yes. And ReDrawAll. They don't work. Here's the script: PROCEDURE ToggleShow2D; BEGIN SetPref(95, not GetPref(95)); SetPref(102, TRUE); ReDrawAll; END; RUN(ToggleShow2D); Quote Link to comment
Markus Barrera-Kolb Posted December 15, 2015 Share Posted December 15, 2015 Had just started a separate thread about what turns out to be the same issue – the following script now works for me. It re-sets the Layer Options to the current setting, and thus forces a redraw that for whatever reason does the trick when REDRAW and REDRAWALL do not: PROCEDURE Toggle_DisplayScreenObj; BEGIN SetPref(95,NOT GetPref(95)); SetPref(506, GetPref(506)); END; RUN (Toggle_DisplayScreenObj); Cheers, Markus p.s. As some of you may have noticed, in 2016 any scripts you add to your Document Context menu cannot be run via keyboard shortcut – weird! Adding them to another menu instead solves the problem... Quote Link to comment
Markus Barrera-Kolb Posted December 15, 2015 Share Posted December 15, 2015 Had just started a separate thread about what turns out to be the same issue – the following script now works for me. It re-sets the Layer Options to the current setting, and thus forces a redraw that for whatever reason does the trick when REDRAW and REDRAWALL do not: PROCEDURE Toggle_DisplayScreenObj; BEGIN SetPref(95,NOT GetPref(95)); SetPref(506, GetPref(506)); END; RUN (Toggle_DisplayScreenObj); Cheers, Markus p.s. As some of you may have noticed, in 2016 any scripts you add to your Document Context menu cannot be run via keyboard shortcut – weird! Adding them to another menu instead solves the problem... Quote Link to comment
twk Posted December 16, 2015 Share Posted December 16, 2015 Thank you Markus!. I had a script for toggling certain class visibilities a while back. The toggling worked in 2D using the ShowClass/HideClass/GrayClass calls, but could never work in 3D openGL view. Adding the LayerOption reset call you mentioned fixed this. Much appreciated. Tui Quote Link to comment
billtheia Posted December 18, 2015 Author Share Posted December 18, 2015 Thanks, Markus. That's getting closer. It now redraws the screen but it changes my layer mode to active only, regardless of how it was set initially. Any idea why that's happening? Quote Link to comment
Markus Barrera-Kolb Posted December 19, 2015 Share Posted December 19, 2015 You're right Bill! Some poking around and trial and error yielded this – I think this one might work: PROCEDURE Toggle_DisplayScreenObj; VAR layopt:INTEGER; BEGIN SetPref(95,NOT GetPref(95)); layopt:=GetLayerOptions; SetLayerOptions(layopt); END; RUN(Toggle_DisplayScreenObj); Quote Link to comment
MullinRJ Posted December 20, 2015 Share Posted December 20, 2015 { Toggle "Display Screen Objects" when Unified View (Stack-Layers) is ON. } SetPref(95, not GetPref(95)); { Stack-Layers option to create 2D objects } SetPrefInt(506, GetPrefInt(506)); { set Layer Options to same value. Needed for screen redraw. } Here's a shortened version of the same script. Nice find, Marcus. Raymond Quote Link to comment
billtheia Posted December 21, 2015 Author Share Posted December 21, 2015 Thanks, guys. SetPrefInt did the trick. Why does pref 506 require us to use SetPrefInt while 95 allows us to use SetPref? Quote Link to comment
Hippocode Posted December 21, 2015 Share Posted December 21, 2015 Why does pref 506 require us to use SetPrefInt while 95 allows us to use SetPref? Not all preferences have the same variable type. Some are true/false = boolean. Some are one of many possible integer values 0,1,2,3... = integer ... Quote Link to comment
Markus Barrera-Kolb Posted December 22, 2015 Share Posted December 22, 2015 Thanks Raymond and Wouter – I'd tried SetPref and GetPref with 506, and of course it didn't work, but I couldn't figure out why. Shorter and simpler is pretty much always better... Cheers, Markus Quote Link to comment
Markus Barrera-Kolb Posted December 22, 2015 Share Posted December 22, 2015 Thanks Raymond and Wouter – I'd tried SetPref and GetPref with 506, and of course it didn't work, but I couldn't figure out why. Shorter and simpler is pretty much always better... Cheers, Markus Quote Link to comment
billtheia Posted December 30, 2015 Author Share Posted December 30, 2015 Thanks, Hippocode. So GetPref is for boolean variables and GetPrefInt is for integer variables? Quote Link to comment
Hippocode Posted December 30, 2015 Share Posted December 30, 2015 Yes. If you look at the VS function reference under "Document Settings" you'll see even more functions to set preferences for various variable types. Also, the following overview lists which function (and variable type) you need for each preference. http://developer.vectorworks.net/index.php/VS:Function_Reference_Appendix Quote Link to comment
billtheia Posted January 2, 2016 Author Share Posted January 2, 2016 Awesome. Thanks. 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.