Home > Community > Forums > Custom IC SKILL > snapping to edges when invoking an enterBox

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 snapping to edges when invoking an enterBox 

Last post Wed, May 16 2012 8:22 AM by psill. 4 replies.
Started by Adhil 14 May 2012 11:54 PM. Topic has 4 replies.
Page 1 of 1 (5 items)
Sort Posts:
  • Mon, May 14 2012 11:54 PM

    • Adhil
    • Top 100 Contributor
    • Joined on Fri, Apr 15 2011
    • Singapore, 00-SG
    • Posts 61
    • Points 1,245
    snapping to edges when invoking an enterBox Reply

    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

    • Post Points: 35
  • Tue, May 15 2012 7:35 AM

    • dmay
    • Top 10 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 358
    • Points 6,660
    Re: snapping to edges when invoking an enterBox Reply

    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

    • Post Points: 20
  • Tue, May 15 2012 6:56 PM

    • Adhil
    • Top 100 Contributor
    • Joined on Fri, Apr 15 2011
    • Singapore, 00-SG
    • Posts 61
    • Points 1,245
    Re: snapping to edges when invoking an enterBox Reply

    i use the the code that you provided but the cursor point fails to snap on to edges... i also toggled the infix option in the bbox but no change was observed. in addition, in layout editor options i unclicked turn off infix in smart snapping, but still the same.

    • Post Points: 20
  • Wed, May 16 2012 6:29 AM

    • dmay
    • Top 10 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 358
    • Points 6,660
    Re: snapping to edges when invoking an enterBox Reply

    Here are some things you should try to get this working:

    1. Test the gravity control settings in the leHiEditEditorOptions() form until you can get them to work the way you want for this command. Then set the appropriate cdsenv variables before and after your command.
    2. One other variable you may need to set is the gravityAperture. Maybe this variable isn't big enough so you aren't seeing any significant snap. This setting indicates how close you need to get to an edge before snapping occurs. The code I sent left this at the default which is 0.3 as provided by Cadence.
    envSetVal("layout" "gravityAperture" 'float   1.0)
    3. You will not see the edges highlighted like when you are using the ruler command. I don't know how to enable this or if it is even possible. These settings will simply snap the cursor to an edge.
    4. The settings I provided only enable snapping to edges. If you are wanting to snap to vertices or centerlines, you'll to update the gravityType string.
    5. The layers must be selectable for snapping to work.

    I hope this helps.

    Derek

    • Post Points: 5
  • Wed, May 16 2012 8:22 AM

    • psill
    • Top 500 Contributor
    • Joined on Sat, Mar 24 2012
    • Posts 24
    • Points 405
    Re: snapping to edges when invoking an enterBox Reply
    It's not the fix you probably want, but the I think the you might want to try the function:

    geAdjustPoint(
    l_point
    [ w_windowId ]
     )
         => l_point | nil


    Returns the point after applying the adjustment associated to the window Id provided. Adjustment is defined using gravity, the current snap grid, and any snap mode defined in the window interface.

     

    It does not have the graphic gravity snap you may want, but it is suppose to adjust for gravity.
    • Post Points: 5
Page 1 of 1 (5 items)
Sort Posts:
Started by Adhil at 14 May 2012 11:54 PM. Topic has 4 replies.