• 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 pass a value from a procedure to another?

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 144
  • Views 14553
  • 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 pass a value from a procedure to another?

sruzzu
sruzzu over 6 years ago

Hi everybody,

I'm trying to make a skill that renames all the selected objects in the layout with a value that I insert in the form and merging it with a counter.

For example: If I have 30 copied resistors (I1, I2,I3,..., I30), I want to rename them R0.1, R0.2, ..., R0.30 .

At first try I made a single procedure that creates the form and renames. That seemed to work correctly but, if I press the button "cancel" in the form, the procedure continues and renames all the selected objects with the value of the counter (1,2,3...,30).

So I decided to make two procedure, one for the creation of the form and another for the execution of the renaming.

There is only one problem I can't really figure out: how can I pass the name, that I wrote in the form, to the procedure of execution?  

Hope someone can help me.

Bye bye :)

Here it is my procedure:

/*CREATE FORM*/
procedure( change()
let((myform changeName)        


/*CHECK LAYOUT VIEW*/

if( (geGetEditCellView()~>cellViewType != "maskLayout")
 then hiDisplayAppDBox(
   ?name 'errorbox2
   ?dboxBanner "Errore"
   ?dboxText sprintf( nil "La procedura funziona solo con Layout Window")
   ?dialogType hicErrorDialog
   ?buttonLayout 'Close  
   ?dialogStyle 'modal
   )
 )
  


changeName=hiCreateStringField(
                ?name 'changeName
                ?prompt "Inserire nome"            
  ?defValue ""
  ?editable t
  ;?callback "esec()"
    )

 
 hiCreateAppForm(
            ?name 'myform
            ?formTitle "Change Instance Name"
           ?fields list( changeName )
     ?callback "exec(changeName~>value)"
  )




hiDisplayForm(myform)


)
)


/*EXECUTION RENAMING*/

procedure( exec()
let( (changeName nome num)

nome = changeName~>value

if( (rexMatchp("symbol" buildString(geGetSelSet()~>viewName)) == nil) && (rexMatchp("lay" buildString(geGetSelSet()~>viewName)) == t)
  then for(i 1 geGetSelSetCount()
 
   sprintf(num "%d" i)
   geGetSelSet()~>name = strcat(nome num)
   geSelectNextInSelSet()
  
 )
 )

)
)
  • Cancel
Parents
  • francktellier
    francktellier over 6 years ago

    Hello,

    You must add an argument in the exec procedure , and remove the definition of "nome" in the body of the procedure

    please try the following syntax :

    procedure( exec(nome)
    let( (changeName  num)

    ;;;nome = changeName~>value

    if( (rexMatchp("symbol" buildString(geGetSelSet()~>viewName)) == nil) && (rexMatchp("lay" buildString(geGetSelSet()~>viewName)) == t)
      then for(i 1 geGetSelSetCount()
     
       sprintf(num "%d" i)
       geGetSelSet()~>name = strcat(nome num)
       geSelectNextInSelSet()
     
     )
     )

    )
    )

    Best Regards

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • sruzzu
    sruzzu over 6 years ago in reply to francktellier

    Hello Franck,

    thanks a lot for your response. 

    It works! Can you explain why should I do it? I don't understand clearly what I have to put as argument of a procedure in general.

    Another thing which I can't understand is a warning that appears. It looks like that the exec enters in a loop and tries to overwrite the name of the first selected item since the end of the counter.
    That's really strange.

    Thank you again Slight smile

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 6 years ago in reply to sruzzu

    Hi,

    Rather than using for() with a counter, simply iterate over the selected items using foreach(), e.g. foreach(obj geGetSelSet() ...) - it looks as though your code is actually changing what is selected?

    I have not gone through your code in detail but hopefully this alternative approach will help?

    Regards,

    Lawrence.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • sruzzu
    sruzzu over 6 years ago in reply to skillUser

    Hi Lawrence,

    thanks you very much for your answer. It works!

    Regards,

    Stefano

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • sruzzu
    sruzzu over 6 years ago in reply to skillUser

    Hi Lawrence,

    thanks you very much for your answer. It works!

    Regards,

    Stefano

    • 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