Jump to content
Sign in to follow this  
TiTaNiuM sAMuRai

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

Recommended Posts

I'm guessing that I set the view to a 2D view, draw the 2D version, then set the view to a 3D view and proceed with the 3D elements, right?

When executing the PIO, would VW be smart enough to show only the 3D stuff in a 3D view and only the 2D stuff in plan view?

For moving around in the 3D symbol, I use SetView, I suppose?

Share this post


Link to post
Guest

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.

Share this post


Link to post

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?

Share this post


Link to post

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 ]

Share this post


Link to post

But if the 2D portion of the script is massive, that's a huge amount of code parsed for naught when in a 3D view.

There MUST be a way to check IfPlanView();...

Thanks anyway.

Share this post


Link to post

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.

Share this post


Link to post

I have put a BOOLEAN paramater in a PIO for drawing the 3D or not, and then contained the 3D part in a Large conditional statement. this seemed to work fine for me, and cut down on the "calculating" time for the PIO.

-jason

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