• 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. logical AND of two shapes using skill

Stats

  • Replies 1
  • Subscribers 17
  • Views 9504
  • Members are here 0
More Content

logical AND of two shapes using skill

HighFive
HighFive over 5 years ago

So I've run into a wall,

I've been trying  to AND two shapes together using skill, so far without success. The goal is to get the intersection of the two shapes, the intersection being a size limiting bounding box. I'll list what I'm doing, and what's not working, maybe you guys can offer some insights.

I have two shapes, they were constructed using axlDBCreateShape. I want to AND these two shapes together, and keep only the geometry that intersects both shapes. From reading online, this should be possible using 

axlPolyOperation. So far, axlPolyOperation always return nil. This is not an issue of the shapes not having overlapping geometries, the shapes are right on top of each other. Also if I try OR instead of AND, I also get a nil result.
Heres the code and printed output:
        width_shape = axlPathStart(PathList_W)
        new_W_shape = axlDBCreateShape(width_shape t "PACKAGE GEOMETRY/DISPLAY_TOP")  ; create first shape
        
        printf("new_W_shape: \n")
        print(new_W_shape)
        printf("\n")
       
        height_shape = axlPathStart(PathList_H)     ; returns r_path
        new_H_shape = axlDBCreateShape(height_shape t "PACKAGE GEOMETRY/DISPLAY_TOP")    ; create second shape

        printf("new_H_shape: \n")
        print(new_H_shape)
        printf("\n\n")


        poly_width  = axlPolyFromDB( car(new_W_shape) )     ; extract poly from the shapes
        poly_height = axlPolyFromDB( car(new_H_shape) ) 

        printf("poly_width: \n")
        print(poly_width)
        printf("\n")

        printf("height poly: \n")
        print(poly_height)
        printf("\n")

        mergedPolys = axlPolyOperation( car(axlPolyFromDB(poly_width)), car(axlPolyFromDB(poly_height)), 'AND )  ; perform logical AND, always returns nil

        printf("merged poly: \n")
        print(mergedPolys)
        printf("\n\n")
        shape = axlDBCreateShape(mergedPolys t "PACKAGE GEOMETRY/DISPLAY_BOTTOM" nil nil)     ;always fails
Here is the printed output in the console:
new_W_shape:

(dbid:000001E0F474F1F8 nil)

new_H_shape:

(dbid:000001E0F474F4C0 nil)

poly_width:

poly:000001E0F5B96ED8

height poly:

poly:000001E0F5B96EF0

merged poly:

nil

*WARNING* (axlPolyFromDB): Invalid database id argument - (poly:000001E0F5B977A0)

*WARNING* (axlPolyFromDB): Invalid database id argument - (poly:000001E0F5B977B8)

*WARNING* (axlDBCreateOpenShape): Object should be either an r_path or an o_polygon - (nil)

*WARNING* (axlDBCreateOpenShape): Not a floating point number! - nil

Any ideas what I'm doing wrong? Cheers and thankyou

  • Cancel
  • Sign in to reply
Parents
  • HighFive
    HighFive over 5 years ago

    EDIT-

    I found the solution. I wasnt extracting the poly from a "list" before submitting to the axlPolyOperation command. Here is the code that worked for me:

            new_W_shape = axlDBCreateShape(width_shape t "PACKAGE GEOMETRY/DISPLAY_TOP")
            new_H_shape = axlDBCreateShape(height_shape t "PACKAGE GEOMETRY/DISPLAY_TOP")
            poly_width = axlPolyFromDB( car(new_W_shape) ) 
            poly_height = axlPolyFromDB( car(new_H_shape) ) 
            mergedPolys = axlPolyOperation( car(poly_width ), car(poly_height), 'AND )
            shape = axlDBCreateShape(car(mergedPolys) t "PACKAGE GEOMETRY/DISPLAY_BOTTOM" nil nil)
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • HighFive
    HighFive over 5 years ago

    EDIT-

    I found the solution. I wasnt extracting the poly from a "list" before submitting to the axlPolyOperation command. Here is the code that worked for me:

            new_W_shape = axlDBCreateShape(width_shape t "PACKAGE GEOMETRY/DISPLAY_TOP")
            new_H_shape = axlDBCreateShape(height_shape t "PACKAGE GEOMETRY/DISPLAY_TOP")
            poly_width = axlPolyFromDB( car(new_W_shape) ) 
            poly_height = axlPolyFromDB( car(new_H_shape) ) 
            mergedPolys = axlPolyOperation( car(poly_width ), car(poly_height), 'AND )
            shape = axlDBCreateShape(car(mergedPolys) t "PACKAGE GEOMETRY/DISPLAY_BOTTOM" nil nil)
    • 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