Jump to content
Developer Wiki and Function Reference Links ×

Toggle Project Screen Objects


Recommended Posts

Hi All--

I've discovered that I can navigate sheet layers with multiple viewports if I turn off "Project Screen Objects" however, I need to turn on "Project Screen Objects" when I print.

I'm looking to create two simple scripts that will do the following:

Fast View Mode:

1) Select all viewports on the sheet

2) Toggle ON "Display Planar Objects"

3) Toggle OFF "Project Screen Objects"

4) Deselect all

Failed attempt:

DSelectAll;

SelectObj(INSYMBOL & INVIEWPORT & (T=VIEWPORT));

SetObjectVariableBoolean(122, 1005, False);

SetObjectVariableBoolean(122, 1035, True);

DSelectAll;

Print Mode:

1) Select all viewports on the sheet

2) Toggle ON "Display Planar Objects"

3) Toggle ON "Project Screen Objects"

4) Deselect all

Failed attempt:

DSelectAll;

SelectObj(INSYMBOL & INVIEWPORT & (T=VIEWPORT));

SetObjectVariableBoolean(122, 1005, True);

SetObjectVariableBoolean(122, 1035, True);

DSelectAll;

Any help would be greatly appreciated!

Thanks,

Andy

Link to comment

Hello Andy,

   In your calls to SetObjectVariableBoolean() you placed "122" in the slot where a HANDLE variable to the ViewPorts should go. 122 is the type of a VIEWPORT and doesn't point to anything.

   Since you appear to be new to VectorScript I've attached a short script that demonstrates how to access each VP in your drawing. Use it as an example and modify it to do other tasks. The basic format is the same for many global tasks. Also, read the VS documentation on the set of ForEachObject calls. They are very powerful for walking through a file and selecting objects of interest.

PROCEDURE VPProjScreenON;
{ Set "Project 2D" ON for each ViewPort in the drawing. }
CONST
Proj2D = True;	{ True = ON, False = OFF }

procedure SetProj2D(H :Handle);
Begin
	SetObjectVariableBoolean(H, 1005, Proj2D);	{ VP Project 2D }
	SetObjectVariableBoolean(H, 1035, True);	{ VP Display Planar }
	SetDSelect(H);
End;		{ SetProj2D }

BEGIN
DSelectAll;
ForEachObject(SetProj2D, T=VIEWPORT);	{ do this to each VP in the drawing }
END;
Run(VPProjScreenON);

   In this script, the call ForEachObject() gets a handle to each VP, one at a time, and passes it to the procedure SetProj2D(). All the detail work is done in SetProj2D(). Duplicate this program and set the CONSTANT Proj2D to FALSE to make a script that turns the setting OFF.

   One caveat, this script is only mildly tested. Use at your own risk and start out on a copy of you drawing first.

Have Fun,

Raymond

Link to comment

Raymond, thank you! Incredibly helpful.

And thanks to your very helpful explanation, I was able to modify slightly to turn off the "project screen objects." Seems to work well in my files.

Thank you and take care,

Andy

PROCEDURE VPProjScreenOFF;

{ Set "Project 2D" OFF for each ViewPort in the drawing. }

CONST

Proj2D = FALSE; { True = ON, False = OFF }

procedure SetProj2D(H :Handle);

Begin

SetObjectVariableBoolean(H, 1005, Proj2D); { VP Project 2D }

SetObjectVariableBoolean(H, 1035, True); { VP Display Planar }

SetDSelect(H);

End; { SetProj2D }

BEGIN

DSelectAll;

ForEachObject(SetProj2D, T=VIEWPORT); { do this to each VP in the drawing }

END;

Run(VPProjScreenOFF);

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