Home > Community > Forums > Custom IC SKILL > help - skill code for goto xy coordinate

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: *

 help - skill code for goto xy coordinate 

Last post Thu, Dec 31 2009 3:37 AM by Satya. 13 replies.
Started by zeroskills 14 Oct 2009 02:40 PM. Topic has 13 replies and 7617 views
Page 1 of 1 (14 items)
Sort Posts:
  • Wed, Oct 14 2009 2:40 PM

    help - skill code for goto xy coordinate Reply

    i would like some help on skill code for goto xy coordinate. we used to have this skill code, it does this...

    pop up goto xy form, just input x and y coordinate then view size, like how zoom in or out you want it. then there will be an "X" ruler mark on the coordinate.

     

    • Post Points: 20
  • Wed, Oct 14 2009 11:33 PM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: help - skill code for goto xy coordinate Reply

     Hi,

    I wrote a simple code for you. This will prompt user a form to key in x and y coordinate.User can input scale as well.For eg: 1.5 2.6 2 (1.5 is x coord; 2.6 is y coord; and 2 is the scale) , or they can just input x and y coordinate only, for eg: 2.5 9.0 

    In the other hand, it will use ruler to create a marker at the coordinate.

     

    procedure( ZoomToPoint( x y @key

                                               (scale 1)

                                               (winId hiGetCurrentWindow())

                                               (cvId geGetEditCellView()))

        let(( (dx 2) (dy 2))

     

           ;----------------------------

           ; Zoom to point with scale

            ;----------------------------

            hiZoomWindowAtPoint(winId scale x:y)

            printf("\nCmd: Zooming to Point %L %L with scale %L\n" x y scale)

     

            ;-------------------------------

            ; Create cross mark using ruler

            ;-------------------------------

            leCreateRuler( cvId list(x:y x+dx:y+dy))

            leCreateRuler( cvId list(x:y x+dx:y-dy))

            leCreateRuler( cvId list(x:y x-dx:y+dy))

            leCreateRuler( cvId list(x:y x-dx:y-dy))

     

        );let

    );proc

     

    procedure( zoomGUI()

        let(()

     

            ;----------------

            ; Create form

            ;----------------

             hiCreateAppForm(

                    ?name 'zoomGui

                    ?formTitle "Zoom and Mark"

                    ?callback "zoomGuiCB(zoomGui->column->value)"

                    ?fields list(

                              list( hiCreateStringField(

                                          ?name 'column

                                          ?prompt "Go to:"

                                           ) 5:5 200:25 50)

     

                               );

                     ?buttonLayout 'OKCancel

                     ?help ""

                   );

     

              hiDisplayForm(zoomGui)

        );let

    );proc

    procedure( zoomGuiCB(input)

        let((dX dY (zscale 1))

     

            value = parseString(input " ")

            ;-----------------------

            ; Process form' value

            ;-----------------------

            if( length(value) == 2 then

                  dX = atof(car(value))

                  dY = atof(cadr(value))

           else

                  if( length(value) == 3 then

                        dX = atof(car(value))

                        dY = atof(cadr(value))

                        zscale = atof(caddr(value))

                 else

                        warn("Zoom to Pt => Invalid input! Input must be x y scale")

                  );if

             );if

             ;--------------------------

             ; Calling function to zoom

             ;--------------------------

             ZoomToPoint(dX dY ?scale zscale)

        );let

    );proc

     

     

     

     

     

    How

    • Post Points: 35
  • Thu, Oct 15 2009 1:19 AM

    Re: help - skill code for goto xy coordinate Reply

    You could also use leSetRefPoint() to set the reference point (and if you have set on Options->Display that the reference point is visible, you'll get a little cross shown at the point).

    BTW, one thing that many users are unaware of is that if you were to just use the standard "Pan" command (from the menu, say), you can type in the coordinates in the CIW:

    100:240

    (for example) and it will pan to that location. Any "enter function" - i.e. when you're prompted for points - can have the points typed in the CIW.

    Regards,

    Andrew.

    • Post Points: 5
  • Fri, Oct 16 2009 5:58 AM

    Re: help - skill code for goto xy coordinate Reply

    Thanks for the code.

    I copied and saved your code to "gotoxy.il", but how to attach it with a bindkey?

     

    • Post Points: 20
  • Fri, Oct 16 2009 6:08 AM

    Re: help - skill code for goto xy coordinate Reply

    hiSetBindKey("Layout" "Ctrl<Key>p" "zoomGUI()")

    Or whatever key you want. Looking at the code, zoomGUI() is the main entry point. You'll need to have loaded the code (from your .cdsinit, say).

    Regards,

    Andrew.

    • Post Points: 20
  • Mon, Oct 19 2009 9:09 AM

    Re: help - skill code for goto xy coordinate Reply

    Thanks kbhow and andrew. It's working now.

    One more request, could it have an input box for x coordiante, input box for x coordiante,  and input box for scale/zoom size?

    Thanks.

    • Post Points: 20
  • Mon, Oct 19 2009 10:13 AM

    • Riad KACED
    • Not Ranked
    • Joined on Thu, Jul 17 2008
    • Hillsboro, OR
    • Posts 14
    • Points 385
    Re: help - skill code for goto xy coordinate Reply

    Hi Guys,

    I'm jumping a bit late into the subject but wanted to share some code I have written based on what discussed here.

    The above code has the added value of self-calculating the 'right' zoom ratio before applying the pan function. This code calcules a zoom that would magnify the design into a window size les than 1um^2, assuming the initial design is more than 1um*1um.One can make this code zooming even more if needed, just by adding a multiplier as explained within the code.


    ;---------------------------------------------------------------------------
    ; procedure : RKzoomToPointFormCB
    ;---------------------------------------------------------------------------
    procedure( RKzoomToPointFormCB(form)
      let((point xCoordinate yCoordinate)
        xCoordinate=car(parseString(form->xyCoordinates->value ","))
        yCoordinate=cadr(parseString(form->xyCoordinates->value ","))
        point=list(cdfParseFloatString(xCoordinate) cdfParseFloatString(yCoordinate))
        printf("The Selected Point is: %L\n" point)
        RKzoomToPointCB(point)
      )
    )
    ;---------------------------------------------------------------------------
    ; procedure : RKzoomToPointCB.
    ; This is actually the main function, it does dynamically calculate the
    ; zoom ratio and then pan. It also put the ref point that is displayed
    ; if users setup their environment to do so.
    ;---------------------------------------------------------------------------
    procedure( RKzoomToPointCB(point)
      let((windowId viewBBox zoomVal)
        windowId=hiGetCurrentWindow()
        hiZoomAbsoluteScale(windowId 1)
        viewBBox=hiGetViewBBox(windowId)
        zoomVal=max(abs(yCoord(upperRight(viewBBox))-yCoord(lowerLeft(viewBBox)))
                    abs(xCoord(upperRight(viewBBox))-xCoord(lowerLeft(viewBBox))))
        ; One can make the zoom even higher, just by seeting
        ; something like
        ; zoomVal=10*zoomVal for example
        hiPan( hiGetCurrentWindow() point)
        hiZoomRelativeScale(windowId  zoomVal)
        ;unless(leEditorOptionsForm->options->displayRefPoint->value
        ;  leEditorOptionsForm->options->displayRefPoint->value=t
        ;)
        leSetRefPoint(windowId~>cellView point)
      )
    )
    ;---------------------------------------------------------------------------
    ; procedure : RKzoomToPoint, main entry.
    ;---------------------------------------------------------------------------
    procedure(RKzoomToPoint()
      unless(boundp('RKzoomToPointForm)
        RKzoomToPointCreateForm()
      )
      hiDisplayForm(RKzoomToPointForm)
    )
    ;---------------------------------------------------------------------------
    ; procedure : RKzoomToPointCreateForm
    ;---------------------------------------------------------------------------
    procedure(RKzoomToPointCreateForm()
      let((xyCoordinates zoomLabel zoomButton)
       
        zoomLabel=hiCreateLabel(
          ?name 'zoomLabel
          ?labelText "enter ',' separated points: ex 0.0,0.0"
          ?justification `center
        )
      
        xyCoordinates=hiCreateStringField(
          ?name 'xyCoordinates
          ?prompt "X,Y Coordinates"
          ?value "0.0,0.0"
        )           
        zoomButton=hiCreateButton(
          ?name 'zoomButton
          ?buttonText "Zoom & Pan"
          ?callback strcat("(RKzoomToPointFormCB " 'RKzoomToPointForm " )")
        )
                   
       RKzoomToPointForm=hiCreateAppForm(
          ?name 'RKzoomToPointForm
          ?formTitle "RK Zoom To Point"
          ?callback strcat("(RKzoomToPointFormCB " 'RKzoomToPointForm " )")
          ?buttonLayout '(OKCancelDef)
          ?fields list(
            list(zoomLabel 5:5 250:30 100 )
            list(xyCoordinates 5:40 250:30 100 )
        list(zoomButton  30:75 200:30  )
          )
        )
      )
    )
    ;---------------------------------------------------------------------------
    ; Bindkey definition
    ;---------------------------------------------------------------------------
    hiSetBindKey("Layout" "Alt<Key>z" "RKzoomToPoint()")

     

     

    Cheers,

    Riad. 

    • Post Points: 20
  • Tue, Oct 20 2009 7:42 AM

    Re: help - skill code for goto xy coordinate Reply

    Thanks Riad for another code. but yours does not have the "X" mark ruler and it's too zoomed in.

    and could there  be a seperate input box for x and y coordinates?

    • Post Points: 35
  • Tue, Oct 20 2009 7:49 AM

    Re: help - skill code for goto xy coordinate Reply
    Of course. From all this example code, it really should not be too hard for you to adapt it yourself to your own needs.

    You have some pretty good framework code here, which would only need small changes.

    I too have an example for doing this. But decided there were enough similar examples already. Can't remember whether mine has separate X and Y boxes, but anyway it doesn't draw rulers at the "buried treasure point" ;-) (I'm travelling so can't check easily)

    Regards,

    Andrew
    • Post Points: 5
  • Tue, Oct 20 2009 8:28 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: help - skill code for goto xy coordinate Reply

    This is a forum for ideas and answers, not a development team for your CAD needs. As Andrew said, you should be able to get it working from the examples you have received so far.

    As for my two cents, I don't like having a separate field for X and Y. Most of the time, our users are cutting and pasting X and Y coordinates from a file. Our solution was to make the XY field on the form a string field. We pre-process the string and convert it into X and Y coordinates. In doing this, the pre-process code removes colons, quotes, commas, etc so the user can paste coordinate info in any format that he has and not have to separately cut and paste the X and the Y.

    The following procedure takes the string entered on the form (coord) and returns a point:

    procedure(coordCleanup( coord)
      rexCompile( "[(){}xy=,XY:]")
      coord = rexReplace( coord " " 0)
      ;Occasionally an extra decimal: (920.000000. -223.500000)
      rexCompile( "\\. ")
      coord = rexReplace( coord " " 0)
      coord = parseString(coord)
      mapcar( 'aelNumber coord)
    ) ;proc

    Now, the user can paste this in the box:
    x=10,y=20

    And this routine will return: list(10 20)

    Derek

    • Post Points: 20
  • Tue, Oct 20 2009 8:59 AM

    • Riad KACED
    • Not Ranked
    • Joined on Thu, Jul 17 2008
    • Hillsboro, OR
    • Posts 14
    • Points 385
    Re: help - skill code for goto xy coordinate Reply
    Hi,

    >> Thanks Riad for another code. but yours does not have the "X" mark ruler

    If you were really listening to what other people said, then you would have realised that my routine has the ‘X’ as well.

    As per Andrew’s recommendation, I have added into the code the following:

    leSetRefPoint(windowId~>cellView point)

    But since we all have different tastes, I did not want to force the environment to display the reference point.

    Instead, you end user can go to the VLE->Options->Layout Editor->Display Ref Point

    Well, If you have carefully read through the code, you would have realized I have put the following in comment:

        ;unless(leEditorOptionsForm->options->displayRefPoint->value
        ;  leEditorOptionsForm->options->displayRefPoint->value=t
        ;)
    So to answer your question: the X is created, it’s down to you to display it !

    Marking with rules is just fiddling around, I don’t like fiddling.

    >> and it's too zoomed in.

    Again, it would have been better if you read my comments.

    My routine has got a dynamic zooming scale. Say you are working on a block level design whose size is 100u*100u. Say a zoom by 100 would be alright for you. But if you move to a chip level layout then a zoom by 100 might be not enough. My routine does all dynamically to fall into a window which is less than 1um square. I have setup this given the technology node I’m working with. This might be too much for some people and may be not enough for others. That’s why I have said in my commented code how to make flexible. Basically by adding a multiplier. You can make it >1 or <1, depends on you wanting more zoom out/in. Again, please read the comments.

    >> and could there  be a seperate input box for x and y coordinates?

    I do not like the separated coordinates, simply because you loose productivity. Again, when you get an error from Assura/Calibre (I think I have written this for Calibre corrdinates) saying something occurred at that point, then it easier for people just make a cp/paste as Derek advised.

    At the end, I do concur with Andrew’s and Derek’s; you better take this as an idea to start with rather than a tailored suit ready to wear!

    Scripting is all about practice and you need to put your hands on mate!

     
    Cheers,

    Riad.
    • Post Points: 20
  • Wed, Oct 21 2009 6:40 AM

    Re: help - skill code for goto xy coordinate Reply

    To How, Andrew, Derek and Rian - thanks for the help, i really appreciate it. so far, you've helped me with my request to be more productive at work.

    Riad-Initially copying your code to gotoxy.il, it is zoomed and does not have the "X" mark. i will test and look again and follow your comments.

    We don't have an in-house CAD support, we have to call/email CAD support to help us for things like this. With your help on my request, it have been very helpful and make me more productive at work. Thanks again.

    • Post Points: 20
  • Thu, Oct 22 2009 6:14 PM

    • kbhow
    • Top 75 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: help - skill code for goto xy coordinate Reply

    By the way, you can simply add a few lines in Riad's code to create the "X" mark using leCreateRuler

     How

    • Post Points: 20
  • Thu, Dec 31 2009 3:37 AM

    • Satya
    • Top 500 Contributor
    • Joined on Sun, Jul 20 2008
    • Bangalore, Karnataka
    • Posts 17
    • Points 295
    RE-help - skill code for goto xy coordinate Reply

    Hi All!! I have modifide kbhow code to zoom and create x marker..please check it out!!

     

    procedure( ZoomToPoint( x y @key
     (scale 1)
     (winId hiGetCurrentWindow())
     (cvId geGetEditCellView()))

    let(( (dx 1) (dy 1) qcBbox)
    ;----------------------------
    ; Zoom to point with scale
    ;----------------------------
    hiZoomWindowAtPoint(winId scale x:y)
    printf("\nCmd: Zooming to Point %L %L with scale %L\n" x y scale)
    ;-------------------------------
    ; Create cross mark using ruler
    ;-------------------------------
    qcBbox = list( list( (x - dy) (y - dy)) list( (x + dx) (y + dx)))
    leCreateRuler( cvId list(x:y x+dx:y+dy))
    leCreateRuler( cvId list(x:y x+dx:y-dy))
    leCreateRuler( cvId list(x:y x-dx:y+dy))
    leCreateRuler( cvId list(x:y x-dx:y-dy))
    hiZoomIn(winId qcBbox)
      );let
     );proc
    procedure( zoomGUI()
     let(()
     ;----------------
     ; Create form
     ;----------------
    hiCreateAppForm(
    ?name 'zoomGui
    ?formTitle "Zoom and Mark"
    ?callback "zoomGuiCB(zoomGui->column->value)"
    ?fields list(
     list( hiCreateStringField(
     ?name 'column
     ?prompt "Go to:"
     ) 5:5 200:25 50)
     );
     ?buttonLayout 'OKCancel
     ?help ""
      );
    hiDisplayForm(zoomGui)
     );let
     );proc
    procedure( zoomGuiCB(input)
     let((dX dY (zscale 1))
     value = parseString(input " ")
     ;-----------------------
     ; Process form' value
     ;-----------------------
     if( length(value) == 2 then
     dX = atof(car(value))
     dY = atof(cadr(value))
     else
     if( length(value) == 3 then
    dX = atof(car(value))
    dY = atof(cadr(value))
    zscale = atof(caddr(value))
     else
    warn("Zoom to Pt => Invalid input! Input must be x y scale")
     );if
     );if
     ;--------------------------
     ; Calling function to zoom
     ;--------------------------
    ZoomToPoint(dX dY ?scale zscale)
    );let
    );proc
    hiSetBindKey("Layout" "Ctrl<Key>p" "zoomGUI()")

     

    Satya..

    • Post Points: 5
Page 1 of 1 (14 items)
Sort Posts:
Started by zeroskills at 14 Oct 2009 02:40 PM. Topic has 13 replies.