• 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 Design
  3. Gravity Snapping in IC 6.1.7

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 125
  • Views 15837
  • 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

Gravity Snapping in IC 6.1.7

stefan6
stefan6 over 7 years ago

Hello,

How can I enable gravity snapping to center of objects/layers in Cadence Virtuoso Layout? This was previously available as a check box in the Layout Editor Options.

Thanks.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    The gravity capability was changed to make it simpler in IC617, but there's still been quite a lot of demand to provide the flexibility there was before. The good news is that it's still there, just not on the form.

    See Gravity controls missing from IC6.1.7 Virtuoso Layout Editor Options form (there's also a CCR to request that the detailed gravity controls are restored to the options form). 

    A colleague in my team (thanks Norman!) wrote this code a while back which you can use in the meantime:

    procedure( CCScreateMyGravityForm()
            let( (label all none centerline edge midpoint vertex end nexus pin
                                    origin distance depth)
                    label=hiCreateLabel(
                            ?name 'type
                            ?labelText "Types")
                    all=hiCreateBooleanButton(
                            ?name 'all 
                            ?defValue t 
                            ?buttonText "all" 
                            ?buttonLocation 'left 
                            ?callback "CCSsetAllTypesOn(hiGetCurrentForm())" )
                    none=hiCreateBooleanButton(
                            ?name 'none 
                            ?defValue nil 
                            ?buttonText "none" 
                            ?buttonLocation 'left 
                            ?callback "CCSsetAllTypesOff(hiGetCurrentForm())" )
                    centerline=hiCreateBooleanButton(
                            ?name 'centerline 
                            ?defValue t 
                            ?buttonText "centerline" 
                            ?buttonLocation 'left )
                    edge=hiCreateBooleanButton(
                            ?name 'edge 
                            ?defValue t 
                            ?buttonText "edge" 
                            ?buttonLocation 'left )
                    midpoint=hiCreateBooleanButton(
                            ?name 'midpoint 
                            ?defValue t 
                            ?buttonText "midpoint" 
                            ?buttonLocation 'left )
                    vertex=hiCreateBooleanButton(
                            ?name 'vertex 
                            ?defValue t 
                            ?buttonText "vertex" 
                            ?buttonLocation 'left )
                    end=hiCreateBooleanButton(
                            ?name 'end 
                            ?defValue t 
                            ?buttonText "end" 
                            ?buttonLocation 'left )
                    nexus=hiCreateBooleanButton(
                            ?name 'nexus 
                            ?defValue t 
                            ?buttonText "nexus" 
                            ?buttonLocation 'left )
                    pin=hiCreateBooleanButton(
                            ?name 'pin 
                            ?defValue t 
                            ?buttonText "pin" 
                            ?buttonLocation 'left )
                    origin=hiCreateBooleanButton(
                            ?name 'origin 
                            ?defValue t 
                            ?buttonText "origin" 
                            ?buttonLocation 'left )
                    distance=hiCreateCyclicField(
                            ?name 'distance
                            ?prompt "Distance"
                            ?choices list("Small" "Medium" "Large" "Very Large")
                            ?defValue "Large")
                    depth=hiCreateIntField(
                            ?name 'depth
                            ?value 3
                            ?prompt "Depth")
    
                    hiCreateAppForm(
                            ?name 'gravityOptionsForm
                            ?formTitle "Gravity Controls" 
                            ?fields list(
                              list(label 0:0 100:10)
                                                            list(all 100:0 100:10)
                                                            list(none 200:0 100:10)
                                                            list(centerline 0:20 100:10)
                                                            list(edge 100:20 100:10)
                                                            list(midpoint 200:20 100:10)
                                                            list(vertex 0:40 100:10)
                                                            list(end 100:40 100:10)
                                                            list(nexus 200:40 100:10)
                                                            list(pin 0:60 100:10)
                                                            list(origin 100:60 100:10)
                                                            list(distance 0:80 100:10 70)
                                                            list(depth 200:80 100:10 70)
                                                            ) 
                            ?buttonLayout 'OKCancelApply
                            ?callback 'CCSsetGravityOptions
                            ?dontBlock t
                    )
            )
    )
                                                            
    procedure(CCSsetAllTypesOn(theForm)
      theForm->none->value=nil
            theForm->centerline->value=t
            theForm->edge->value=t
            theForm->midpoint->value=t
            theForm->vertex->value=t
            theForm->end->value=t
            theForm->nexus->value=t
            theForm->pin->value=t
            theForm->origin->value=t
    )
    
    procedure(CCSsetAllTypesOff(theForm)
      theForm->all->value=nil
            theForm->centerline->value=nil
            theForm->edge->value=nil
            theForm->midpoint->value=nil
            theForm->vertex->value=nil
            theForm->end->value=nil
            theForm->nexus->value=nil
            theForm->pin->value=nil
            theForm->origin->value=nil
    )
    
    procedure(CCSsetGravityOptions(theForm) 
            let((value)
      value = " "
      when(theForm->centerline->value value=strcat(value " centerline"))
            when(theForm->edge->value value=strcat(value " edge"))
      when(theForm->midpoint->value value=strcat(value " midpoint"))
      when(theForm->vertex->value value=strcat(value " vertex"))
            when(theForm->end->value value=strcat(value " end"))
      when(theForm->nexus->value value=strcat(value " nexus"))
            when(theForm->pin->value value=strcat(value " pin"))
      when(theForm->origin->value value=strcat(value " origin")) 
            envSetVal("layout" "gravityType" 'string value)
            printf("gravity type settings : %L\n" leGetEnv("gravityType"))
            envSetVal("layout" "gravityDistance" 'string theForm->distance->value)
            printf("gravity distance setting : %s\n" leGetEnv("gravityDistance"))
      envSetVal("layout" "gravityDepth" 'int theForm->depth->value)
            printf("gravity depth setting : %d\n" leGetEnv("gravityDepth"))
            )
    )
    
    procedure(CCSmyGravity()
      unless(boundp('gravityOptionsForm)
                    CCScreateMyGravityForm()
            )
            hiDisplayForm('gravityOptionsForm)
    )
    
    hiSetBindKey("Layout" "<Key>F8" "CCSmyGravity()")
    

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • stefan6
    stefan6 over 7 years ago in reply to Andrew Beckett

    It works flawlessly! Thanks,

    Stefan 

    • 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