+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default Make Popup List remember last selection

    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

    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

    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    8))
          ((= 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 . 8)(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 . 8)(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 . 8)(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")))
    )
    ;;;/////////////////////////////////////////////////////////////////
    Attached Images

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,730

    Default

    Hey Buzzard, try this buddy:

    Code:
    ; 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    8))
          ((= 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)
      (if SYM:DEF
        (set_tile "pl1" (itoa SYM:DEF)))
      (if DSF:DEF
        (Set_tile "ds1" (itoa DSF:DEF)))
      (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 (atoi (get_tile \"pl1\")) SYM:DEF SYM)"
         "(setq DSF (atoi (get_tile \"ds1\")) DSF:DEF DSF)"
         "(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 . 8)(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 . 8)(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 . 8)(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
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  3. #3
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    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?

    Code:
      (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

  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,730

    Default

    Quote Originally Posted by The Buzzard View Post
    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?

    Code:
      (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
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,730

    Default

    Quote Originally Posted by The Buzzard View Post
    I found these two if statements in the code, I guess thats all there is to it?
    Code:
      (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 SYMEF and DSFEF 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
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  6. #6
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    As for, is this all there is to it -

    I have used SYMEF and DSFEF 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

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,730

    Default

    Quote Originally Posted by The Buzzard View Post
    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

    Good luck with the fixes Buzz
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  8. #8
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Lee,

    You made it look so simple.
    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.
    I will try not to bend your ears to much.
    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.

  9. #9
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,730

    Default

    Quote Originally Posted by The Buzzard View Post
    Lee,

    You made it look so simple.
    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.
    I will try not to bend your ears to much.
    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.
    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

    I'm glad this helps you out

    Lee
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  10. #10
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Registered forum members do not see this ad.

    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.

Similar Threads

  1. Change popup list contents from one list to another
    By The Buzzard in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 4th Mar 2009, 05:22 am
  2. Popup List Problem
    By The Buzzard in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 7th Jan 2009, 02:09 am
  3. How do I make a selection set of size 1 from the last entity
    By MarkytheSparky in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 30th Apr 2008, 08:54 pm
  4. Make a non square selection
    By viriato79 in forum AutoCAD General
    Replies: 8
    Last Post: 7th Jan 2008, 08:37 pm
  5. Foobar to list selection methods
    By hyposmurf in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 22nd Jul 2003, 10:50 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts