Jump to content

PIO's: how do I do 2D/3D hybrids?


Recommended Posts

The script for a VectorScript Plug-in Object should simply create all of its sub-objects. It should not change the view or attempt to separate the 2D from the 3D sub-objects.

Hybrid Plug-in Objects work much the same way as hybrid Symbols. They may contain both 2D and 3D sub-objects in any order.

When VectorWorks displays the object, it will sort through the sub-objects and only display the appropriate objects depending on the current view setting.

Link to comment

Thanks a million for the quick reply. [big Grin]

Two issues I still have though, are:

1) I don't want VW to go through the hassle of calculating 2D elements if they don't get drawn anyway. I separate the 2D and 3D code so that only the relevant code is executed. How do I determine whether or not I'm in Plan view?

2) How do I create extrudes that are extruded from different directions?

Link to comment

don't bother to do 1) it simply isn't how it is suposed to work.

Now, about 2): You have to rotate your extrudes after creating them. As in this example I've writen:

code:

	Procedure SillyWindow;

VAR

objectName,objectClass : STRING;

objectHand, recordHand, wallHand: HANDLE;

{Parameters used:

LINELENGTH & BOXWIDTH (from the rectangular PIO)

E (thickness) & A (height from floor) }

BEGIN

{-----------2D part-----------}

Rect (0,PBOXWIDTH/2, PE, -PBOXWIDTH/2);

Rect (PLINELENGTH-PE,PBOXWIDTH/2, PLINELENGTH, -PBOXWIDTH/2);

IF GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand) THEN

BEGIN

objectClass:=GetClass(objectHand);

NameClass(objectClass);

END;

FillColorByClass;

FPatByClass;

LWByClass;

LSByClass;

PenColorByClass;

{plan view rect}

Rect ( 0, -PBOXWIDTH/2,PLINELENGTH,PBOXWIDTH/2);

HMoveBackward(LNewObj, TRUE); {FALSE=Backward TRUE=Back}

{-----------3D part-----------}

BeginXtrd(0,PBOXWIDTH);

Rect (0,0, PLINELENGTH, PE);

Rect (0,PA-PE, PLINELENGTH, PA);

Rect(0, PE, PE, PA-PE);

Rect(PLINELENGTH-PE, PE, PLINELENGTH , PA-PE);

EndXtrd;

Set3DRot(LNewObj,90,0,0,0,0,0);

Move3DObj(LNewObj,0,PBOXWIDTH/2,0);

END;

Run(SillyWindow);

[/code]

[ 02-04-2003, 07:25 PM: Message edited by: Alexandre B A Villares ]

Link to comment

yep it's good to remember that your PIO is only redrawn if edited, moved or rotated, depending on your settings for the PIO.

that is if the object is moved not the view.

VW stores that info like a hybrid symbol between redraws.

so if you only run the script part for the view

the other part will be mising if the user changes view. (sort of if you draw just the 3d the top view of the 3d will appear in plan view).

generally for each instance of the PIO the script will only ever run once.

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