How to snap instances and shapes from grid 0.1 to 0.0625

Discussion in 'Cadence' started by yudi, Dec 13, 2006.

  1. yudi

    yudi Guest

    Hi,

    I would like to have a skill which will snap all the Composer
    Schematics objects without override one the others, from grid of 0.1 to
    grid of 0.0625 (metrics to inches system...).

    It is not simple as it is, as if you move the objects like in the
    following script you can override and make shorts between exsist nets,
    or lose the instance pin connectivity ...

    The main idea to to re-route all the conectivties, but without lose the
    topology..., also the junctions should remain as it was before (solded
    dots)

    Also we might consider that the templates pins are located at the grid
    of 0.1, and this should be fixed
    while mantaining the connctivity - "the egg and the chicken" probelm...

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Program to snap Composer inst and wires to grid
    ; Operates on selected items in current schematic,
    ; does entire schematic if nothing selected.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    procedure( BAD_gridFix()
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    let((cv count Set Settemp grid newpoints pointi shapeCoords)
    ;
    ; Open currently edited cellview
    cv = geGetEditCellView(getCurrentWindow())

    if(geGetObjectSelectedSet() != nil then
    println("selected")
    Settemp = geGetObjectSelectedSet()
    Set = nil
    foreach( item Settemp Set=append(Set list(car(item))) )
    else
    Set = append(cv~>instances cv~>shapes)
    println("nothing selected - operating on entire cellview")
    )

    ; Get the current snap spacing
    grid = schGetEnv("schSnapSpacing")

    count = 0

    ; Loop through and find all the items off grid
    foreach( shape Set
    ; For instances
    shapeCoords = shape~>xy
    when( shapeCoords
    when( (int(xCoord(shapeCoords)/grid) !=
    xCoord(shapeCoords)/grid ) ||
    (int(yCoord(shapeCoords)/grid) !=
    yCoord(shapeCoords)/grid )
    count = count + 1
    shape~>xy =
    int(xCoord(shapeCoords)/grid+0.0625)*grid:int(yCoord(shapeCoords)/grid+0.0625)*grid
    )
    )

    ; For wires
    when( shape~>points
    newpoints=nil
    for(i 1 shape~>nPoints
    pointi = nth(i-1 shape~>points)
    if( (int(xCoord(pointi)/grid) != xCoord(pointi)/grid )
    ||
    (int(yCoord(pointi)/grid) != yCoord(pointi)/grid )
    then
    count = count + 1
    newpoints =
    cons(int(xCoord(pointi)/grid+0.0625)*grid:int(yCoord(pointi)/grid+0.0625)*grid
    newpoints)
    else
    newpoints = cons(nth(i-1 shape~>points) newpoints)
    )
    );foreach
    shape~>points = newpoints
    )
    ); foreach

    ; Print a report
    when( count>0
    printf("... INFO: %d Offgrid items moved\n" count )
    )
    )
    )
     
    yudi, Dec 13, 2006
    #1
  2. yudi

    Erik Wanta Guest

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.