Jump to content
Developer Wiki and Function Reference Links ×

Text going in odd locations in Point Object


SamIWas

Recommended Posts

I have a tool I created for placing exhibit graphics.  It's just a simple box and two pieces of text, controlled in the OIP.  All of them react to a "Top" or "Bottom" setting in the OIP as well.  When I select "Bottom", everything lines up as expected.  When I select "Top", the text flies off into space, even though the correct dimension is being calculated.

 

Here is a sample of the script:

---------------------------------------------------------------------

{---------------CREATE RECTANGLE-------------}
        rectwidth := PWIDTH; 
        rectheight := PDEPTH;

 

        IF PDIRECTION='Bottom' THEN BEGIN
            TextOrigin(0,(-.5-RectHeight));
            TextVerticalAlign(1);
            END;
        
        IF PDIRECTION='Top' THEN BEGIN
            TextOrigin(0,(.5+RectHeight));
            TextVerticalAlign(5);
            END;
        
        TextJust(2);
        BeginText;
            concat(PNAME)
        EndText;

 

        IF PDIRECTION='Bottom' THEN BEGIN
            TextOrigin(0,(-5-RectHeight));
            TextVerticalAlign(1);
            END;
        
        IF PDIRECTION='Top' THEN BEGIN
            TextOrigin(0,(5+RectHeight));
            TextVerticalAlign(5);
            END;
        
        TextJust(2);
        BeginText;
            dimtext
        EndText;

---------------------------------------------------------------------

 

If RectHight is set to 1.5", as is default, and I select "Bottom",  the PNAME text is at -2" and the dimtext text is at -6.5", as expected by the calculations.  If I select "Top", PNAME should be at 2", but the text ends up at 21' 6.56".  dim text should be at 6.5", but it ends up at 14' 9.54".  

 

Am I missing something, or have I encountered a bug?  I don't recall having this issue previously on other scripts.  Could it have anything to do with the source number being a dimension instead of a number?  Oddly enough, if I put the calculation for one of the top locations in one of the text fields, it shows the correct number, while putting the text off in some weird location.  If I need to include the entire script, I will.

 

EDIT:  I forgot to mention...if I change the TextVerticalAlign to 1 from 5, the text jumps to the correct coordinates, but is below instead of above that coordinate.

Edited by SamIWas
Link to comment

There is nothing in the code you posted that is causing the problem. I pasted it into the following test script (not PIO). The text appears right where it should when you change the PDIRECTION constant from BOTTOM to TOP.

 

Post the whole script and I can take another look. Make sure you include all of the parameter information necessary to recreate the PIO.

Link to comment

You may find CreateText() more reliable.  If I were to guess, you're getting blank lines included at the end of the text block.  Converting a PIO instance to group might help confirm this.

 

Also, for good measure, make sure to specify units with your dimensions, i.e. 5" (or mm, or whatever).  Otherwise, will get very different results if you switch units.

 

HTH,
Josh

Link to comment

Thanks guys,

 

Apparently, it was a current-launch bug.  Today, the problem is no longer happening.  What's also weird is that all of my other PIOs use the same text-scaling procedure, but it didn't work in this one. So I corrected it without the scaling.  Today, when I opened up the work file, the text was massive.  I changed it to match my other PIOs and now it works correctly.  So, it looks like all of that was related to the same thing.  It's all working now.

 

Alas...I didn't think to turn it off and back on again. :/

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