Jump to content

Script to toggle the visibility of the Working Plane Axes


Recommended Posts

   Last week a question was raised on this board, "Is there a way to hide the display of the axes when working on a rotated plan?"

https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=230007#Post230007

   Setting the Interactive Appearance Settings preference "General - Working Plane Axes Opacity" to zero does hide the axes in Rotated Plan View, but it also keeps them off when using the Working Plane tool, where their visibility is more useful.

   SO - to alleviate the need to manually set the "Working Plane Axes Opacity" preference each time drawing conditions change, I wrote the following script to toggle it between the current setting and zero. If the current setting IS zero the first time the script is run, the script will use a default value of 40%. Subsequent calls will toggle between 40% and 0%. If 40% is not the desired value, simply set the Working Plane Axes Opacity value manually and run the script again to toggle between that new value and zero. The current value is remembered when the script is first run and whenever the value is manually changed.

   For those who want to use this script as a Plug-in Menu Command, download the attached file and copy it into the Plug-ins folder inside your User Folder, then add it to any workspace. Assigning a hotkey is optional. The Plug-in is compiled in VW 2014 and will also work in subsequent VW versions.

PROCEDURE ToggleWPAxes;
{ Toggle the Working Plane Axes Opacity between 0 and the current value. }
{ 15 Jul 2016 - Raymond J Mullin }
CONST
WPAxisOpacity = 1995;		{ Preference number }
PgmName = 'ToggleWPAxes';	{ SavedSetting Category name }
SubCat = 'Opacity';		{ Subcategory name }
DefaultOpacity = 40;		{ any integer value from 1-100% }
VAR
Val, SavedVal :Integer;


function GetSavedWPAxisOpacity(Pgm, Cat :String) :Integer;
{ return WP Axis Opacity if it is found in the SavedSettings file, else return the Default Opacity }
Var
	Val :Integer;
	StrVal :String;
Begin
	 if GetSavedSetting(Pgm, Cat, StrVal) then begin
		Val := Str2Num(StrVal);
		if (Val < 0) then Val := 0	{ ensure value is always in proper range }
		else if (Val > 100) then Val := 100;
	end
	else Val := DefaultOpacity;		{ value has not been stored, use default }
	GetSavedWPAxisOpacity := Val;
End;		{ GetSavedWPAxisOpacity }


BEGIN
SavedVal := GetSavedWPAxisOpacity(PgmName, SubCat);
Val := GetPrefInt(WPAxisOpacity);		{ current value }
if (Val > 0) & (Val <> SavedVal) then		{ selective save }
	SetSavedSetting(PgmName, SubCat, concat(Val));

if (Val = 0) then Val := SavedVal		{ toggle values }
else Val := 0;
SetPrefInt(WPAxisOpacity, Val);			{ apply new value }
END;
Run(ToggleWPAxes);

HTH,

Raymond

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