• 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. Any node - Skill for the automatic ruler creation of user...

Stats

  • Replies 2
  • Subscribers 151
  • Views 341
  • Members are here 0

Any node - Skill for the automatic ruler creation of user-defined lengths ( Working Fine)

yogeshjaiswalCAD
yogeshjaiswalCAD 4 days ago

Greetings All,

I am grateful for your assistance whenever I am in need. I aspire to contribute by enriching our community, as we consistently work to strengthen our connections.

After a detailed assessment of this code, I can affirm that it is an exemplary GUI-focused solution. It requires only the entry of the specified ruler length through the GUI and the binding key to be established just one time

 

/***************************************************************
 * YOGI_PRULER
 * 1. Load code in CIW followed by the procdeure name yogi_pruler_dim() 
 * 2. Dimension GUI appears
 * 3. Enter exact dimension in um
 * 4  Click exact first point  (Start Point)

 * 5  Click anywhere for the second point in the direction you want to create the ruler ( X-Dir or Y-Dir)

 * 6. Exact measurement is created
 ***************************************************************/
;; =============================================================================
;; MAIN ACTION CALLBACK: This handles drawing the ruler based on the form's value
;; =============================================================================
procedure(yogi_pruler_action_cb(form)
    let((win cv dim p1 p2)
        ;; Get the current active window and its layout cellview content
        win = hiGetCurrentWindow()
        cv  = geGetWindowCellView(win)
       
        ;; Extract the target numeric dimension value directly from the user form
        dim = form->dimField->value
       
        ;; STEP 1: Ask the user to click the initial starting point of the ruler
        p1 = enterPoint(?prompts list("Click the starting point for your ruler"))
       
        when(p1
            ;; Convert the raw screen cursor coordinates to actual layout canvas coordinates
            p1 = geWindowToEditPoint(win p1)
           
            ;; STEP 2: Ask the user to click a second point to determine the drawing direction
            p2 = enterPoint(?prompts list("Click any point to indicate drawing direction"))
           
            when(p2
                ;; Convert the second screen coordinates to layout canvas coordinates
                p2 = geWindowToEditPoint(win p2)
               
                ;; STEP 3: Identify whether the user moved more Horizontally or Vertically
                if( abs(car(p2) - car(p1)) >= abs(cadr(p2) - cadr(p1)) then
                   
                    ;; --- HORIZONTAL ROUTE ---
                    ;; If second click is to the right, project rightward. Otherwise, project leftward.
                    if(car(p2) >= car(p1) then
                        p2 = list(car(p1) + dim cadr(p1))
                    else
                        p2 = list(car(p1) - dim cadr(p1))
                    )
                else
                    ;; --- VERTICAL ROUTE ---
                    ;; If second click is higher, project upward. Otherwise, project downward.
                    if(cadr(p2) >= cadr(p1) then
                        p2 = list(car(p1) cadr(p1) + dim)
                    else
                        p2 = list(car(p1) cadr(p1) - dim)
                    )
                )
               
                ;; STEP 4: Draw the fixed-dimension measurement ruler on the active layout canvas
                leCreateMeasurement(cv list(p1 p2))
            )
        )
    )
)

;; =============================================================================
;; MAIN EXECUTION FORM: Creates the user interface dialog box and displays it
;; =============================================================================
procedure(yogi_pruler_dim()
    let((dimField)
        ;; Create a clean text box field specifically meant for decimal/float entries
        dimField = hiCreateFloatField(
            ?name 'dimField
            ?prompt "Ruler Dimension:"
            ?value 1.0
        )
       
        ;; Construct the overall graphical user interface window wrapper
        hiCreateAppForm(
            ?name 'yogiPrulerForm
            ?formTitle "Yogi Precision Ruler"
            ;; Places the input box at dynamic positioning layout coordinates
            ?fields list(list(dimField 0:10 300:30 110))
            ;; Automatically triggers our simplified callback function when user clicks OK/Apply
            ?callback "yogi_pruler_action_cb(hiGetCurrentForm())"
            ?buttonLayout 'OKCancelApply
        )
       
        ;; Pop the completed dialog interface onto the user's workspace screen
        hiDisplayForm(yogiPrulerForm)
    )
)

I will wait for your response ,Once again thanks for warm gesture

Have a pleasant day!

Cheers & regards,

Yogesh Jaiswal 

  • Sign in to reply
  • Cancel

Top Replies

  • Andrew Beckett
    Andrew Beckett 3 days ago +1
    yogeshjaiswalCAD said: I will wait for your response , Once again thanks for warm gesture There wasn't a question in your post, so I'm not sure what response you want? I would say that you can pretty…
  • yogeshjaiswalCAD
    yogeshjaiswalCAD 3 days ago in reply to Andrew Beckett +1
    Greetings Andrew, It means a lot when you take time from your busy schedule to reply :) The code is functioning as expected, thank you for reviewing it. I will take note of your suggestions to become…
Parents
  • Andrew Beckett
    Andrew Beckett 3 days ago
    yogeshjaiswalCAD said:
    I will wait for your response ,Once again thanks for warm gesture

    There wasn't a question in your post, so I'm not sure what response you want?

    I would say that you can pretty much do this with built-in functionality. Simply start creating a ruler (Tools->Create Measurement, usually the "k" bind key), click on the first point (if you don't have infix enabled) and then press shift-N (that's the usual bind key). This pops up a form:

    If you check the "Use Relative XY" you can then enter 2 0 or 0 2 (or whichever direction you want it to go in) as the relative offset of the second point. Hit OK and then the ruler will be drawn.

    The shfit-N functionality can be used to enter points via a coordinate for anything where you are prompted to enter a point.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • yogeshjaiswalCAD
    yogeshjaiswalCAD 3 days ago in reply to Andrew Beckett

    Greetings Andrew,

    It means a lot when you take time from your busy schedule to reply :) 

    The code is functioning as expected, thank you for reviewing it. I will take note of your suggestions to become more efficient with keyword usage... Have a pleasant day!

    Cheers & regards,

    Yogesh Jaiswal 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • yogeshjaiswalCAD
    yogeshjaiswalCAD 3 days ago in reply to Andrew Beckett

    Greetings Andrew,

    It means a lot when you take time from your busy schedule to reply :) 

    The code is functioning as expected, thank you for reviewing it. I will take note of your suggestions to become more efficient with keyword usage... Have a pleasant day!

    Cheers & regards,

    Yogesh Jaiswal 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • 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.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information