• 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. snapping to edges when invoking an enterBox

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 145
  • Views 16630
  • 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

snapping to edges when invoking an enterBox

Adhil
Adhil over 13 years ago

hey!!!

how can you make an enterBox cursor to snap to edges, i am trying to automatically place vias on an intersection after i draw an enterbox covering that intersection.

the script is working properly,however, it would be more convenient if the enterBox cursor could automatically snap to edges.

 

Adhil

  • Cancel
Parents
  • dmay
    dmay over 13 years ago

    The easiest way to do this is to use the built-in snapping (or gravity) functions. Since not everyone has the same preferences for these, I would do the following:

    1. get the current settings for the user
    2. set the default gravity options for your command
    3. run your enter function
    4. reset the user's settings

                ;Get user settings
                gravity = envGetVal("layout" "gravityOn")
                depth   = envGetVal("layout" "gravityDepth")
                type    = envGetVal("layout" "gravityType")
                bouncex = envGetVal("layout" "gravityBounceX")
                bouncey = envGetVal("layout" "gravityBounceY")
                ;Set your commands preferences
                envSetVal("layout" "gravityOn"      'boolean t)
                envSetVal("layout" "gravityDepth"   'int     20)
                envSetVal("layout" "gravityType"    'string  "edge")
                envSetVal("layout" "gravityBounceX" 'float   0)
                envSetVal("layout" "gravityBounceY" 'float   0)
                ;
                ; Do your stuff here
                enterBox ...
                ;
                ;Reset to the user's settings
                envSetVal("layout" "gravityOn"      'boolean gravity)
                envSetVal("layout" "gravityDepth"   'int     depth)
                envSetVal("layout" "gravityType"    'string  type)
                envSetVal("layout" "gravityBounceX" 'float   bouncex)
                envSetVal("layout" "gravityBounceY" 'float   bouncey)

    If your command errors out, you could end up changing the default gravity settings for the user (since the code doesn't made it to the reset step). To avoid this, you should probably wrap your command with errset to trap the error.

    errset(enterBox(...) t)

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • dmay
    dmay over 13 years ago

    The easiest way to do this is to use the built-in snapping (or gravity) functions. Since not everyone has the same preferences for these, I would do the following:

    1. get the current settings for the user
    2. set the default gravity options for your command
    3. run your enter function
    4. reset the user's settings

                ;Get user settings
                gravity = envGetVal("layout" "gravityOn")
                depth   = envGetVal("layout" "gravityDepth")
                type    = envGetVal("layout" "gravityType")
                bouncex = envGetVal("layout" "gravityBounceX")
                bouncey = envGetVal("layout" "gravityBounceY")
                ;Set your commands preferences
                envSetVal("layout" "gravityOn"      'boolean t)
                envSetVal("layout" "gravityDepth"   'int     20)
                envSetVal("layout" "gravityType"    'string  "edge")
                envSetVal("layout" "gravityBounceX" 'float   0)
                envSetVal("layout" "gravityBounceY" 'float   0)
                ;
                ; Do your stuff here
                enterBox ...
                ;
                ;Reset to the user's settings
                envSetVal("layout" "gravityOn"      'boolean gravity)
                envSetVal("layout" "gravityDepth"   'int     depth)
                envSetVal("layout" "gravityType"    'string  type)
                envSetVal("layout" "gravityBounceX" 'float   bouncex)
                envSetVal("layout" "gravityBounceY" 'float   bouncey)

    If your command errors out, you could end up changing the default gravity settings for the user (since the code doesn't made it to the reset step). To avoid this, you should probably wrap your command with errset to trap the error.

    errset(enterBox(...) t)

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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