Author Topic: Routine hangs just a bit with text selection ListTiledepedencyV1-1.lsp  (Read 140 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 265
Lee Mac helped me with this routine to insert blocks selected from a dual column dialog box. It's hanging ever so slightly after selecting the text to edit. Looking to see if anyone else is getting that same behavior.

I've provided a block "Approval-NA-SL" and the ListTileDependencyV1-1.lsp to go along with the quoted code in the post.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:StampIns ( / *error* osm dch dcl des str lst rtn ss hnd )
  2.  
  3.     (defun *error* ( msg )
  4.         (if (= 'file (type des))
  5.             (close des)
  6.         )
  7.  
  8.         (if (< 0 dch)
  9.             (unload_dialog dch)
  10.         )
  11.         (if (and (= 'str (type dcl)) (findfile dcl))
  12.             (vl-file-delete dcl)
  13.         )
  14.         (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
  15.             (princ (strcat "\nError: " msg))
  16.         )
  17.         (princ)
  18.     )
  19.  
  20.     (setq lst
  21.        '(
  22.             (
  23.                 "Static"
  24.                 (
  25.                     "Approval-NA-SL"
  26.                     "Approval-Schem-ACDC"
  27.                     "Approval-NA-PLO"
  28.                     "Approval-NA-ND"
  29.                     "Note_RemRet"
  30.                     "Note_RemOnly"
  31.                     "Note_RefOnly"
  32.                     "Note_RefDwgNum"
  33.                 )
  34.             )
  35.             (
  36.                 "User"
  37.                 (
  38.                     "Note_Rev_NewDwg"
  39.                     "Note_Rev_ExistDwg"
  40.                     "Note_Delta_Revision"
  41.                 )
  42.             )
  43.         )
  44.     )
  45.  
  46.     (if
  47.         (and
  48.             (setq dcl (vl-filename-mktemp "tmp.dcl"))
  49.             (setq des (open dcl "w"))
  50.             (foreach str
  51.                '(
  52.                     "lbx : list_box"
  53.                     "{"
  54.                     "    alignment = centered;"
  55.                     "    fixed_width = true;"
  56.                     "    fixed_height = true;"
  57.                     "    width = 30;"
  58.                     "    height = 15;"
  59.                     "}"
  60.                     "test : dialog"
  61.                     "{"
  62.                     "    label = \"Annotation\";"
  63.                     "    spacer;"
  64.                     "    : row"
  65.                     "    {"
  66.                     "        : lbx { key = \"lb0\"; label = \"Insert\"; }"
  67.                     "        : lbx { key = \"lb1\"; label = \"Annotation\"; }"
  68.                     "    }"
  69.                     "    spacer;"
  70.                     "    ok_cancel;"
  71.                     "}"
  72.                 )
  73.                 (write-line str des)
  74.             )
  75.             (not (setq des (close des)))
  76.             (< 0 (setq dch (load_dialog dcl)))
  77.             (new_dialog "test" dch)
  78.         )
  79.         (progn          
  80.             (setq rtn '(0 0))
  81.             (LM:dcld:action '("lb0" "lb1") 'lst 'rtn)
  82.             (setq Osm (getvar 'osmode))
  83.             (if (= 1 (start_dialog))
  84.                 (progn
  85.                   (setq rtn (LM:dcld:getitems rtn lst))
  86.                         (command "osmode" 1)
  87.                         (command "_.-insert" (cadr rtn) "_S" (getvar 'dimscale) "_R" 0.0)
  88.                         (if (= "Static" (car rtn))
  89.                             (command "_non" '(0 0))
  90.                             (command "\\")
  91.                         )
  92.             (command "._explode" "_l")
  93.                (if (and (setq ss (ssget))
  94.                    (setq i -1)
  95.                         )
  96.                         (repeat (sslength ss)
  97.                         (setq hnd (ssname ss (setq i (1+ i))))
  98.                            (command "_textedit" hnd "")
  99.                         )
  100.                      )
  101.                    )
  102.                )
  103.           (command "_change" hnd "" "P" "C" "1" "")
  104.             (princ "\n*Cancel*")
  105.           )
  106.         )
  107.    (setvar 'osmode Osm)    
  108.    (*error* nil)
  109.   (princ)
  110. )

Command: Stampins
Select the Approval-NA-SL from the list
Text edit command launches
User edits the text
hits enter
Text changes from brown to red.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 265
May have solved the issue. I had a comment in my lisp description that didn't have the (;;) in front of it. That particular line usually says ;;command: Stampins
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10