• 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 PCB Editor
  3. Getting the BBox of a rotated component

Stats

  • Replies 4
  • Subscribers 159
  • Views 13746
  • Members are here 0
More Content

Getting the BBox of a rotated component

LSIpkgCad
LSIpkgCad over 16 years ago

Does anyone have a method for getting the absolute coordinates for the vertices of a rotated component/symbol?  If you query the DBID itself, you can get the BBox and the rotation.  E.g.

                                   componentDBID->symbol->bBox     AND     componentDBID->symbol->rotation

However, the vertices reported in the BBox are the extents of the symbol with a 0 degree rotation.  It seems the only way to get the absolute coordinates for the vertices of the component in its rotated position, you'd need to do some trigonometry.  Anyone out there with a better way or perhaps... a code snippet to do the calculations?

THANKS MUCH!!!!

  • Sign in to reply
  • Cancel
  • fxffxf
    fxffxf over 16 years ago

     The bBox is the orthogonal extents covered by the symbol and is generally not of much use except as a test if the symbol will fit into the board extents or as a quickout test for DRC code. The bBox contains everything in the symbol, so if you build a symbol with notes, dimensioning, etc. its bBox will be much larger then what is required for placement work. Typically, you want to use items like PLACE_BOUNDS or keepouts which are shapes present off the "children" link of the symbol.

     If you really want the un-rotated extents of the a symbol, you can consider using the bBox of the symbol def which is:

          symbol->definition->bBox

    You will need to correct this bBox for the origin of the symbol instance (e.g add symbol->xy to the def's bBox coords). Also the symbol def's bBox will not take into account any symbol instance edits (this is atypical).

    Finally you can always use axlGeoRotatePt on each xy of the bBox which will do the math. But you must send it both negative angle and an un-mirror for the correct result.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • LSIpkgCad
    LSIpkgCad over 16 years ago

    Yes, I understood about the extents issues but left them off the post for succinctness.  However, your reference to "axlGeoRotatePt" is what I was missing... and that's what will provide what I'm after!!  THANKS!! 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Randy R
    Randy R over 16 years ago

    ;First, get the points of the bounding box
    p1 = car(object->bBox)
    p2 = cadr(object->bBox)
    p3 = list(car(p1) cadr(p2))
    p4 = list(car(p2) cadr(p1))
    pnts = list(p1 p2 p3 p4)

    ;Second, find center of bounding box
    cntr_x = (axlDistance(p1 p4)/2) + min(car(p1) car(p4))
    ;((car(p1) - car(p2))/2) + car(p1)
    cntr_y = (axlDistance(p1 p3)/2) + min(cadr(p1) cadr(p3))
    ;((cadr(p1) - cadr(p2))/2) + cadr(p1)
    cntr_xy = list(cntr_x cntr_y)

    ;Third, compute the rotated points
    r_pnts = nil
    foreach(pnt pnts r_pnts = cons(axlGeoRotatePt(object->rotation pnt cntr_xy) r_pnts))

    ;List of the points
    foreach(r_pnt r_pnts println(r_pnt))

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • LSIpkgCad
    LSIpkgCad over 16 years ago

    Randy -  Nice snippet!!  Thanks!!!  This will be helpful!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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