• 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. Get the points selected by mouse of the stretch for pat...

Stats

  • Locked Locked
  • Replies 18
  • Subscribers 143
  • Views 17493
  • 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

Get the points selected by mouse of the stretch for pathSeg

Leonardo Vinci
Leonardo Vinci over 4 years ago

Hello,

For getting coordinates of pathSeg, I used geGetSelSetFigPoint(shapeId), but this only returns (t nil) or (nil t) based on pathSeg's beginPt and endPt selected.

But let suppose I have a horizontal metal pathSeg. And for stretching, I am selecting the right side of this horizontal metal pathSeg to be stretched, how should I get the coordinates of the selected side(right side in this case) of this metal irrespective of its beginPt or endPt.

Also, I dont know wheather the user will select the left coordinate or right coordinate of the pathSeg, so basically I need coordinates of selected side of stretch command.

Thanks,

Leo

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    Leo,

    I think I misinterpreted your previous post. I think you want this:

    selectedPoints=foreach(mapcan (sel pt) geGetSelSetFigPoint(shapeId) list(shapeId~>beginPt shapeId~>endPt) sel && list(pt))

    That will be a list of whichever points were selected (so if only one end is selected, it will be a list of one point)

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Leonardo Vinci
    Leonardo Vinci over 3 years ago in reply to Andrew Beckett

    selectedPoints=foreach(mapcan (sel pt) geGetSelSetFigPoint(shapeId) list(shapeId~>beginPt shapeId~>endPt) sel && list(pt))


    Hi Andrew Beckett For the "path" this code is not working and its giving me coordinates of both end points. How can I get the coordinates of only the selected side irrespective whether its a "path" or "pathSeg"?

    Regards,

    Leo

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to Leonardo Vinci

    If the object was a path, then this will return either nil, (nil) or (nil nil) depending on whether the first and/or second points are selected. It can't return the coordinates because path objects don't have a beginPt or endPt attribute.

    If you want it to work for a path too, then it would be

    selectedPoints=foreach(mapcan (sel pt) geGetSelSetFigPoint(shapeId) shapeId~>points || list(shapeId~>beginPt shapeId~>endPt) sel && list(pt))

    This first looks for a points attribute, and if that's present it uses that. If not it assumes there is a beginPt or endPt attribute.

    The code is being a bit lazy by not checking the objType of the object and doing the right thing - so this only really makes sense if it's a path or a pathSeg (it will also work for a polygon and various boundary objects too, since they also have a points list),

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to Leonardo Vinci

    If the object was a path, then this will return either nil, (nil) or (nil nil) depending on whether the first and/or second points are selected. It can't return the coordinates because path objects don't have a beginPt or endPt attribute.

    If you want it to work for a path too, then it would be

    selectedPoints=foreach(mapcan (sel pt) geGetSelSetFigPoint(shapeId) shapeId~>points || list(shapeId~>beginPt shapeId~>endPt) sel && list(pt))

    This first looks for a points attribute, and if that's present it uses that. If not it assumes there is a beginPt or endPt attribute.

    The code is being a bit lazy by not checking the objType of the object and doing the right thing - so this only really makes sense if it's a path or a pathSeg (it will also work for a polygon and various boundary objects too, since they also have a points list),

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Leonardo Vinci
    Leonardo Vinci over 3 years ago in reply to Andrew Beckett

    This is again giving me coordinates of both the sides and not the selected side coordinate. 

    Leo

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to Leonardo Vinci

    Presumably both sides are selected then. I cannot see how it can happen otherwise.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Leonardo Vinci
    Leonardo Vinci over 3 years ago in reply to Andrew Beckett

    I am selecting one side only but it gives me the whole points list of the path ie ((x1 y1) (x2 y2)) but I want the points which I selected d by mouse. 

    Actually I have written a code which works with only pathSeg and now wants to make it work for path too. But I don’t want to write the whole code again, and hence am trying to find a way to convert the path to pathSeg and then run the rest of the code as it is.

    I am running leConvertShapeToPathSeg() command(over selected shapes) to convert a path to pathSeg and then require the coordinates of the selected side of this converted pathSeg. 

    But when I am running this convert command, it seems the dbID of this path changes(as now it became a pathSeg) and also it breaks my selection with mouse which I selected and now the whole shape(conveted pathSeg shape) is selected and not the side which I selected earlier, and because of this the further code(which wants the mouse selected side coordinates of pathSeg as input) is not running.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to Leonardo Vinci

    That was a rather important piece of information that you didn't mention! Normally if you use leConvertShapeToPathSeg() it doesn't leave the result selected at all, let alone only partially selected.

    I suspect it would be worth expanding your code to deal with the paths natively, but an alternative could be to use this code that I just wrote which wraps around leConvertShapeToPathSeg, preserving the selected vertices of the resulting shapes (it also returns the list of new pathSegs):

    ;------------------------------------------------------------------------
    ; Convert a path to a list of pathSegs, keeping the selected points
    ; the same as before
    ;------------------------------------------------------------------------
    procedure(CCFpathToPathSeg(@optional (path car(geGetSelSet())))
      let((selPoints newPathSegs)
        selPoints=geGetSelSetFigPoint(path)
        newPathSegs=leConvertShapeToPathSeg(path)
        foreach(map (objs points) newPathSegs selPoints
          geSelectFigPoint(car(objs) list(car(points) cadr(points)))
        )
        newPathSegs
      )
    )
    • Cancel
    • Vote Up +1 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