Jump to content
Developer Wiki and Function Reference Links ×

PIO in annotations


Recommended Posts

I have a few PIOs that I created for VW 9/10 that function properly in VW 11 and 12 except in viewport annotations. When in a viewport annotation and a parameter is changed, they redraw improperly. Should I be checking to see if the PIO is in an annotation, and if so, how would this be done? Is there a different origin that I should be aware of?

Link to comment

What do you mean by "redraw improperly"? I've been having a problem with scale issues, but I believe part of the problem is a discrepancy between the viewport scale and the sheet layer (which is at 1:1). If your plug-in checks the layer scale to draw itself, you need to be sure to (a) check whether it's parent is a viewport (or something like this), and then (b) retrieve and use that viewport's scale.

I don't know the exact functions since I haven't hit up this problem yet, but some of the functions I've seen on the VS listserv (this is not working code, just a collection of snippets):

code:

GetParent(h)

GetType(h)

iType : = GetType(GetParent(selObjHandle));

'ForEachObjectInLayer' with 'Visible Objects only'

> Anyone know a VS way to get the current sheet layer dimensions?

Use GetDrawingSizeRect() with the sheet layer active. Here is a

sample of code that I use, with care taken to make sure that layer

scale works for all three possibilities (sheet layer, design layer

and no layer [edit symbol mode]):

IF NOT IsNewCustomObject(gPIOName) THEN BEGIN

s2 := GetLName(ActLayer);

s1 := GetLName(GetLayer(ghParm));

IF (s1 <> '') & (GetType(GetObject(s1)) = 31) THEN Layer(s1)

ELSE s1 := '';

END;

GetDrawingSizeRect(dx1, dy1, dx2, dy2);

r1 := GetLScale(ActLayer);

IF s2 <> '' THEN Layer(s2);

PageWdth := Abs(dx2 - dx1) / r1 * 25.4 / gUPI; { page width in mm }

PageHght := Abs(dy2 - dy1) / r1 * 25.4 / gUPI; { page height in mm }
[/code]

Let me know if you make some headway!

Link to comment

There does not seem to be a way to access the scale set for the viewport. Although this may not be the problem as I tried this on a 1:1 scale viewport and the problem still exists. NNA objects of a similar type (elevation markers, etc.) seem to work properly, so their code has some special magic! But of course we do not access this code, unless someone is listening? [Wink]

Link to comment

Well, this code is magic! Here is the resulting code that seems to work. Any optimizations would be appreciated.

code:

If IsNewCustomObject(ObjectName) THEN

BEGIN

If IsVPGroupContainedObject(objectHand, 2) = TRUE THEN

BEGIN

layerScale:=GetObjectVariableReal(objectHand, 1003);

END

ELSE BEGIN

layerScale:=getLScale(ActLayer);

END

END

ELSE

If IsVPGroupContainedObject(objectHand, 2) = TRUE THEN

BEGIN

layerScale:=GetObjectVariableReal(GetVPGroupParent(GetParent(objectHand)), 1003);

END

ELSE BEGIN

layerScale:=getLScale(getLayer(ObjectHand));

END;
[/code]

Thanks.

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