• 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 to Retrieve the value of dX and dY in the current w...

Stats

  • Locked Locked
  • Replies 18
  • Subscribers 143
  • Views 22014
  • 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 to Retrieve the value of dX and dY in the current window

ClintMeyer
ClintMeyer over 14 years ago

I would like to create a script that will automatically move whatever I have selected in a layout window by the same amount as the last move.  The last move/copy/stretch relative distance is displayed in the layout window as dX and dY (standing for delta X and delta Y i presume).  Is there a skill function that returns that value?  I looked under the hiGetCurrentWindow() and it was not there.

 Thanks for any help

 Clint

 

  • Cancel
  • cessej
    cessej over 14 years ago

    Its the same problem as discussed in the previous replies. Deltax/&y is wrong when the snap cursor is not "Any Angle".

    My code actually get's the object's bounding box changes when performing move or copy. By doing this, you don't care about the snap cursor because your calculating the delta between old position(old bbox) to new position(bbox)

    Though its working, I still preferred to short one. I hope we can get the updates.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    And it seems to assume pre-selection, and I don't think it handles stretch. I didn't try to work out why (no time, sorry - already spent longer than I meant to on trying to find the elegant solution, and I'm sure it's not insurmountable). Anyway, will focus on trying to get a short, elegant solution!

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • cessej
    cessej over 14 years ago

    Yes, the problem is my code is not suitable for stretch.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ClintMeyer
    ClintMeyer over 14 years ago
    Pre-selection is an oft used case due to how repeat commands works and whether or not I want to maintain my selected set after the command finishes.

    Also stretch would need to work.

    While I only use diagonal and any angle snapping modes, I rarely move along the diagonal (it only gives me flexibility inside of a split command), so I can modify dmay's code and apply the orthogonal case to diagonal. I will try that out to see if it works.

    Thanks
    Clint
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ClintMeyer
    ClintMeyer over 14 years ago

    Guys

     Thanks for the help, this is a very useful function that will see a lot of use across my entire layout team.  Your effort and expertise is greatly appreciated.   

    I have brought all the pieces together and fixed a couple issues.  I also have a couple questions  (See end)

    Functional Bug

    needed absolute value when evaluating which term of delta variable was larger

    Code Bug 

    added =list( to the abGetDxDy.lastDelta variable in orthogonal and diagonal mode

     

    ;Procedure to set a variable that represents the relative X and Y for the last move, copy or stretch

     procedure(abGetDxDy(@optional (win hiGetCurrentWindow()))
     let((refPoint curPoint)
      refPoint=leGetRefPoint(geGetEditCellView(win))
      curPoint=hiGetCommandPoint(win)
      when(refPoint && curPoint && member(hiGetCurrentCmd(win) '("Move" "Copy" "Stretch"))
       case(hiGetCurrentWindow()~>snapMode
             ("anyAngle"
             abGetDxDy.lastDelta=mapcar('difference curPoint refPoint)
             )
             ("orthogonal"
               delta = mapcar('difference curPoint refPoint)
               if(abs(car(delta)) >= abs(cadr(delta))
               abGetDxDy.lastDelta=list(car(delta) 0.0 )
               abGetDxDy.lastDelta=list(0.0 cadr(delta))
               )
             )     
             ("diagonal"
               delta = mapcar('difference curPoint refPoint)
               if(abs(car(delta)) >= abs(cadr(delta))
               abGetDxDy.lastDelta=list(car(delta) 0.0 )
               abGetDxDy.lastDelta=list(0.0 cadr(delta))
               )    
             )
           )
      )
     )
    )

    ;bindkey to make it work 

    hiSetBindKey("Layout" "<Btn1down>EF" "abGetDxDy() mouseAddPt()")

     Now my questions. 

    I have the variable working as I want inside of stretch/move commands.  However in my quest to get it working inside of copy I am having an issue.  With the bindkey below I need to press it TWICE to make it work ONCE and I get a warning in the icfb.  I think this comes back to my lack of understanding of enter function.  The reason I am trying to do it this way is because I want to maintain the selected set after the copy. 

    Can you give me a hint on how to make this bindkey work?

    hiSetBindKey("Layout" "Meta<Key>=" "leHiCopy() le0CopyForm->segSnapMode->value = \"anyAngle\" le0CopyForm->DeltaXField->value = car(abGetDxDy.lastDelta) le0CopyForm->DeltaYField->value = cadr(abGetDxDy.lastDelta) _leApplyDeltaCB (hiGetCurrentWindow()) " )

    *WARNING* hiGetWindowStackPts: enter function is inactive

    Thanks 

    Clint

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Clint,

    As I mentioned in the separate email discussion, having discussed with R&D, there is no function to truly get the "snapped" X and Y (and hence dX and dY) values. The snapping is actually done by the application - and may vary depending on the command currently being performed - so it's actually not that straightforward to emulate in all cases. However, I think the way you've done it is a reasonable compromise. I have filed an enhancement request to get hold of the XY value from the banner - because the "hi" interface knows what the current snapped value is in order to display in the banner and also to update the cursor location - but that will be for a future release.

    In terms of implementing your additional bindkey, I would not try to do it by interfacing with the leHiCopy() function and piggybacking on the form. For a start, the form identifier will vary depending on how many technologies you have open. Secondly it's blocking, so you'd have to start messing with hiRegTimer() to ensure your updates got applied. Thirdly you're tied to private information about the field names on the form, and these may (and indeed have) changed over time. For example, I don't think the callback was called that in the version I tried.

    So a better approach is probably to implement a function like this:

    procedure(abMoveOrCopyByDelta(function delta @optional selectNew)
        let((new (win hiGetCurrentWindow()) cvId (transform (list delta "R0" 1)))
            when(delta && listp(delta) && numberp(xCoord(delta)) && 
                numberp(yCoord(delta)) && !cddr(delta)
                cvId=geGetEditCellView(win)
                new=foreach(mapcar fig geGetSelSet(win)
                    funcall(function fig cvId transform)
                )
                when(selectNew
                    geDeselectAll(win)
                    foreach(fig new
                        geSelectFig(fig)
                    )
                )
                new
            )
        )
    )
    
    hiSetBindKey("Layout" "Meta<Key>=" "abMoveOrCopyByDelta('dbCopyFig abGetDxDy.lastDelta)")

     

    The function copes with both copy and move. You can call:

    abMoveOrCopyByDelta('dbMoveFig abGetDxDy.lastDelta)

    and also if you want the copy to select the newly copied figures, you would do:

    abMoveOrCopyByDelta('dbCopyFig abGetDxDy.lastDelta t)

    Note that in the implementation of abGetDxDy above it is using ~>snapMode - I think it should be ~>segSnapMode as that's what is updated by the copy command (that's the "edit" snap mode rather than the "create" snap mode).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PeteVT
    PeteVT over 7 years ago in reply to Andrew Beckett

    Hello, I was interested in implementing what was discussed in this thread and would like to know if there were any new developments in how this could be implemented. We use ICADV12.1 and 12.3 depending on the project. Is it possible there is a simpler implementation for the delta value calculation for example?

    Thanks very much,

    Pete

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to PeteVT

    I don’t think anything has changed related to this.

    Regards,

    Andrew.

    • 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