Jump to content

Make Popup List remember last selection


The Buzzard

Recommended Posts

Hello All,

 

I have a simple code that creates blocks by selecting from a popup list and set it scale the same way before its inserted. The program then loops back to it main page for another selection. The problem is the selection always returns to the top of the list rather then remembering the last selection. I have tried with radio buttons, toggles, and edit boxes and have had success with those, But never could figure out how to do this with the popup list. I would appreciate any help with this that anyone can offer.

 

Thanks in advance and hope someone can shed some light on this.

The Buzzard

 

DCL CODE

 

///////////////////////////////////////////////////////////////////////////////////////
           sl : dialog {
                label = "Symbols Library";
                : boxed_column {
                  label = "Symbol Image";
                  : image {
                    key = "im1";
                    height = 7.66;
                    fixed_height = true;
                    width = 27.92;
                    fixed_width = true;
                    alignment = centered;
                    color = 0;
                  }
                  : spacer {
                    height = 0;
                  }
                }
                : boxed_column {
                  label = "Symbols List";
                  : popup_list {
                    key = "pl1";
                    value = 0;
                  }
                  : spacer {
                    height = 0;
                  }
                }
                : boxed_column {
                  label = "Drawing Scale";
                  : popup_list {
                    key = "ds1";
                    value = 13;
                  }
                  : spacer {
                    height = 0;
                  }
                }
                : boxed_column {
                  label = "Control Buttons";
                  : button {
                    label = "Insert";
                    key = "accept";
                    mnemonic = "I";
                    is_default = true;
           }
           : button {
                    label = "Cancel";
             key = "cancel";
             mnemonic = "C";
                    is_cancel = true;
           }
                  : spacer {
                    height = 0;
                  }
                }
              }
///////////////////////////////////////////////////////////////////////////////////////

 

LSP CODE

 

;;;////////////////////////////////////////////////////////////////////////////////////
;;; 01 - Start-Up Function - Program Start.
(defun C:SL ()
 (SL_SS)
 (princ)
)
(princ "\nSymbols Library Lisp, SL.lsp Loaded....")
(princ "\nType SL to start program.")
;;;/////////////////////////////////////////////////////////////////
;;; 02 - Font Function - Font Style.
(defun SL_FS ()
 (command "_.STYLE" "Romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N")
)
;;;/////////////////////////////////////////////////////////////////
;;; 03 - Layer Function - Create Layer.
(defun SL_CL (NLAY CLR LT / LAY FRZ)
 (setq LAY (tblsearch "layer" NLAY))
 (if (not LAY)
   (command "_.layer" "m" NLAY "c" CLR "" "lt" LT "" "")
   (progn
     (setq FRZ (cdr (assoc 70 LAY)))
     (if (= FRZ 65)
       (progn
         (command "_.layer" "t" NLAY "")
         (command "_.layer" "s" NLAY ""))
       (command "_.layer" "s" NLAY ""))))
)
;;;/////////////////////////////////////////////////////////////////
;;; 04 - Layer Function - Layer Set.
(defun SL_LS ()
 (SL_CL "TEXT" "2" "")
 (progn
   (cond
     ((= SYM "TRI")(SL_CL "TRIANGLE" "1" ""))
     ((= SYM "SQR")(SL_CL "SQUARE" "1" ""))
     ((= SYM "CIR")(SL_CL "CIRCLE" "1" ""))))
)
;;;/////////////////////////////////////////////////////////////////
;;; 05 - Image Function - Show Image.
(defun SL_SI ()
 (setq w (dimx_tile "im1")
       h (dimy_tile "im1"))
 (start_image "im1")
 (fill_image 0 0 w h -15)
 (cond
   ((= IMG "0")
     (mapcar 'vector_image
     (list  80  23 136  80)
     (list   1  99  99   1)
     (list  23 136  80  80)
     (list  99  99   1   1)
     (list   1   1   1   1)
   ))
   ((= IMG "1")
     (mapcar 'vector_image
     (list  30  30 127 127  30)
     (list   1  98  98   1   1)
     (list  30 127 127  30  30)
     (list  98  98   1   1   1)
     (list   1   1   1   1   1)
   ))
   ((= IMG "2")
     (mapcar 'vector_image
     (list 129 129 129 128 128 127 125 124 122 121
           119 117 114 112 109 106 103 101  97  94
            91  88  85  81  78  75  72  68  65  62
            59  56  54  51  49  46  44  42  40  39
            37  36  35  34  34  33  33  33  34  34
            35  36  37  39  40  42  44  46  49  51
            54  56  59  62  65  68  72  75  78  81
            85  88  91  94  97 101 103 106 109 112
           114 117 119 121 122 124 125 127 128 128
           129 129 129)
     (list  49  46  43  40  36  33  30  27  24  22
            19  17  14  12  10   8   7   5   4   3
             2   2   1   1   1   2   2   3   4   5
             7   8  10  12  14  17  19  22  24  27
            30  33  36  40  43  46  49  53  56  59
            62  66  69  72  74  77  80  82  85  87
            89  90  92  94  95  96  96  97  97  98
            97  97  96  96  95  94  92  90  89  87
            85  82  80  77  74  72  69  66  62  59
            56  53  49)
     (list 129 129 128 128 127 125 124 122 121 119
           117 114 112 109 106 103 101  97  94  91
            88  85  81  78  75  72  68  65  62  59
            56  54  51  49  46  44  42  40  39  37
            36  35  34  34  33  33  33  34  34  35
            36  37  39  40  42  44  46  49  51  54
            56  59  62  65  68  72  75  78  81  85
            88  91  94  97 101 103 106 109 112 114
           117 119 121 122 124 125 127 128 128 129
           129 129 129)
     (list  46  43  40  36  33  30  27  24  22  19
            17  14  12  10   8   7   5   4   3   2
             2   1   1   1   2   2   3   4   5   7
             8  10  12  14  17  19  22  24  27  30
            33  36  40  43  46  49  53  56  59  62
            66  69  72  74  77  80  82  85  87  89
            90  92  94  95  96  96  97  97  98  97
            97  96  96  95  94  92  90  89  87  85
            82  80  77  74  72  69  66  62  59  56
            53  49  49)
     (list   1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1)
   ))
 )
 (end_image)
)
;;;/////////////////////////////////////////////////////////////////
;;; 06 - Scale Function - Drawing Scale.
(defun SL_DS ()
 (progn
   (setq DSF (fix DSF))
   (setq DSF (nth DSF ds_list))
   (cond
     ((= DSF "1/32\" = 1'") (setq DSF  384))
     ((= DSF "1/16\" = 1'") (setq DSF  192))
     ((= DSF "3/32\" = 1'") (setq DSF  128))
     ((= DSF "1/8\" = 1'")  (setq DSF   96))
     ((= DSF "3/16\" = 1'") (setq DSF   64))
     ((= DSF "1/4\" = 1'")  (setq DSF   48))
     ((= DSF "3/8\" = 1'")  (setq DSF   32))
     ((= DSF "1/2\" = 1'")  (setq DSF   24))
     ((= DSF "3/4\" = 1'")  (setq DSF   16))
     ((= DSF "1\" = 1'")    (setq DSF   12))
     ((= DSF "1-1/2\" = 1'")(setq DSF    )
     ((= DSF "3\" = 1'")    (setq DSF    4))
     ((= DSF "6\" = 1'")    (setq DSF    2))
     ((= DSF "1' = 1'")     (setq DSF    1))
     ((= DSF "1\" = 10'")   (setq DSF  120))
     ((= DSF "1\" = 20'")   (setq DSF  240))
     ((= DSF "1\" = 30'")   (setq DSF  360))
     ((= DSF "1\" = 40'")   (setq DSF  480))
     ((= DSF "1\" = 50'")   (setq DSF  600))
     ((= DSF "1\" = 60'")   (setq DSF  720))
     ((= DSF "1\" = 70'")   (setq DSF  840))
     ((= DSF "1\" = 80'")   (setq DSF  960))
     ((= DSF "1\" = 90'")   (setq DSF 1080))
     ((= DSF "1\" = 100'")  (setq DSF 1200))))
)
;;;/////////////////////////////////////////////////////////////////
;;; 07 - Main Function - Symbol Select.
(defun SL_SS ()
 (setq IMG "0")
 (setq DSF  1)
 (setq sl_list '("Triangle" "Square" "Circle"))
 (setq ds_list '("1/32\" = 1'" "1/16\" = 1'" "3/32\" = 1'" "1/8\" = 1'" "3/16\" = 1'"  "1/4\" = 1'"
                 "3/8\" = 1'"  "1/2\" = 1'"  "3/4\" = 1'"  "1\" = 1'"   "1-1/2\" = 1'" "3\" = 1'"
                 "6\" = 1'"    "1' = 1'"     "1\" = 10'"   "1\" = 20'"  "1\" = 30'"    "1\" = 40'"
                 "1\" = 50'"   "1\" = 60'"   "1\" = 70'"   "1\" = 80'"  "1\" = 90'"    "1\" = 100'"))
 (setq dcl_id (load_dialog "sl.dcl"))
 (if (not (new_dialog "sl" dcl_id))
   (exit))
 (start_list "pl1")
 (mapcar 'add_list sl_list)
 (end_list)
 (start_list "ds1")
 (mapcar 'add_list ds_list)
 (end_list)
 (SL_SI)
 (action_tile "pl1" "(setq IMG $value)(itoa 0)(SL_SI)")
 (action_tile "cancel" "(done_dialog)(setq button nil)")
 (action_tile "accept"
   (strcat
    "(progn
     (setq SYM (atof (get_tile \"pl1\")))"
    "(setq DSF (atof (get_tile \"ds1\")))"
    "(done_dialog)(setq button T))"))
 (start_dialog)
 (unload_dialog dcl_id)
 (if button
   (progn
     (setq SYM (fix SYM))
     (setq SYM (nth SYM sl_list))
     (cond
       ((= SYM "Triangle")(setq SYM "TRI")(SL_IS))
       ((= SYM "Square")  (setq SYM "SQR")(SL_IS))
       ((= SYM "Circle")  (setq SYM "CIR")(SL_IS)))))
 (princ)
)
;;;/////////////////////////////////////////////////////////////////
;;; 08 - Output Function - Insert Symbol.
(defun SL_IS ()
 (SL_FS)
 (SL_LS)
 (SL_DS)
 (if (null (tblsearch "block" SYM))
   (cond
     ((= SYM "TRI")(SL_TRI))
     ((= SYM "SQR")(SL_SQR))
     ((= SYM "CIR")(SL_CIR))))
 (setq inpt (getpoint "\nInsertion point:"))
 (command "_.insert" SYM inpt DSF DSF pause)
 (SL_SS)
)
;;;/////////////////////////////////////////////////////////////////
;;; 09 - Block Reference Function - Triangle Block Reference.
(defun SL_TRI ()
 (entmake '((0 . "block")(2 . "TRI")(10 0.0 0.0 0.0)(70 . 2)))
 (entmake '((0 . "ATTDEF")(5 . "307")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "TEXT")(100 . "AcDbText")
           (10 -0.158482 0.548598 0.0)(40 . 0.09375)(1 . "TEXT")(50 . 0.0)(41 . 1.0)(51 . 0.0)(7 . "Romans")
           (71 . 0)(72 . 1)(11 0.0 0.517348 0.0)(210 0.0 0.0 1.0)(100 . "AcDbAttributeDefinition")(3 . "Text:")
           (2 . "TEXT")(70 . (73 . 0)(74 . 1)))
 (entmake '((0 . "LWPOLYLINE")(5 . "289")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "0")(100 . "AcDbPolyline")
           (90 . 3)(70 . 1)(43 . 0.0)(38 . 0.0)(39 . 0.0)(10 8.68009e-017 0.431864)(40 . 0.0)(41 . 0.0)(42 . 0.0)
           (10 -0.249337 1.11022e-016)(40 . 0.0)(41 . 0.0)(42 . 0.0)(10 0.249337 -1.11022e-016)(40 . 0.0)(41 . 0.0)
           (42 . 0.0)(210 0.0 0.0 1.0)))
 (entmake '((0 . "endblk")))
)
;;;/////////////////////////////////////////////////////////////////
;;; 10 - Block Reference Function - Square Block Reference.
(defun SL_SQR ()
 (entmake '((0 . "block")(2 . "SQR")(10 0.0 0.0 0.0)(70 . 2)))
 (entmake '((0 . "ATTDEF")(5 . "307")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "TEXT")(100 . "AcDbText")
           (10 -0.158482 0.548598 0.0)(40 . 0.09375)(1 . "TEXT")(50 . 0.0)(41 . 1.0)(51 . 0.0)(7 . "Romans")
           (71 . 0)(72 . 1)(11 0.0 0.517348 0.0)(210 0.0 0.0 1.0)(100 . "AcDbAttributeDefinition")(3 . "Text:")
           (2 . "TEXT")(70 . (73 . 0)(74 . 1)))
 (entmake '((0 . "LWPOLYLINE")(5 . "28A")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "0")(100 . "AcDbPolyline")
           (90 . 4)(70 . 1)(43 . 0.0)(38 . 0.0)(39 . 0.0)(10 -0.25 0.5)(40 . 0.0)(41 . 0.0)(42 . 0.0)
           (10 -0.25 2.77556e-017)(40 . 0.0)(41 . 0.0)(42 . 0.0)(10 0.25 -5.55112e-017)(40 . 0.0)(41 . 0.0)
           (42 . 0.0)(10 0.25 0.5)(40 . 0.0)(41 . 0.0)(42 . 0.0)(210 0.0 0.0 1.0)))
 (entmake '((0 . "endblk")))
)
;;;/////////////////////////////////////////////////////////////////
;;; 11 -  Block Reference Function - Circle Block Reference.
(defun SL_CIR ()
 (entmake '((0 . "block")(2 . "CIR")(10 0.0 0.0 0.0)(70 . 2)))
 (entmake '((0 . "ATTDEF")(5 . "307")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "TEXT")(100 . "AcDbText")
           (10 -0.158482 0.548598 0.0)(40 . 0.09375)(1 . "TEXT")(50 . 0.0)(41 . 1.0)(51 . 0.0)(7 . "Romans")
           (71 . 0)(72 . 1)(11 0.0 0.517348 0.0)(210 0.0 0.0 1.0)(100 . "AcDbAttributeDefinition")(3 . "Text:")
           (2 . "TEXT")(70 . (73 . 0)(74 . 1)))
 (entmake '((0 . "CIRCLE")(5 . "2E9")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "0")(100 . "AcDbCircle")
           (10 0.0 -1.38778e-017 0.0)(40 . 0.25)(210 0.0 0.0 1.0)))
 (entmake '((0 . "endblk")))
)
;;;/////////////////////////////////////////////////////////////////

SL.gif

Link to comment
Share on other sites

Hey Buzzard, try this buddy:

 


; ds1 pl1

;;;////////////////////////////////////////////////////////////////////////////////////
;;; 01 - Start-Up Function - Program Start.
(defun C:SL ()
 (SL_SS)
 (princ)
)
(princ "\nSymbols Library Lisp, SL.lsp Loaded....")
(princ "\nType SL to start program.")
;;;/////////////////////////////////////////////////////////////////
;;; 02 - Font Function - Font Style.
(defun SL_FS ()
 (command "_.STYLE" "Romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N")
)
;;;/////////////////////////////////////////////////////////////////
;;; 03 - Layer Function - Create Layer.
(defun SL_CL (NLAY CLR LT / LAY FRZ)
 (setq LAY (tblsearch "layer" NLAY))
 (if (not LAY)
   (command "_.layer" "m" NLAY "c" CLR "" "lt" LT "" "")
   (progn
     (setq FRZ (cdr (assoc 70 LAY)))
     (if (= FRZ 65)
       (progn
         (command "_.layer" "t" NLAY "")
         (command "_.layer" "s" NLAY ""))
       (command "_.layer" "s" NLAY ""))))
)
;;;/////////////////////////////////////////////////////////////////
;;; 04 - Layer Function - Layer Set.
(defun SL_LS ()
 (SL_CL "TEXT" "2" "")
 (progn
   (cond
     ((= SYM "TRI")(SL_CL "TRIANGLE" "1" ""))
     ((= SYM "SQR")(SL_CL "SQUARE" "1" ""))
     ((= SYM "CIR")(SL_CL "CIRCLE" "1" ""))))
)
;;;/////////////////////////////////////////////////////////////////
;;; 05 - Image Function - Show Image.
(defun SL_SI ()
 (setq w (dimx_tile "im1")
       h (dimy_tile "im1"))
 (start_image "im1")
 (fill_image 0 0 w h -15)
 (cond
   ((= IMG "0")
     (mapcar 'vector_image
     (list  80  23 136  80)
     (list   1  99  99   1)
     (list  23 136  80  80)
     (list  99  99   1   1)
     (list   1   1   1   1)
   ))
   ((= IMG "1")
     (mapcar 'vector_image
     (list  30  30 127 127  30)
     (list   1  98  98   1   1)
     (list  30 127 127  30  30)
     (list  98  98   1   1   1)
     (list   1   1   1   1   1)
   ))
   ((= IMG "2")
     (mapcar 'vector_image
     (list 129 129 129 128 128 127 125 124 122 121
           119 117 114 112 109 106 103 101  97  94
            91  88  85  81  78  75  72  68  65  62
            59  56  54  51  49  46  44  42  40  39
            37  36  35  34  34  33  33  33  34  34
            35  36  37  39  40  42  44  46  49  51
            54  56  59  62  65  68  72  75  78  81
            85  88  91  94  97 101 103 106 109 112
           114 117 119 121 122 124 125 127 128 128
           129 129 129)
     (list  49  46  43  40  36  33  30  27  24  22
            19  17  14  12  10   8   7   5   4   3
             2   2   1   1   1   2   2   3   4   5
             7   8  10  12  14  17  19  22  24  27
            30  33  36  40  43  46  49  53  56  59
            62  66  69  72  74  77  80  82  85  87
            89  90  92  94  95  96  96  97  97  98
            97  97  96  96  95  94  92  90  89  87
            85  82  80  77  74  72  69  66  62  59
            56  53  49)
     (list 129 129 128 128 127 125 124 122 121 119
           117 114 112 109 106 103 101  97  94  91
            88  85  81  78  75  72  68  65  62  59
            56  54  51  49  46  44  42  40  39  37
            36  35  34  34  33  33  33  34  34  35
            36  37  39  40  42  44  46  49  51  54
            56  59  62  65  68  72  75  78  81  85
            88  91  94  97 101 103 106 109 112 114
           117 119 121 122 124 125 127 128 128 129
           129 129 129)
     (list  46  43  40  36  33  30  27  24  22  19
            17  14  12  10   8   7   5   4   3   2
             2   1   1   1   2   2   3   4   5   7
             8  10  12  14  17  19  22  24  27  30
            33  36  40  43  46  49  53  56  59  62
            66  69  72  74  77  80  82  85  87  89
            90  92  94  95  96  96  97  97  98  97
            97  96  96  95  94  92  90  89  87  85
            82  80  77  74  72  69  66  62  59  56
            53  49  49)
     (list   1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1   1   1   1   1   1   1   1
             1   1   1)
   ))
 )
 (end_image)
)
;;;/////////////////////////////////////////////////////////////////
;;; 06 - Scale Function - Drawing Scale.
(defun SL_DS ()
 (progn
   (setq DSF (fix DSF))
   (setq DSF (nth DSF ds_list))
   (cond
     ((= DSF "1/32\" = 1'") (setq DSF  384))
     ((= DSF "1/16\" = 1'") (setq DSF  192))
     ((= DSF "3/32\" = 1'") (setq DSF  128))
     ((= DSF "1/8\" = 1'")  (setq DSF   96))
     ((= DSF "3/16\" = 1'") (setq DSF   64))
     ((= DSF "1/4\" = 1'")  (setq DSF   48))
     ((= DSF "3/8\" = 1'")  (setq DSF   32))
     ((= DSF "1/2\" = 1'")  (setq DSF   24))
     ((= DSF "3/4\" = 1'")  (setq DSF   16))
     ((= DSF "1\" = 1'")    (setq DSF   12))
     ((= DSF "1-1/2\" = 1'")(setq DSF    )
     ((= DSF "3\" = 1'")    (setq DSF    4))
     ((= DSF "6\" = 1'")    (setq DSF    2))
     ((= DSF "1' = 1'")     (setq DSF    1))
     ((= DSF "1\" = 10'")   (setq DSF  120))
     ((= DSF "1\" = 20'")   (setq DSF  240))
     ((= DSF "1\" = 30'")   (setq DSF  360))
     ((= DSF "1\" = 40'")   (setq DSF  480))
     ((= DSF "1\" = 50'")   (setq DSF  600))
     ((= DSF "1\" = 60'")   (setq DSF  720))
     ((= DSF "1\" = 70'")   (setq DSF  840))
     ((= DSF "1\" = 80'")   (setq DSF  960))
     ((= DSF "1\" = 90'")   (setq DSF 1080))
     ((= DSF "1\" = 100'")  (setq DSF 1200))))
)
;;;/////////////////////////////////////////////////////////////////
;;; 07 - Main Function - Symbol Select.
(defun SL_SS ()
 (setq IMG "0")
 (setq DSF  1)
 (setq sl_list '("Triangle" "Square" "Circle"))
 (setq ds_list '("1/32\" = 1'" "1/16\" = 1'" "3/32\" = 1'" "1/8\" = 1'" "3/16\" = 1'"  "1/4\" = 1'"
                 "3/8\" = 1'"  "1/2\" = 1'"  "3/4\" = 1'"  "1\" = 1'"   "1-1/2\" = 1'" "3\" = 1'"
                 "6\" = 1'"    "1' = 1'"     "1\" = 10'"   "1\" = 20'"  "1\" = 30'"    "1\" = 40'"
                 "1\" = 50'"   "1\" = 60'"   "1\" = 70'"   "1\" = 80'"  "1\" = 90'"    "1\" = 100'"))
 (setq dcl_id (load_dialog "sl.dcl"))
 (if (not (new_dialog "sl" dcl_id))
   (exit))
 (start_list "pl1")
 (mapcar 'add_list sl_list)
 (end_list)
 (start_list "ds1")
 (mapcar 'add_list ds_list)
 (end_list)
 (SL_SI)
[color=Red][b]  (if SYM:DEF
   (set_tile "pl1" (itoa SYM:DEF)))
 (if DSF:DEF
   (Set_tile "ds1" (itoa DSF:DEF)))[/b][/color]
 (action_tile "pl1" "(setq IMG $value)(itoa 0)(SL_SI)")
 (action_tile "cancel" "(done_dialog)(setq button nil)")
 (action_tile "accept"
   (strcat
    "(progn
     (setq SYM (ato[color=Red][b]i[/b][/color] (get_tile \"pl1\")) [b][color=Red]SYM:DEF SYM[/color][/b])"
    "(setq DSF (ato[b][color=Red]i[/color][/b] (get_tile \"ds1\"))[b][color=Red] DSF:DEF DSF[/color][/b])"
    "(done_dialog)(setq button T))"))
 (start_dialog)
 (unload_dialog dcl_id)
 (if button
   (progn
     (setq SYM (fix SYM))
     (setq SYM (nth SYM sl_list))
     (cond
       ((= SYM "Triangle")(setq SYM "TRI")(SL_IS))
       ((= SYM "Square")  (setq SYM "SQR")(SL_IS))
       ((= SYM "Circle")  (setq SYM "CIR")(SL_IS)))))
 (princ)
)
;;;/////////////////////////////////////////////////////////////////
;;; 08 - Output Function - Insert Symbol.
(defun SL_IS ()
 (SL_FS)
 (SL_LS)
 (SL_DS)
 (if (null (tblsearch "block" SYM))
   (cond
     ((= SYM "TRI")(SL_TRI))
     ((= SYM "SQR")(SL_SQR))
     ((= SYM "CIR")(SL_CIR))))
 (setq inpt (getpoint "\nInsertion point:"))
 (command "_.insert" SYM inpt DSF DSF pause)
 (SL_SS)
)
;;;/////////////////////////////////////////////////////////////////
;;; 09 - Block Reference Function - Triangle Block Reference.
(defun SL_TRI ()
 (entmake '((0 . "block")(2 . "TRI")(10 0.0 0.0 0.0)(70 . 2)))
 (entmake '((0 . "ATTDEF")(5 . "307")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "TEXT")(100 . "AcDbText")
           (10 -0.158482 0.548598 0.0)(40 . 0.09375)(1 . "TEXT")(50 . 0.0)(41 . 1.0)(51 . 0.0)(7 . "Romans")
           (71 . 0)(72 . 1)(11 0.0 0.517348 0.0)(210 0.0 0.0 1.0)(100 . "AcDbAttributeDefinition")(3 . "Text:")
           (2 . "TEXT")(70 . (73 . 0)(74 . 1)))
 (entmake '((0 . "LWPOLYLINE")(5 . "289")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "0")(100 . "AcDbPolyline")
           (90 . 3)(70 . 1)(43 . 0.0)(38 . 0.0)(39 . 0.0)(10 8.68009e-017 0.431864)(40 . 0.0)(41 . 0.0)(42 . 0.0)
           (10 -0.249337 1.11022e-016)(40 . 0.0)(41 . 0.0)(42 . 0.0)(10 0.249337 -1.11022e-016)(40 . 0.0)(41 . 0.0)
           (42 . 0.0)(210 0.0 0.0 1.0)))
 (entmake '((0 . "endblk")))
)
;;;/////////////////////////////////////////////////////////////////
;;; 10 - Block Reference Function - Square Block Reference.
(defun SL_SQR ()
 (entmake '((0 . "block")(2 . "SQR")(10 0.0 0.0 0.0)(70 . 2)))
 (entmake '((0 . "ATTDEF")(5 . "307")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "TEXT")(100 . "AcDbText")
           (10 -0.158482 0.548598 0.0)(40 . 0.09375)(1 . "TEXT")(50 . 0.0)(41 . 1.0)(51 . 0.0)(7 . "Romans")
           (71 . 0)(72 . 1)(11 0.0 0.517348 0.0)(210 0.0 0.0 1.0)(100 . "AcDbAttributeDefinition")(3 . "Text:")
           (2 . "TEXT")(70 . (73 . 0)(74 . 1)))
 (entmake '((0 . "LWPOLYLINE")(5 . "28A")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "0")(100 . "AcDbPolyline")
           (90 . 4)(70 . 1)(43 . 0.0)(38 . 0.0)(39 . 0.0)(10 -0.25 0.5)(40 . 0.0)(41 . 0.0)(42 . 0.0)
           (10 -0.25 2.77556e-017)(40 . 0.0)(41 . 0.0)(42 . 0.0)(10 0.25 -5.55112e-017)(40 . 0.0)(41 . 0.0)
           (42 . 0.0)(10 0.25 0.5)(40 . 0.0)(41 . 0.0)(42 . 0.0)(210 0.0 0.0 1.0)))
 (entmake '((0 . "endblk")))
)
;;;/////////////////////////////////////////////////////////////////
;;; 11 -  Block Reference Function - Circle Block Reference.
(defun SL_CIR ()
 (entmake '((0 . "block")(2 . "CIR")(10 0.0 0.0 0.0)(70 . 2)))
 (entmake '((0 . "ATTDEF")(5 . "307")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "TEXT")(100 . "AcDbText")
           (10 -0.158482 0.548598 0.0)(40 . 0.09375)(1 . "TEXT")(50 . 0.0)(41 . 1.0)(51 . 0.0)(7 . "Romans")
           (71 . 0)(72 . 1)(11 0.0 0.517348 0.0)(210 0.0 0.0 1.0)(100 . "AcDbAttributeDefinition")(3 . "Text:")
           (2 . "TEXT")(70 . (73 . 0)(74 . 1)))
 (entmake '((0 . "CIRCLE")(5 . "2E9")(100 . "AcDbEntity")(67 . 0)(410 . "Model")(8 . "0")(100 . "AcDbCircle")
           (10 0.0 -1.38778e-017 0.0)(40 . 0.25)(210 0.0 0.0 1.0)))
 (entmake '((0 . "endblk")))
)
;;;/////////////////////////////////////////////////////////////////

 

No change to DCL - changes marked in red.

 

Hope this helps :)

 

Lee

Link to comment
Share on other sites

Lee,

 

Thats great, But you did not use that in your own dcl piping code.

I did not think you would have responded to this thread, But I know that what you put out there is as good as gold.

 

I found these two if statements in the code, I guess thats all there is to it?

 

  (if SYM:DEF
   (set_tile "pl1" (itoa SYM:DEF)))
 (if DSF:DEF
   (Set_tile "ds1" (itoa DSF:DEF)))

 

Anyway thanks so much, Now I can get away from the radio button habit.

The Buzzard

Link to comment
Share on other sites

Lee,

 

Thats great, But you did not use that in your own dcl piping code.

I did not think you would have responded to this thread, But I know that what you put out there is as good as gold.

 

I found these two if statements in the code, I guess thats all there is to it?

 

  (if SYM:DEF
   (set_tile "pl1" (itoa SYM:DEF)))
 (if DSF:DEF
   (Set_tile "ds1" (itoa DSF:DEF)))

Anyway thanks so much, Now I can get away from the radio button habit.

The Buzzard

 

Yeah, I probably should put that in my Piping Code - but its been so long since I have worked on the piping code, its so hard to navigate now :P

Link to comment
Share on other sites

I found these two if statements in the code, I guess thats all there is to it?

  (if SYM:DEF
   (set_tile "pl1" (itoa SYM:DEF)))
 (if DSF:DEF
   (Set_tile "ds1" (itoa DSF:DEF)))

 

As for, is this all there is to it -

 

I have used SYM:DEF and DSF:DEF as global variables - (they are set when the user selects something - see action tile statement), but also note that I have had to change your atof to atoi as the position of the element in a list is denoted by an integer.

 

Hope this makes some sense :)

 

Lee

Link to comment
Share on other sites

As for, is this all there is to it -

 

I have used SYM:DEF and DSF:DEF as global variables - (they are set when the user selects something - see action tile statement), but also note that I have had to change your atof to atoi as the position of the element in a list is denoted by an integer.

 

Hope this makes some sense :)

 

Lee

 

I did not notice that atof was replaced with atoi, Thanks for pointing that out. This will be a big space saver in the long run and mixing it with ASMI's list code gives it added benifits.

 

Got some fixes to do.

Thanks again

As always your best!

The Buzzard

Link to comment
Share on other sites

I did not notice that atof was replaced with atoi, Thanks for pointing that out. This will be a big space saver in the long run and mixing it with ASMI's list code gives it added benifits.

 

Got some fixes to do.

Thanks again

As always your best!

The Buzzard

 

I marked all the changes in red in the code I posted :P

 

Good luck with the fixes Buzz

Link to comment
Share on other sites

Lee,

 

You made it look so simple.:D

I added these changes to the IDS program and the fix was a breeze. I have been thinking about other programs to use this fix and realize I can avoid large dialogs with lots heavy use of mode tile. This is a major improvement. Now you will not be hearing from me for a while because I have some new stuff to try.:)

When that new stuff is done maybe you will not hear the end of it.:D

I will try not to bend your ears to much.:lol:

I really never expected an answer to this thread since DCL does not seem to be to popular here. But you had the answer all the time.:shock:

Link to comment
Share on other sites

Lee,

 

You made it look so simple.:D

I added these changes to the IDS program and the fix was a breeze. I have been thinking about other programs to use this fix and realize I can avoid large dialogs with lots heavy use of mode tile. This is a major improvement. Now you will not be hearing from me for a while because I have some new stuff to try.:)

When that new stuff is done maybe you will not hear the end of it.:D

I will try not to bend your ears to much.:lol:

I really never expected an answer to this thread since DCL does not seem to be to popular here. But you had the answer all the time.:shock:

 

Thanks Buzzard,

 

To be honest, I just experimented when you posted this thread, and worked it out from there - the set_tile only requires a key, and one other argument, so there was only really a small number of things that other argument could be :wink:

 

I'm glad this helps you out :D

 

Lee

Link to comment
Share on other sites

Just one more question.

 

Experimented?

 

How much caffine do you consume in a day. It was as if you pulled the answer out of thin air.

Link to comment
Share on other sites

Just one more question.

 

Experimented?

 

How much caffine do you consume in a day. It was as if you pulled the answer out of thin air.

 

haha - I barely have any caffeine actually o:)

 

Well, I knew you needed a global variable - that is the only way (well, the easiest) to "remember" things during a drawing session.

 

Then, I just experimented with the "set_tile", first I tried the actual strings, i.e.

 

(nth SYM:DEF sl_list)

 

then I tried integer positions (as strings - as "set_tile" only accepts strings):

 

(itoa SYM:DEF)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...