• 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
  • HighFive
    HighFive over 4 years ago

    Great,

    Thank you very much David. I really appreciate your responses. I ended up figuring out how to do what I wanted to- getting all the lines on Assembly Top on a per symbol basis. Now I'm focusing on finding the largest bunding box that can fit inside the lines, starting from the center of the symbol, before intersecting a line. That bounding box will be the max size of the text. I'll update the code here when complete. Here's what I've done so far to get all lines on assembly top and print out a bunch of info:

    procedure(Get_Lines()

        axlClearSelSet() 
        axlSetFindFilter(?enabled '("NOALL" "SYMBOLS") ?onButtons '("SYMBOLS"))
        symbol_list = axlGetSelSet(axlAddSelectAll() )
        axlClearSelSet() 
        foreach( symbol symbol_list
            ;sym = car(setof(obj, refdes ->children, obj ->layer == "REF DES/SILKSCREEN_TOP"))
            if( symbol->name != nil then
                printf("Footprint: %s " symbol->name)
            else
                printf(" no name ")
            )

            if( symbol->refdes != nil then
                printf("   RefDes:  %s    " symbol->refdes)
            )

            if( symbol->objType != nil then
                printf(" type: %s\n" symbol->objType)

                else
                    printf("\n")
            )
            
            children = symbol->children
            foreach( child children
               printf("\t\"%s\" on  %s\n" child->objType child->layer)
               if( child->objType == "path" then
                    path = child
                    printf("\t\taxlDbidName: %s\n" axlDbidName( path ) )
                    
                    line_segments = path->segments
                    if( path->hasArcs != nil then
                        printf("\t\tPath has Arcs in it\n")
                    else
                        printf("\t\tpath has no Arcs in it\n")
                    )
                    foreach(segment line_segments
                        ;print(segment->startEnd)
                        printf("\t\t%L\n" segment->startEnd)
                        printf("\t\tpath type:  %s\n" segment->objType)
                        printf("\t\twidth:  %.4f\n" segment->width)
                        if( segment->objType == "line" then
                            printf("\t\tlinetype:  %s\n" segment->lineType)
                            if( segment->font != nil then
                                printf("\t\tfont:  %s\n" segment->font)
                            )
                        )
                        if( segment->objType == "arc" then
                            if( segment->isCircle == nil then
                                seg_is_circle = "false"
                            else
                                seg_is_circle = "true"
                            )
                            printf("\t\tisCircle:  %s\n" seg_is_circle)
                            
                            if( segment->isClockwise == nil then
                                seg_is_clockwise = "false"
                            else
                                seg_is_clockwise = "true"
                            )

                            printf("\t\tisClockwise:  %s\n" seg_is_clockwise)
                            printf("\t\tCenter:  %L\n" segment->xy)
                        )
                    )
                    printf("\t\tnSegs: %d\n" child->nSegs)
                )   
            )
            printf("\n\n")
        )
    )
    It took awhile to figure out how to get all the lines with path->segments. The documentation for data object hierarchy is extremely confusing. I can't remember where, but I actually found documentation suggesting the child reference was path->Segments, with a capital "S". Regardless, I've got the lines now so I'm happy. I'll post a followup with my finished code once it is complete. 
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • HighFive
    HighFive over 4 years ago

    Great,

    Thank you very much David. I really appreciate your responses. I ended up figuring out how to do what I wanted to- getting all the lines on Assembly Top on a per symbol basis. Now I'm focusing on finding the largest bunding box that can fit inside the lines, starting from the center of the symbol, before intersecting a line. That bounding box will be the max size of the text. I'll update the code here when complete. Here's what I've done so far to get all lines on assembly top and print out a bunch of info:

    procedure(Get_Lines()

        axlClearSelSet() 
        axlSetFindFilter(?enabled '("NOALL" "SYMBOLS") ?onButtons '("SYMBOLS"))
        symbol_list = axlGetSelSet(axlAddSelectAll() )
        axlClearSelSet() 
        foreach( symbol symbol_list
            ;sym = car(setof(obj, refdes ->children, obj ->layer == "REF DES/SILKSCREEN_TOP"))
            if( symbol->name != nil then
                printf("Footprint: %s " symbol->name)
            else
                printf(" no name ")
            )

            if( symbol->refdes != nil then
                printf("   RefDes:  %s    " symbol->refdes)
            )

            if( symbol->objType != nil then
                printf(" type: %s\n" symbol->objType)

                else
                    printf("\n")
            )
            
            children = symbol->children
            foreach( child children
               printf("\t\"%s\" on  %s\n" child->objType child->layer)
               if( child->objType == "path" then
                    path = child
                    printf("\t\taxlDbidName: %s\n" axlDbidName( path ) )
                    
                    line_segments = path->segments
                    if( path->hasArcs != nil then
                        printf("\t\tPath has Arcs in it\n")
                    else
                        printf("\t\tpath has no Arcs in it\n")
                    )
                    foreach(segment line_segments
                        ;print(segment->startEnd)
                        printf("\t\t%L\n" segment->startEnd)
                        printf("\t\tpath type:  %s\n" segment->objType)
                        printf("\t\twidth:  %.4f\n" segment->width)
                        if( segment->objType == "line" then
                            printf("\t\tlinetype:  %s\n" segment->lineType)
                            if( segment->font != nil then
                                printf("\t\tfont:  %s\n" segment->font)
                            )
                        )
                        if( segment->objType == "arc" then
                            if( segment->isCircle == nil then
                                seg_is_circle = "false"
                            else
                                seg_is_circle = "true"
                            )
                            printf("\t\tisCircle:  %s\n" seg_is_circle)
                            
                            if( segment->isClockwise == nil then
                                seg_is_clockwise = "false"
                            else
                                seg_is_clockwise = "true"
                            )

                            printf("\t\tisClockwise:  %s\n" seg_is_clockwise)
                            printf("\t\tCenter:  %L\n" segment->xy)
                        )
                    )
                    printf("\t\tnSegs: %d\n" child->nSegs)
                )   
            )
            printf("\n\n")
        )
    )
    It took awhile to figure out how to get all the lines with path->segments. The documentation for data object hierarchy is extremely confusing. I can't remember where, but I actually found documentation suggesting the child reference was path->Segments, with a capital "S". Regardless, I've got the lines now so I'm happy. I'll post a followup with my finished code once it is complete. 
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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