Home > Community > Forums > Custom IC SKILL > How to undo ruler?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 How to undo ruler? 

Last post Fri, Jun 5 2009 1:56 PM by ahamlett. 15 replies.
Started by kbhow 20 May 2009 05:59 PM. Topic has 15 replies and 7236 views
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts:
  • Wed, May 20 2009 5:59 PM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    How to undo ruler? Reply

    Hi,

     I have searching many method to undo ruler by using skill but failed.

    Its there any method /skill code that manage to draw and undo the ruler one by one.

    • Post Points: 20
  • Tue, May 26 2009 2:31 AM

    Re: How to undo ruler? Reply

    All there currently is is leClearAllRuler(). You can't do them one by one.

    There are however enhancements coming with rulers in IC614. I think a side effect of that will allow you to create and then delete rulers individually.

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, May 26 2009 2:38 AM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: How to undo ruler? Reply

    Hi Andrew,

     Thanks for the reply.

    That means we can't undo/delete the ruler individually, so sad to know that. :(

    Hopefully i can get IC614 soon.

     

    Regards,

    How

    • Post Points: 20
  • Tue, May 26 2009 7:06 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: How to undo ruler? Reply

    You can get creative and make your own ruler function that stores off your ruler points in a global variable. Then you can undo the rulers by clearing them all and recreating all rulers except the last one.

    procedure(myRuler(@optional (cv geGetEditCellView()))
        unless(boundp('rulerHistory)
            rulerHistory = makeTable("rulerHistory" nil)
        )
        pts = enterLine(?prompts list("Point to first point of the ruler" "Point at the next point of the ruler") ?wantPoints 2)
        leCreateRuler(geGetEditCellView() pts)
        rulerHistory[cv] = cons(pts rulerHistory[cv])
    ) ;proc

    procedure(clearMyLastRuler(@optional (clearAll nil) (cv geGetEditCellView()) )
        leHiClearRuler()
        if(clearAll then
            rulerHistory[cv] = nil
        else
            rulerHistory[cv] = cdr(rulerHistory[cv])
            foreach(pts rulerHistory[cv]
                leCreateRuler(cv pts)
            )
        )
    ) ;proc

    Derek

    • Post Points: 20
  • Tue, May 26 2009 7:14 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,581
    • Points 15,825
    Re: How to undo ruler? Reply

    Thank you for sharing your code Derek!

    While we are on the topic of Rulers, I recently also wrote a somewhat similar solution for getting the length of each ruler printed to the CIW for added help/readability. Here's the link to the Online Support Solution:

    SourceLink Solution 11553680

    Best regards,

    Lawrence.

    Filed under: ,
    • Post Points: 20
  • Tue, May 26 2009 4:45 PM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: How to undo ruler? Reply

    Hi dMay,

    Your script works well :D. Just i need to make it interactive so that user not need to recall the function for ruler and able to use reursively until the ESC button is hit.

     

    Hi skilluser,

    Thanks a lot for the sharing =D

    • Post Points: 20
  • Tue, May 26 2009 4:53 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,581
    • Points 15,825
    Re: How to undo ruler? Reply

    Hi How,

    You should be able to use the solution I wrote to help you to make Derek's code more interactive (e.g. create a bindkey for it, use an Options form to control the function behaviour).

    Let me (well, everyone) know if you need more help.

    regards,

    Lawrence.

    • Post Points: 20
  • Tue, May 26 2009 5:29 PM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: How to undo ruler? Reply

    Hi guys,

    Cool. I got it, i got it. I combine both script into one and its able to works interactively and able to undo the ruler as well. =D

    This is what i'm looking for for quite a long time. Thanks man. Cheers

    Regards, How

    • Post Points: 5
  • Tue, May 26 2009 6:17 PM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: How to undo ruler? Reply

    Hi,

    By storing the ruler's pts into a global table will enable user to do undo ruler individually. What if user use hiClearAllRuler() function to clear all rulers, the data that store in the table will not change rite?

    So, when user undo the ruler, there will prompts many other rulers which is initially store in the table. Any workaround for this?

     

    How

    • Post Points: 20
  • Tue, May 26 2009 8:32 PM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: How to undo ruler? Reply

    Hi skilluser,

    For your script, is it I need to instantiate the form at least ONCE before I use the function to create ruler?

    The function seem like not working, but after i hit F3 button to call the form and hide it, it will only able to peform well. Please advice.

    Thanks 

    • Post Points: 5
  • Wed, May 27 2009 9:38 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: How to undo ruler? Reply

    Notice in the clearMyLastRuler command, I had put in an optional "clearAll" argument. If set to t, not only does it clear all rulers in the window, but it also resets the global variable. Your users should use this command to clear all the rulers.

    procedure(clearMyLastRuler(@optional (clearAll nil) (cv geGetEditCellView()) )
        leHiClearRuler()
        if(clearAll then
            rulerHistory[cv] = nil


    Derek

    • Post Points: 20
  • Wed, Jun 3 2009 10:57 PM

    • ccKev
    • Not Ranked
    • Joined on Tue, Apr 21 2009
    • Posts 2
    • Points 25
    Re: How to undo ruler? Reply

    hi guys,

     im able to draw the ruler and clear the last ruler base on the script from dmay. user can draw the ruler and clear the ruler by a bindkey, without calling the function again. the problem is, because of the enter function, it would not be able to show the length of ruler during drawing. it only shows the length when user has finished entering points.

    any idea on how to show the length while drawing by enter function?

    thanks!

    kevin

    • Post Points: 20
  • Thu, Jun 4 2009 6:46 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: How to undo ruler? Reply

    I don't know of a way to do this. The only dynamic ruler I know of is leHiCreateRuler. This is an enterFunction provided by Cadence that doesn't allow you to undo previous rulers. Thus I provided the above enterFunction to overcome the undo limitation but this loses the dynamic ruler capability. I don't know of any way to get two enterFunctions to run at the same time. So you can either run one or the other, but not both.

    This request falls into the Cadence R&D court as an enhancement.

    Derek

    • Post Points: 20
  • Thu, Jun 4 2009 6:54 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,581
    • Points 15,825
    Re: How to undo ruler? Reply

     Hi Derek, Kevin and How,

    In the soon-to-be-arriving IC614 release there are many enhancements to the ruler capabilities, such as the ability to draw and then remove specific rulers.  Since this is an in-built capability, it will behave similarly to the existing ruler in the way that you can see the ruler and tick marks and sizes while it is being drawn (which you don't see if you are using the enterLine enter function).  The ruler function will also have built in "smarts" so that itcan guess if you are measuring from edge to edge, corner to corner etc. based on ruler direction and initial points.  It will use, I believe, the gravity aperture as the search window for the point and can be made to "snap" to point types (e.g. center, edge, vertex).

    Hopefully the new capabilities will address many, if not all, of the concerns that layout designers have about rulers.

    Regards,

    Lawrence.

    Filed under:
    • Post Points: 20
  • Fri, Jun 5 2009 7:36 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: How to undo ruler? Reply

    You can easily setup ruler snapping in 5.1.41. We have done with the code below. The bindkeys I defined allow you to start and stop the ruler with the middle mouse button and it will snap to edges within the aperture defined on the Layout Editor Options form.

    procedure(mySnappingRuler()
      let((gravity infix depth type bouncex bouncey rptVar)
        if(hiGetCurrentCmd(hiGetCurrentWindow()) == "Ruler" then
            mouseAddPt()
        else
            infix   = hiGetCIWindow()->infix
            gravity = envGetVal("layout" "gravityOn")
            depth   = envGetVal("layout" "gravityDepth")
            type    = envGetVal("layout" "gravityType")
            bouncex = envGetVal("layout" "gravityBounceX")
            bouncey = envGetVal("layout" "gravityBounceY")
            envSetVal("layout" "gravityOn"      'boolean t)
            envSetVal("layout" "gravityDepth"   'int     20)
            envSetVal("layout" "gravityType"    'string  "edge")
            envSetVal("layout" "gravityBounceX" 'float   0)
            envSetVal("layout" "gravityBounceY" 'float   0)
            hiGetCIWindow()->infix = t
            rptVar=envGetVal("layout" "modalCommands")
            envSetVal("layout" "modalCommands" 'boolean nil)
            leHiCreateRuler()
            envSetVal("layout" "modalCommands" 'boolean rptVar)
            envSetVal("layout" "gravityOn"      'boolean gravity)
            envSetVal("layout" "gravityDepth"   'int     depth)
            envSetVal("layout" "gravityType"    'string  type)
            envSetVal("layout" "gravityBounceX" 'float   bouncex)
            envSetVal("layout" "gravityBounceY" 'float   bouncey)
            hiGetCIWindow()->infix = infix
        )
      ) ;let
    ) ;proc

    hiSetBindKey("Layout" "<Btn2Down>" "mySnappingRuler()")
    hiSetBindKey("Layout" "<Btn2Down> EF" "mySnappingRuler()")

    You can define the aperture per user using:
    envSetVal("layout" "gravityAperture" 'float 0.5)

    Derek

    • Post Points: 20
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts:
Started by kbhow at 20 May 2009 05:59 PM. Topic has 15 replies.