Jump to content
Developer Wiki and Function Reference Links ×

Linear PIO: rotation value


Recommended Posts

  • 2 years later...

Of course. The way I've done it involves getting that value, truncating any decimal, running the result through a case statement, and performing tasks based on the angle.

-------

RotationINT := Trunc(GetSymRot(gMyObjHd)) MOD 360; {fix rotation value for case statement}

CASE RotationINT OF

-90..90:

BEGIN

{your commands here}

END;

91..180, -180..-91:

BEGIN

{your commands here}

END;

END; {CASE}

---------

Link to comment

You should test for IsObjectFlipped() otherwise you get strange behavior if the user uses the mirror tool on your PIO.

code:

{--- some old code chunk I've found as example----}

LRot:=GetSymRot(objectHand);

f:=1;

IF (LRot >#90d) THEN f:=-f;

IF (LRot <-#90d) AND (LRot >(-#180d)) THEN f:=-f;

IF PFLIP THEN f:=-f;

IF f=1 THEN TextJust(1) ELSE TextJust(3);

Ltexto:= PLineOffset*mm;

f2:=1;

IF IsObjectFlipped(objectHand) THEN BEGIN LRot:=-LRot; f2:=-f2; END;

IF PTEXTO1<>'' THEN

BEGIN

TextVerticalAlign(3+(2*f2));

TextOrigin(PLineLength+PLineOffset*mm*f,0.5*mm*f2);

TextSize(Str2Num(PC1));

BeginText;

PTEXTO1

EndText;

Ltexto:=HWidth(LNewObj)+PLineOffset*mm;

END;

MoveTo(PLineLength,0);

LineTo(PLineLength+(Ltexto*f),0);

RotatePoint(PLineLength,0, -LRot);
[/code]

Link to comment
  • 2 months later...

I've been having some problems with exactly that, Alexandre. but I can't figure out when/how the PIO checks for a flip. If I flip it, and IsObjectFlipped returns TRUE, when I adjust the length with my mouse IsObjectFlipped returns to FALSE. But if I adjust the length in the OIP, it retains the TRUE value. How does this work?

(The code you supplied here seems to do the same thing. Typically the line is always under the text, but if you flip it vertically (so the line's on top) the line flips back down to the bottom if you adjust the length... What I need is something that retains the line above the text after the flip and after a length adjustment.)

Link to comment
  • 1 month later...

Hi,

After the user flipped the object using the mirror tool IsObjectFlipped will return TRUE and your code should counter-act it (the result is a flipped object as expected by the user). Then if the user reshapes the line, the PIO is 'magically' unflipped, and your code gets back to the normal mode (and no one should notice the difference). But again, I can't remember if I coded for the over/under the line difference.

My sample code acts differently acording to angles in certain quadrants, and a manual OIP pFlip parameter to override it (that's the 'f' flag).

IsObjectFlipped will be dealt by the 'f2' flag (to set Text Vertical Alignment and Y origin position) and will also invert LRot angle (LROt:=-LROt). This is the critical stuff.

[ 09-08-2005, 01:58 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...