enterPoint() wait?

Discussion in 'Cadence' started by Erik Wanta, Sep 15, 2003.

  1. Erik Wanta

    Erik Wanta Guest

    I am trying to write a simple function to allow the user to add a
    probe to a net of type "flight".

    ;deselect all objects
    geDeselectAll()

    ;have user select a net
    geAddSelectPoint(hiGetCurrentWindow() nil enterPoint())

    ;add probe to net of type "flight"
    geMakeProbeWithColor(?window hiGetCurrentWindow() ?object
    car(geGetSelSet()) ?color list("y0" "drawing") ?probeType "net"
    ?displayStyle "flight")

    How do I get the program to wait until after the user selects a point
    and then hits escape? That is, I don't want to add the probe until
    after the enterPoint() function is complete.
     
    Erik Wanta, Sep 15, 2003
    #1
  2. Erik Wanta

    Partha Guest

    Erik,
    One way you could do this, is to let enter point make aanother
    function call, something like this,
    procedure(XXX()
    enterPoints(
    ?prompts list("Enter points ")
    ?doneProc "XXA"
    )
    )

    -- and then declare the function
    procedure( XXA(window done points "wgl")
    ( blah bla blah))

    The arguments to procedure XXA are pased by the system, and that
    function is called only when the user has finished entering the
    points...

    Partha
     
    Partha, Sep 15, 2003
    #2
  3. Erik Wanta

    Erik Wanta Guest

    OK, I am calling a function called ap after the point is selected. I
    then try to add a probe to what I just selected, however geGetSelSet
    fails for some reason.

    I get:
    \i fp()
    \p >
    \a mouseAddPt()
    \i 0:-0.375
    \w *WARNING* no object specified
    \w *WARNING* Object not a dbId nor an object list
    \w *WARNING* Can not make a probe record
    \r t

    If I do a geGetSelSet() after, I get:
    (db:223997696)

    Why doesn't the geGetSelSet() work in the ap function? This is
    driving me nuts!

    printf("fp()\n")

    procedure(fp()
    prog(()

    geDeselectAll()
    geAddSelectPoint(hiGetCurrentWindow() nil enterPoint(?prompts
    list("select net") ?addPointProc "ap"))

    return(t)

    ) ; prog
    ) ; procedure



    procedure(ap(w pts)
    prog(()

    geMakeProbeWithColor(?object car(geGetSelSet(w)) ?window
    hiGetCurrentWindow() ?color list("y0" "drawing") ?probeType "net"
    ?displayStyle "flight")
    return(t)

    )
    ) ; procedure
     
    Erik Wanta, Sep 16, 2003
    #3
  4. Erik,

    You are mixing using the return value of enterPoint and using callbacks to do
    things. You should do _everything_ using the callback idiom, ideally.

    Now (without actually trying this), I'm sure what is happening is that ap is
    being called when you add the point, and then enterPoint() returns. So the
    selection is going on _after_ you try to get the selection inside the callback.

    Why not select it in the ap() function too? You have the point entered
    as an argument to the ap() function, so use it there.

    Probably I'd use ?doneProc anyway in this case, but I don't suppose it
    makes much difference wth enterPoint since you're only entering a
    single point.

    Andrew.
     
    Andrew Beckett, Sep 16, 2003
    #4
  5. Erik Wanta

    Erik Wanta Guest

    Andrew:
    Yeah, chicken before the egg. The modified version is below. Does
    anyone know of a public function to use other than _geGetProbeLPP(t)
    to cycle through the y layers?

    printf("afp()\n")

    procedure(afp()
    prog(()

    geDeselectAll()

    enterPoint(?prompts list("select net") ?addPointProc "afpCB")

    return(t)

    ) ; prog
    ) ; procedure

    procedure(afpCB(w pts)
    prog((obj)

    ;select the point
    geAddSelectPoint(w nil car(pts))

    ;get the selected object
    obj=car(geGetSelSet(w))

    ;when the selected object is a net, add a flight probe
    when(obj~>objType == "line"

    ;add a flight probe
    geMakeProbeWithColor(?object obj ?window hiGetCurrentWindow()
    ?color
    _geGetProbeLPP(t) ?probeType "net" ?displayStyle "flight")

    ) ; when

    return(t)

    ) ; prog
    ) ; procedure
     
    Erik Wanta, Sep 17, 2003
    #5
  6. Erik,

    Not really very hard to write something, so I threw this together:

    ;------------------------------------------------------------------------
    ; This is SKILL++ code - it relies on lexical scoping to
    ; avoid global variables, so it needs a filename extension of .ils
    ;------------------------------------------------------------------------
    (let ((colourNumber -1))
    (setq ABgetProbeLPP
    (lambda (@optional (incr t))
    (or (geGetProbeUserLPP)
    (list
    (sprintf nil "y%d"
    (if incr
    (setq colourNumber
    (mod (add1 colourNumber) 10))
    (if (minusp colourNumber) 0 colourNumber)))
    "drawing"))
    ))
    )

    Which behaves in the same way, and doesn't use any global variables (and
    also supports use of geSetProbeUserLPP() to override the colour). In fact
    mine fixes a feature of _geAddProbeLPP where if you call it with nil
    as the argument, the first time, it returned "y-10" - mine returns "y0".

    Andrew.
     
    Andrew Beckett, Sep 18, 2003
    #6
  7. Erik Wanta

    Erik Wanta Guest

    Andrew:
    Cool, I was unaware of the lexical scoping in SKILL++. I will read up.
     
    Erik Wanta, Sep 18, 2003
    #7
  8. Erik Wanta

    John Gianni Guest

    Which behaves in the same way, and doesn't use any global variables (and
    1. Andrew probably meant _geGetProbeLPP (not _geAddProbeLPP as there is no
    SKILL function from Cadence of that second name).

    2. Since the undocumented unsupported private function _geGetProbeLPP is
    now known to the USENET world, just in case someone decides to use it,
    I filed a PCR 647551 on behalf of Erik Wanta asking Cadence R&D if they
    have a known existing public replacement handy.

    Meanwhile, I also appended Andrew's suggested workaround and mailed Erik
    to ask if he wanted to add any particulars.

    Since it's a private function, the reputed bug Andrew found may not be
    fixed; but, I requested that fix in addition to the public functionality.

    3. In this manner, the Cadence SKILL Private Function Resolution Process
    is being followed. This process basically has successfully replaced
    private functions with public documented supported functionality
    in more than 5,000 Customer migrations (at this time, I know of only 12
    functions NOT successfully replaced with public functionality, i.e.,
    the re-entrant layerXXX functions).

    This is a wonderful win:win situation:
    - Customer uses 100% documented supported known functions;
    - Cadence supports only that public subset;

    - If Customer has a need to use a private function ...
    - A process is followed to ensure that private function use is
    replaced by public functionality.

    - Subsequent release-to-release migrations go much smoother
    (the process is working!)
    - And Cadence R&D & Marketing are aware of all the functions
    Customers care about most.
    (auto registration)

    By the way, if you are NOT registering your functions with Cadence,
    you're crazy ... as Cadence makes decisions about SKILL functions every
    day ... and those not registered don't get their list of functions to be
    considered ... (registration is automatic with any SKILL Survey) ...
     
    John Gianni, Sep 19, 2003
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.