• 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. Deleting text label from selected object

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 144
  • Views 17978
  • 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

Deleting text label from selected object

Carona
Carona over 7 years ago

I was browsing around the forums looking for a simple solution, and I discovered this 

txtLp = car(setof(lp cv~>lpps lp~>layerName=="text" && lp~>purpose=="drawing")) ;; get the text layer purpose database object
mapcar('dbDeleteObject txtLp~>shapes) ;; delete all labels and textDisplays

However this deletes all text from a virtuoso active window. I was hoping to modify this to only delete a text label from the selected object.

I can go into further detail as to why I would like that feature, but basically I want to perform a transformation on a shape and then add a label to the center of the shape.

So, I want to first delete an existing label, then create a new one.  I have the create a new label portion of code that works well.

This solution works with one shape, but if there are multiple shapes, every time I select a new shape to modify, its text label will be removed from the other shapes.

Thanks for your help

  • Cancel
  • psill000
    psill000 over 7 years ago

    txtLp = car(setof(lp geGetSelSet()~>lpps lp~>layerName=="text" && lp~>purpose=="drawing"))

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Carona
    Carona over 7 years ago in reply to psill000

    perfect!!! Appreciate the help.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Carona
    Carona over 7 years ago in reply to psill000

    I spoke a lil too soon, I swapped in your line of code to replace my previous one and when I run it, the other texts no longer are deleted, but also, the current selected objects text also still remains.

    mapcar('dbDeleteObject txtLp~>shapes) ;; delete all labels and textDisplays

    perhaps there is a better way of going about this, but I just want a way to have the selected object's text label deleted first.

    Then have a new text label generated at the new center point.

    1 - identify existing text of object, which you provided

    2 -  remove any text label, this is currently failing

    3 - generate new text label at center point, this I already have working.

    txtLp = car(setof(lp geGetSelSet()~>lpps lp~>layerName=="text" && lp~>purpose=="drawing"))
    mapcar('dbDeleteObject txtLp~>shapes)

    disp=dbCreateTextDisplay( net X list("text" "drawing" ) t centerBox(X~>bBox) "centerCenter" "R0" "roman" abs(dy/2) nil nil t nil t "name" nil) ;;Creates text label from net name of figure

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • psill000
    psill000 over 7 years ago in reply to Carona

    I am away from my computer, but try the line below, I deleted the "car(".

    txtLp = setof(lp geGetSelSet()~>lpps lp~>layerName=="text" && lp~>purpose=="drawing")

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • psill000
    psill000 over 7 years ago in reply to psill000

    and

    mapcar('dbDeleteObject txtLp)

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

    This approach is rather strange. What it's doing is finding the layer purpose pairs for all the selected objects, and then deleting all shapes (labels, textDisplays or anything) on those layer-purposes rather than either just those which are selected, or which have an association with the selected objects. I somehow doubt that's what you want.

    I'm guessing that you have the objects selected (but not the textDisplays) and want to delete the associated (attached) textDisplays. If so, code such as the following will do what you want:

    foreach(selObj geGetSelSet()
      foreach(child selObj~>children
        when(member(child~>objType '("label" "textDisplay")) && child~>layerName=="text" && child~>purpose=="drawing"
          dbDeleteObject(child)
        )
      )
    )

    Note that this is deleting both attached labels and textDisplays - if you don't want it to do labels then you'd use when(child~>objType=="textDisplay" && ... . Needless to say the textDisplays have to be attached (which dbCreateTextDisplay does for you) for the relationship to be found - simply having them physically over the top of the object isn't enough.

    Regards,

    Andrew.

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

    Yes, that is exactly what my intention was.  I wanted to first delete the text before I regenerated a new one, this solution does exactly that.  I need to go back and get more acquainted with 

    the basics. Thanks for the help.

    • 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