• 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 lines on Assembly Top for a symbol

Stats

  • Replies 4
  • Subscribers 160
  • Views 14916
  • Members are here 0
More Content

Getting lines on Assembly Top for a symbol

HighFive
HighFive over 4 years ago

Hello friends,

I’m in need of assistance. I’m new to Skill, but not to programming, and I’ve been reading the manual. Unfortunately the hierarchy of objects in Allegro is still clear as mud to me.

What I’m trying to do:

automatically size, and place, the RefDes in the center of the “box” on Assembly top. By “box” I mean the set of lines creating the mechanical outline of the physical component, not synonymous with the bounding box of the symbol. It is important to get the collection of lines that compose this box, so the RefDes text block can be set appropriately to fit within the lines. For instance I want to size the RefDes appropriately so it will fit inside an 0402 resistor. 

This is ultimately to automate assembly drawing creation, within the context of a BRD. I’ve noted other scripts that place the RefDes in the symbol center, but I haven’t seen any that find the bounding box of lines on assembly top, to size the RefDes appropriately. So I could use a little direction. Here’s what I’ve got so far: I'm able to grab all the symbols, print their names, and list their paths, but thats as far as I've got. I'm trying to figure out how to extract the line width and the line endpoints. 

    allSymbols = axlDBGetDesign()->symdefs
    foreach(symbol allSymbols 
        children = setof(children symbol->children index(children->layer "PACKAGE GEOMETRY/ASSEMBLY_TOP") )
        foreach( child children
            printf("\t\t")
            printf(child->objType)
            printf("\n")

            if( child->objType == "path" && child->nSegs != nil then
                printf("\t\t\t#segments in path: ")
                printf("%d" child->nSegs)
                printf("\n")
            )
        )
    )

I haven’t been able to grab any useful properties from each path however. The only thing I’ve been able to extract is the # of segments. All other methods I’ve tried to run extracting info from each path has been fruitless.

For instance trying to list the segments doesnt work:

   if( child->objType == "path" && axlPathGetPathSegs( child ) != nil then
                printf("\t\t\tSegments: %s\n" axlPathGetPathSegs( child) )
            )
I'm not sure if I don't have the proper context for these paths, or I'm using the wron methods, or what. Any assistance would be very much appreciated!
  • Sign in to reply
  • Cancel
Parents
  • DavidJHutchins
    DavidJHutchins over 4 years ago

    After getting the list of children, try something like this:

    (DataList = (axlDBGetExtents children nil))
    (llx = xCoord( lowerLeft(DataList)))
    (lly = yCoord( lowerLeft(DataList)))
    (urx = xCoord( upperRight(DataList)))
    (ury = yCoord( upperRight(DataList)))
    (Dx = (urx - llx))
    (Dy = (ury - lly))

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • HighFive
    HighFive over 4 years ago in reply to DavidJHutchins

    Awesome thank you very much David!

    I just tried out the code, and it works well. Its almost what I want-

    This code returns the bounding box for all lines on Assembly Top, per placed symbol. If possible, I'd like to get the bounding box for each individual line, so that I can determine which size RefDes will fit. For instance, on An SOIC componenent, there's lines forming the body of the part, and lines forming the pins. The bounding box for all lines would include area covered by the pins, and I'd like the Refdes to fit inside the body of the part. Not a good example but you get the idea. For some other parts, say an SMB jack, theres lines forming the body, but then a circle at the center for center pins, where a RefDes would interfere. Is it possible to get the coordinate info for each line?

    I guess another way of looking at it would be- starting at the symbol center, what are the coordinates for the largest bounding box that can fit before intersecting a line on Assembly Top?

    Thank you so much brother! Cheers!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • HighFive
    HighFive over 4 years ago in reply to DavidJHutchins

    Awesome thank you very much David!

    I just tried out the code, and it works well. Its almost what I want-

    This code returns the bounding box for all lines on Assembly Top, per placed symbol. If possible, I'd like to get the bounding box for each individual line, so that I can determine which size RefDes will fit. For instance, on An SOIC componenent, there's lines forming the body of the part, and lines forming the pins. The bounding box for all lines would include area covered by the pins, and I'd like the Refdes to fit inside the body of the part. Not a good example but you get the idea. For some other parts, say an SMB jack, theres lines forming the body, but then a circle at the center for center pins, where a RefDes would interfere. Is it possible to get the coordinate info for each line?

    I guess another way of looking at it would be- starting at the symbol center, what are the coordinates for the largest bounding box that can fit before intersecting a line on Assembly Top?

    Thank you so much brother! Cheers!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • DavidJHutchins
    DavidJHutchins over 4 years ago in reply to HighFive

    I would try geting the overall place_bound shape, then remove the bounding-box of every pin in the symbol, then compare the lines against the resulting shape with axlGeoPointShapeInfo()

    • 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