• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - Skill
  3. PCB SKILL Find text body center

Stats

  • State Suggested Answer
  • Replies 2
  • Answers 1
  • Subscribers 19
  • Views 6340
  • Members are here 0
More Content

PCB SKILL Find text body center

Biradin88
Biradin88 over 3 years ago

Hello,

How can I find the body center of a 45 degree oriented text in SKILL? This is not the bounding box (bbox) center nor the origin center. I want to rotate text just like in Allegro by Rotate/Spin->Body Center. I found a way for text which is 0,90,180 degree orientation, but not for 45 degree. I always can first rotate to 0 degree and then find center, but then I lose original center position.

Thank you

  • Cancel
  • Sign in to reply
  • B Bruekers
    0 B Bruekers over 3 years ago

    I think a way to achieve this is to use axlText2Lines() to convert the text to line segments. Then determine center points of all line segments (axlMidPointLine) and then calculate the average center point.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mstaub
    0 mstaub over 3 years ago

    In Allegro text movement is performed based on the justification setting for the text (Either Left, Center, or Right). These correspond to the bottom left, bottom center, or bottom right of the text object. With that, and to ease the complexity of your Skill code, I would plan on moving them based on these justifications. Rotation also happens around the justification point, and not the center of the text itself. For example if you had three overlapping text objects which all appear to be in the same location, but all have different justifications assigned to them you would get a different value for each when looking at the xy location for the object. You would also get three different results if you tried to rotate all 3 90 degrees. 

    The two common Allegro methods for rotating a text object in Skill are axlDBChangeText() and axlTransformObject(), both based on the the justification setting.

    That said, you could use axlTransformObject() and some trig (based on the justification xy, character width, character height, char spacing and text length) to calculate the "body center" of the text object and rotate/move accordingly. I know this is possible because I have a tool (unfortunately not public) that does this  where I change the size of reference designators to make them as large as they can be, based on predefined text block definitions, so that they still fit within the assembly outline of the parent symbol they are attached to. I also position the text in the center of the symbol and match the symbols rotation. 

    Alternatively you could explore a combination of using Skill to find the text and use axlShell() to simulate a script (calling the rotate command) to rotate the text snapping to the body center of the text object. Probably not the preferred method to solve this, but you might be able to get this to work.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information