• 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. how do you toggle between enterPoint() and enterBox()

Stats

  • Locked Locked
  • Replies 15
  • Subscribers 143
  • Views 19072
  • 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

how do you toggle between enterPoint() and enterBox()

Adhil
Adhil over 13 years ago

Hi

I am trying to create this align function that functions similarly to that of icstation.

the following describes how the macro is used

1. you select the object that you want to move to align

2. invoke the align function via a bindkey

3. the function prompts you to enter a point which it then uses to select the reference object.

4. complete the action by moving the initially object and aligning it to the reference object.

 how can i make the selection of the reference object be versatile so that i can click to select a reference object or draw a box to select multiple reference objects. i was thinking of a function  that can toggle between enterpoint() or enterbox(), but i dont know how to do this. please help.

thanks

Adhil

  • Cancel
Parents
  • dmay
    dmay over 13 years ago

    Try this:

    procedure(xAlign()
        myAlign("X")
    ) ;proc

    procedure(yAlign()
        myAlign("Y")
    ) ;proc


    procedure(myAlign(dir)
    let((objects obj shift sourceBox refObjects refBox pt)

        objects = geGetSelSet() ; selects objects to be moved to align

        pt = enterPoint(                   ; prompts the user to enter a point which will be used to select the reference object
          ?prompts list("Select the ref object")
          ?addPointProc "myAddPointProc"
          ?initProc "setSelectionMode"
          ?cmdName "xAlign"
        )
        sourceBox = trBBoxUnion(objects~>bBox)

        if(refObjects = setof(x geGetSelSet() !memq(x objects))
            refBox = trBBoxUnion(refObjects~>bBox)
            refBox = list(pt pt)
        )
        if(dir == "X"
            shift = list(getXshift(sourceBox refBox) 0)
            shift = list(0 getYshift(sourceBox refBox))
        )
        foreach(obj objects
          dbMoveFig(obj geGetEditCellView() list(shift "R0"))
        )
        geDeselectAll()
        mapcar('geSelectObject objects)
     
     )
    )

    procedure(myAddPointProc(win pt)
        geAddSelectPoint(hiGetCurrentWindow() nil car(pt)) ; selecting the reference object
    ) ;proc

    procedure(setSelectionMode(@optional (win hiGetCurrentWindow()))
        geSetEnterFunctionSelectionMode(win 4)
    )

    procedure(trBBoxUnion( bBoxList )
      let((llxList llyList urxList uryList minllx minlly maxurx maxury)
        llxList = foreach(mapcar bBox bBoxList xCoord(lowerLeft(bBox)))
        llyList = foreach(mapcar bBox bBoxList yCoord(lowerLeft(bBox)))
        urxList = foreach(mapcar bBox bBoxList xCoord(upperRight(bBox)))
        uryList = foreach(mapcar bBox bBoxList yCoord(upperRight(bBox)))
        minllx = apply('min llxList)
        minlly = apply('min llyList)
        maxurx = apply('max urxList)
        maxury = apply('max uryList)
        list(minllx:minlly maxurx:maxury)
      )
    )

    procedure(getXshift(srcBox refBox)
      let((x1 x2)
        x1 = car(centerBox(srcBox))
        x2 = car(centerBox(refBox))
        x2-x1
      ) ;let
    ) ;proc
    procedure(getYshift(srcBox refBox)
      let((y1 y2)
        y1 = cadr(centerBox(srcBox))
        y2 = cadr(centerBox(refBox))
        y2-y1
      ) ;let
    ) ;proc

    procedure(CreateAlignSet()
      let((pts)
        pts = enterBox( ?prompts list("Select the ref objects"))
        geAddSelectBox(hiGetCurrentWindow() nil pts) ; selecting the reference objects
        cancelEnterFun() ;Cancels the enterPoint that started this whole thing
      ) ;let
    ) ;proc

    ;This is necessary otherwise you'll lose the default functionality
    ;that allows geSingleSelectBox to work during other enterFunctions
    procedure(drawThru1Bk()
        case(hiGetCurrentCmd(hiGetCurrentWindow())
            (("xAlign" "yAlign")
                CreateAlignSet()
            )
            (t
                geSingleSelectBox()
            )
        )
    ) ;proc

    hiSetBindKey("Layout" "<DrawThru1> EF" "drawThru1Bk")
    hiSetBindKey("Layout" "<Key>x" "xAlign()")
    hiSetBindKey("Layout" "<Key>y" "yAlign()")

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

    Try this:

    procedure(xAlign()
        myAlign("X")
    ) ;proc

    procedure(yAlign()
        myAlign("Y")
    ) ;proc


    procedure(myAlign(dir)
    let((objects obj shift sourceBox refObjects refBox pt)

        objects = geGetSelSet() ; selects objects to be moved to align

        pt = enterPoint(                   ; prompts the user to enter a point which will be used to select the reference object
          ?prompts list("Select the ref object")
          ?addPointProc "myAddPointProc"
          ?initProc "setSelectionMode"
          ?cmdName "xAlign"
        )
        sourceBox = trBBoxUnion(objects~>bBox)

        if(refObjects = setof(x geGetSelSet() !memq(x objects))
            refBox = trBBoxUnion(refObjects~>bBox)
            refBox = list(pt pt)
        )
        if(dir == "X"
            shift = list(getXshift(sourceBox refBox) 0)
            shift = list(0 getYshift(sourceBox refBox))
        )
        foreach(obj objects
          dbMoveFig(obj geGetEditCellView() list(shift "R0"))
        )
        geDeselectAll()
        mapcar('geSelectObject objects)
     
     )
    )

    procedure(myAddPointProc(win pt)
        geAddSelectPoint(hiGetCurrentWindow() nil car(pt)) ; selecting the reference object
    ) ;proc

    procedure(setSelectionMode(@optional (win hiGetCurrentWindow()))
        geSetEnterFunctionSelectionMode(win 4)
    )

    procedure(trBBoxUnion( bBoxList )
      let((llxList llyList urxList uryList minllx minlly maxurx maxury)
        llxList = foreach(mapcar bBox bBoxList xCoord(lowerLeft(bBox)))
        llyList = foreach(mapcar bBox bBoxList yCoord(lowerLeft(bBox)))
        urxList = foreach(mapcar bBox bBoxList xCoord(upperRight(bBox)))
        uryList = foreach(mapcar bBox bBoxList yCoord(upperRight(bBox)))
        minllx = apply('min llxList)
        minlly = apply('min llyList)
        maxurx = apply('max urxList)
        maxury = apply('max uryList)
        list(minllx:minlly maxurx:maxury)
      )
    )

    procedure(getXshift(srcBox refBox)
      let((x1 x2)
        x1 = car(centerBox(srcBox))
        x2 = car(centerBox(refBox))
        x2-x1
      ) ;let
    ) ;proc
    procedure(getYshift(srcBox refBox)
      let((y1 y2)
        y1 = cadr(centerBox(srcBox))
        y2 = cadr(centerBox(refBox))
        y2-y1
      ) ;let
    ) ;proc

    procedure(CreateAlignSet()
      let((pts)
        pts = enterBox( ?prompts list("Select the ref objects"))
        geAddSelectBox(hiGetCurrentWindow() nil pts) ; selecting the reference objects
        cancelEnterFun() ;Cancels the enterPoint that started this whole thing
      ) ;let
    ) ;proc

    ;This is necessary otherwise you'll lose the default functionality
    ;that allows geSingleSelectBox to work during other enterFunctions
    procedure(drawThru1Bk()
        case(hiGetCurrentCmd(hiGetCurrentWindow())
            (("xAlign" "yAlign")
                CreateAlignSet()
            )
            (t
                geSingleSelectBox()
            )
        )
    ) ;proc

    hiSetBindKey("Layout" "<DrawThru1> EF" "drawThru1Bk")
    hiSetBindKey("Layout" "<Key>x" "xAlign()")
    hiSetBindKey("Layout" "<Key>y" "yAlign()")

    • 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