Jump to content

Scale-independent plug-in objects


Zeibin

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?

Link to comment

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 ]

Link to comment
  • 3 weeks later...

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 ]

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