• 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. Custom IC SKILL
  3. polygon subtraction

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 144
  • Views 15792
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

polygon subtraction

drdanmc
drdanmc over 8 years ago

I was working on some skill code to generate a logo for a sheet symbol and ended up in a spot where I need to subtract two polygons.  My preference is to operate on the lists  of points that define the two polygons:

points1 = list(0:0 10:0 10:10 0:10 0:0)

points2=list(2:2 8:2 8:8 2:8 2:2)

points3 = myPolyptsSub(points1, points2) ;; not sure how to implement

fig=dbCreatePolygon(cv, my_lpp, points3)

alternatively, I could live with

fig1 = dbCreatePolygon(cv, my_lpp, points1)

fig2 = dbCreatePolygon(cv, my_lpp, points2)

fig3 = dbLayerAndNot(cv, my_lpp, list(fig1), list(fig2))

dbDeleteObject(fig1)

dbDeleteObject(fig2)

;; is there a db* function to merge the geometries that come back or only the leMergeShapes() function

;; in fig3 (which should be a list)

but it would be nice to be able to work directly with the points.

The reason I'm interested in working directly with points is I have some code that takes an SVG path specification string and turns it into polygon points but some cases may involve an outside shape with some cutouts.  My real case is more complicated than just a square cut out of a square.  Think polygons with hundreds of points.

Thanks for any suggestions.

-Dan

  • Cancel
  • mschw
    mschw over 8 years ago

    Dear Dan,

    you could use dbLayerXor(cv, mylayerName, list(fig1), list(fig2)).

    Best regards,
    mschw

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 8 years ago
    Based on the other response and your need to operation on the points directly you could look at the dbPointArrayXXX functions like dbPointArrayXor(). Hopefully this will help.
    Best regards, Lawrence.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • drdanmc
    drdanmc over 8 years ago
    Thanks! I had missed the dbPointArray* functions. I find it interesting that those functions need a cellview ID even though they don't actually modify the cellview. I would have thought those would strictly work on points.

    but this seems to work

    points3 = dbPointArrayXor(cv list(points1) list(points2))
    foreach(p points3
    dbCreatePolygon(cv, my_lpp, p)
    )


    -Dan
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago
    Dan,

    I think it's needed to (at least) convert from user units to the underlying database units (so the shapes have the right resolution). May be for other things too - but that's certainly needed.

    Andrew.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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