Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
Zeibin

Scale-independent plug-in objects

Recommended Posts

Does anyone know of any good resources for making scale-independent PIOs? I'm having some trouble with linear PIOs dropping in fine but with point PIOs needing a "Wakeup" before they draw properly.

At the moment, when a new PIO is drawn, the script gets the object's layer, then the layer's scale from that. Then I have a usable scale factor which can be used to draw the parts of the object at the right size to remain scale-independent.

Oddly enough, as I mentioned, the same code that does this works fine on linear PIOs but fails when I try to use it in a point PIO.

Anyone have experience with these non-scaling PIOs?

Share this post


Link to post

I think I figured something out: Point PIOs (as a tool) begin to execute immediately when you select them, whereas linear PIOs only began to execute after the user has defined the two points for the linear PIO.

Does this sound right? Can anyone verify?

Edit: When I make a PIO symbol of this script, it works fine now, since the user doesn't define any points and instead just drags the item out of the Resource Browser.

Still, if anyone has resources on the scale-independent PIOs, I'd love to hear from you, just so I can run the appropriate error checks and such...

[ 04-29-2005, 03:36 PM: Message edited by: Zeibin ]

Share this post


Link to post

It took me years to perfect this code:

code:

    {******* non-scaling PIO code starts here ***************}

ALHand:=ActLayer;

IF GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand)

& GetLayer(objectHand)<>NIL THEN Layer(GetLName(GetLayer(objectHand)));

mm:=GetLScale(ActLayer)*GetPrefReal(152)/25.4;

{******************************************************************************************}

{ Your code will go here, this poly is an example }

ClosePoly;

Poly( -5*mm,1*mm,

0,6*mm,

5*mm,1*mm);

{****************************************************************************************}

Layer(GetLName(ALHand));

{this temp. active layer change is necessary to avoid text size problems if the PIO

is redrawn when not in the active layer, and the active layer has a different scale}

{****************************************************************************************}
[/code]

[ 05-15-2005, 09:29 PM: Message edited by: Alexandre B A Villares ]

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
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.

×