*error* function

Discussion in 'AutoCAD' started by Marie Desaulniers, Sep 29, 2004.

  1. I created a function that calls other functions. The other function names are stored in a variable and I call them using EVAL. When the process is cancelled during the execution of those functions, the *error* function doesn't work but it works fine if the function is cancelled before or after. Any idea ?
     
    Marie Desaulniers, Sep 29, 2004
    #1
  2. Marie Desaulniers

    SpeedCAD Guest

    Hi...

    And your code, Where is??. We need see it
     
    SpeedCAD, Sep 29, 2004
    #2
  3. The code is very longer than this but I think you could understand with that part. The problem occurs if I cancel the function during the INSERT command in the 4PTS-SQ function.

    (defun multiple-insert (sym-name function-name / )
    (setq multi-olderror *error*)
    (setq *error* multi-newerror)
    (setvar "cmdecho" 0)
    (setq attr (getvar "attreq"))
    (setvar "attreq" 0)
    (setq clay (getvar "CLAYER"))
    (setq osm (getvar "osmode"))
    (setq cle "symbole")
    (setq diapo sym-name)
    (setq fich_dia (load_dialog "multi-insert.dcl"))
    (setq what_next 3)
    (while (and (/= what_next 0) (>= what_next 2))
    (setq boite_dia (new_dialog "multi_insert" fich_dia))
    (start_image cle)
    (setq xt1 (dimx_tile cle)
    yt1 (dimy_tile cle)
    )
    (fill_image 0 0 xt1 yt1 253)
    (slide_image 0 0 xt1 yt1 diapo)
    (end_image)
    (action_tile
    "symbole"
    "(setq xc $x) (setq yc $y) (action_dialog xc yc)"
    )
    (action_tile "cancel" "(done_dialog 0)")
    (setq what_next (start_dialog))
    (cond ((= what_next 0)
    (exit)
    )
    )
    )
    (if (= what_next 1)
    (progn
    (eval (list (read function-name) sym-name))
    (setq bl (entlast))
    (fill-att bl)
    (command "purge" "b" purge-name "n")
    )
    )
    (setvar "CLAYER" clay)
    (setvar "cmdecho" 1)
    (setvar "osmode" osm)
    (setvar "attreq" attr)
    (setq *error* multi-olderror)
    (princ)
    )


    ; Here's one the possible function

    (defun 4PTS-REC (sym-name / )
    (cond ((and (>= xc 60) (< xc 120) (< yc 30))
    (command "insert" (strcat sym-name "-HM") pause 1 1 0)
    (setq bl (entlast))
    (rep-sym sym-name bl)
    )
    ((and (< xc 60) (>= yc 30) (< yc 70))
    (command "insert" (strcat sym-name "-MG") pause 1 1 0)
    (setq bl (entlast))
    (rep-sym sym-name bl)
    )
    ((and (>= xc 120) (>= yc 30) (< yc 70))
    (command "insert" (strcat sym-name "-MD") pause 1 1 0)
    (setq bl (entlast))
    (rep-sym sym-name bl)
    )
    ((and (>= xc 60) (< xc 120) (>= yc 70))
    (command "insert" (strcat sym-name "-BM") pause 1 1 0)
    (setq bl (entlast))
    (rep-sym sym-name bl)
    )
    )
    )

    ; Here is the *error* function

    (defun multi-newerror (msg)
    (setq *error* multi-olderror)
    (if osm (setvar "osmode" osm))
    (if attr (setvar "attreq" attr))
    (if clay (setvar "clayer" clay))
    (if attd (setvar "attdia" attd))
    (setvar "cmdecho" 1)
    )
     
    Marie Desaulniers, Sep 29, 2004
    #3
  4. Marie Desaulniers

    scaner Guest

    Hola SpeedCAD

    ¿Sabes que pasa con el foro?
    Hace varios días que no puedo entrar.

    Un saludo
    Scaner
     
    scaner, Sep 29, 2004
    #4
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.