Jump to content
Sign in to follow this  
billtheia

Toggle Show 2d not working properly in VW2015

Recommended Posts

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.

Share this post


Link to post
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. :(

Share this post


Link to post

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.

Share this post


Link to post

Bill,

   Try pref# 94 instead of 95. It will work the way you describe, and you won't need the RedrawAll command.

Raymond

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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?

Share this post


Link to post

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

Share this post


Link to post

{ 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

Share this post


Link to post

Thanks, guys. SetPrefInt did the trick.

Why does pref 506 require us to use SetPrefInt while 95 allows us to use SetPref?

Share this post


Link to post

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

...

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...