Jump to content

Multi select from drop down list


woodman78

Recommended Posts

I have a lisp to load notes into drawings that I got help with writing from here. It uses a dcl and a drop down list to select which note to load. One of my beta testers :) has asked that the user be allowed to select multiple notes in one go and have them all inserted together. I know this could be done with toggle boxes but as you can see I have quite a few notes and I expect a lot more to be added.

 

Can this be acheived with the drop down list?

notes.PNG

insertnotes.dcl

insertnotes.lsp

Notes - General - All Coords related to.dwg

Notes - General - All dimensions in m.dwg

Link to comment
Share on other sites

Thanks msasu,

 

I did that and that works but it only brings in the first one i select. the command ends then. Do i need to add sort sort of loop that will keep repeating for the number of items selected??

 

One other small thing: how can i change the width of the list_box???

Link to comment
Share on other sites

A list_box tile with multiple selections will return a string with indexes of current input separated by spaces: "0 1 3" means that items 0 (first), 1 and 3 are currently selected. Use the same at load time to create default selection.

 

Regarding the width of tile should use the below attributes (replace 19 with something that apply to your case):

width = [color=blue]19[/color];
fixed_width = true;

 

Regards,

Link to comment
Share on other sites

How to set multiattripute_select = true

and

fixed_width = true

don’t forget to set the attribute multiple_select = true.

 

width = 19;

fixed_width = true;

Link to comment
Share on other sites

A list_box tile with multiple selections will return a string with indexes of current input separated by spaces: "0 1 3" means that items 0 (first), 1 and 3 are currently selected. Use the same at load time to create default selection.

 

I don't understand this bit. Can someone break it down?

Link to comment
Share on other sites

DCL works with strings - so the return of a list_box will be a string of index values.

 

For example:

 

(setq lst '("a" "b" "c"))

If the list_box returns:

 

"0 2"

Then the user has selected

 

(nth 0 lst) => "a"
(nth 2 lst) => "c"

We can convert this string of indexes into a list using:

 

(read (strcat "(" <list_box return> ")"))

Lee

Link to comment
Share on other sites

How to set multiattripute_select = true

and

fixed_width = true

 

Tile attributes are those features that control the appearance of a tile (control) in a dialog box writhen in DCL language. Some are compulsory (i.e. “key”) and other (most) are optional.

To set an attribute will have to add it into tile’s DCL list at design time; if not set, an attribute will be considered with his built-in default value. Content, selection and state (enabled/disabled) can be modified at run-time also.

 

: list_box {
  key             = "MyTestListBox";        // this is the ID of tile
  label           = "Select item(s): ";     // label to show to user
  mnemonic        = "S";                    // shortcut character
  list            = "1st\n2nd\n3rd\n4th";   // predefined entries (separated by new line character)
  width           = 31;                     // width of the tile
  fixed_width     = true;                   // prevent tile to extend to available space
  height          = 11;                     // height of the tile
  fixed_height    = true;                   // prevent tile to extend to available space
  multiple_select = true;                   // user can select more entries at a time
  allow_accept    = false;                  // user cannot call OK from keyboard while this tile has focus
  is_tab_stop     = false;                  // while navigating by TAB this tile will be skipped
  is_enabled      = true;                   // tab is enabled at start-up (can be changed at run-time)
  value           = "0 2";                  // default selection
}

 

Supported attributes will vary with the type of tile – but DCL syntax is flexible enough to ignore usage of un-supported attributes. You may find a comprehensive list of tiles used for DCL dialog boxes along with their attributes in help.

 

Regards,

Link to comment
Share on other sites

LeeMac can you take a look at this. I am a bit stumped as to where to go with this.

 

I don't know how to collect the chosen options with the string and how to get the insert command to be loaded with them...

 

 
;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:insertnotes ()
 (insertnotes_MF)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun insertnotes_MF (/ SIZE$ SIZE SUCE  SUOM  SUSM SUAB SUAD MIDPT PLEN
                  PT01  PT02 a b Color INPT Note$)
 (setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))
 (setq temperr *error*)
 (setq *error* insertnotes_ETRAP)
 (setq S1_list
  '("*** General Notes ***" 
    "All coords related to..."
    "All dimensions in m..." 
    "All levels to Malin Head..."
    "Any queries to be conveyed..." 
    "Dimensions not to be scaled..."
    "The information on this plan..." 
    "Diversion of existing river..."
    "--------------------------------------"
    "*** Pedestrian Notes ***" 
    "Controlled ped crossing..."
    "Directions of blisters..." 
    "Maximum projection of dropped kerbs..."
    "Uncontrolled ped crossing..." 
    "--------------------------------------"
    "*** Watermain Notes ***"  
    "All blockwork brickwork used in chambers..."
    "All mortar used in chambers..."  
    "All sluice valves to be right hand closing..."
    "Chamber size for sluice valves..." 
    "Floor slab depth to be min 200mm..."
    "--------------------------------------"
    "*** Reinforced Concrete Notes ***" 
    "All concrete to be grade 35A..."
    "All steel to be checked and approved..."
    "All steel to be Type 2 deformed 460..."
    "Cutting and bending BS8666..."
    "EF - Earth Face, FF - Far Face..."
    "Minimum cover to steel to be 50mm..."
    "Minimum lap length to be 38 times bar dia..."
   )
 )
 (setq dcl_id (load_dialog "insertnotes.dcl"))
 (if
   (not
     (new_dialog "insertnotes" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     (setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (insertnotes_VARIABLE)
 )
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; insertnotes_VARIABLE Function
;
(defun insertnotes_VARIABLE ()
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ 
(nth 0 S1_list) ="All coords related to..."(setq Note$ "Notes - General - All Coords related to")
(nth 1 S1_list) ="All dimensions in m..."(setq Note$ "Notes - General - All dimensions in m")
(nth 2 S1_list) ="All levels to Malin Head..."(setq Note$ "Notes - General - All Levels to Malin Head")
(nth 3 S1_list) ="Any queries..."(setq Note$ "Notes - General - Any queries to be conveyed to CCC NNRDO")
(nth 4 S1_list) ="Dimensions not to be scaled..."(setq Note$ "Notes - General - Dimensions not to be scaled")
(nth 5 S1_list) ="The information on this plan..."(setq Note$ "Notes - General - The Information on this Plan")
(nth 6 S1_list) ="Diversion of existing river..."(setq Note$ "Notes - General - Diversion of existing river")
(nth 7 S1_list) ="Controlled ped crossing..."(setq Note$ "Notes - Pesdestrians - Controlled Ped Crossing")
(nth 8 S1_list) ="Directions of blisters..."(setq Note$ "Notes - Pesdestrians - Directions of Blisters")
(nth 9 S1_list) ="Maximum projection of dropped kerbs..."(setq Note$ "Notes - Pesdestrians - Maximum Projection of dropped kerbs")
(nth 10 S1_list) ="Uncontrolled ped crossing..."(setq Note$ "Notes - Pesdestrians - Uncontrolled Ped Crossing")
)
     ;;((= SIZE$ "All coords related to...")(setq SIZE$ "Notes - General - All Coords related to"))
     ;;((= SIZE$ "All dimensions in m...")(setq SIZE$ "Notes - General - All dimensions in m"))
     ;;((= SIZE$ "All levels to Malin Head...")(setq SIZE$ "Notes - General - All Levels to Malin Head"))
     ;;((= SIZE$ "Any queries...")(setq SIZE$ "Notes - General - Any queries to be conveyed to CCC NNRDO"))
     ;;((= SIZE$ "Dimensions not to be scaled...")(setq SIZE$  "Notes - General - Dimensions not to be scaled"))
     ;;((= SIZE$ "The information on this plan...")(setq SIZE$  "Notes - General - The Information on this Plan"))
     ;;((= SIZE$ "Diversion of existing river...")(setq SIZE$  "Notes - General - Diversion of existing river"))
     ;;((= SIZE$ "Controlled ped crossing...")(setq SIZE$  "Notes - Pesdestrians - Controlled Ped Crossing"))
     ;;((= SIZE$ "Directions of blisters...")(setq SIZE$  "Notes - Pesdestrians - Directions of Blisters"))
     ;;((= SIZE$ "Maximum projection of dropped kerbs...")(setq SIZE$  "Notes - Pesdestrians - Maximum Projection of dropped kerbs"))
     ;;((= SIZE$ "Uncontrolled ped crossing...")(setq SIZE$  "Notes - Pesdestrians - Uncontrolled Ped Crossing"))
     ;;((= SIZE$ "All blockwork brickwork used in chambers...")(setq SIZE$  "Notes - Watermains - All blockwork brickwork used in chambers"))
     ;;((= SIZE$ "All mortar used in chambers...")(setq SIZE$  "Notes - Watermains - All mortar used in chambers"))
     ;;((= SIZE$ "All sluice valves to be right hand closing...")(setq SIZE$  "Notes - Watermains - All sluice valves to be right hand closing"))
     ;;((= SIZE$ "Chamber size for sluice valves...")(setq SIZE$  "Notes - Watermains - Chamber size for Sluice Valves"))
     ;;((= SIZE$ "Floor slab depth to be min 200mm...")(setq SIZE$  "Notes - Watermains - Floor Slab Depth to be min 200mm"))
     ;;((= SIZE$ "All concrete to be grade 35A...")(setq SIZE$  "Notes - Concrete - All concrete to be grade 35A"))
     ;;((= SIZE$ "All steel to be checked and approved...")(setq SIZE$  "Notes - Concrete - All steel to be checked and approved by engineer"))
     ;;((= SIZE$ "All steel to be Type 2 deformed 460...")(setq SIZE$  "Notes - Concrete - All steel to be Type 2 deformed 460"))
     ;;((= SIZE$ "Cutting and bending BS8666...")(setq SIZE$  "Notes - Concrete - Cutting and bending BS8666"))
     ;;((= SIZE$ "EF - Earth Face, FF - Far Face...")(setq SIZE$  "Notes - Concrete - Earth Face Far Face"))
     ;;((= SIZE$ "Minimum cover to steel to be 50mm...")(setq SIZE$  "Notes - Concrete - Minimum cover to steel to be 50mm"))
     ;;((= SIZE$ "Minimum lap length to be 38 times bar dia...")(setq SIZE$  "Notes - Concrete - Minimum lap length to be 38 times bar dia"))
   )
 )
 (setq SIZE SIZE$) 
 (insertnotes_OUTPUT)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; insertnotes_OUTPUT Function
;
(defun insertnotes_OUTPUT ()
 (command "_.-layer" "_M" "CCC_SHEET_LAYOUT_Notes" "_C" "7" "CCC_SHEET_LAYOUT_Notes" "_LW" "0.3" "CCC_SHEET_LAYOUT_Notes" "" )
 (command "_-color"  "bylayer")
 (command "._-linetype"  "s"  "bylayer" "")
 (setq INPT (getpoint "\Get insertion point:"))
 (command "_.insert" SIZE INPT "1" "1" "0")
 (setvar "angbase" 0.0000)
 (setvar "angdir"  0)
 (setvar "orthomode" 0)
 (setvar "osmode"    16383)
   (setvar "osmode" 0)
   (setvar "osmode" 16383)
 (setq *error* temperr)
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (setvar "clayer"    SUCL)
 (setvar "cecolor"   SUCR)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun insertnotes_ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring insertnotes_VARIABLEs.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////

Link to comment
Share on other sites

Woodman,

 

I have not seen your DCL file, and there is a lot of code in your post that looks like it has just been mindlessly copied from one of Buzzard's routines - there is a great deal of it that is unnecessary.

 

In your post, a block is being inserted using a variable "SIZE" which isn't properly defined in the COND statemnts.

 

I have put together a bit of code that might help however,

 

(defun c:test (/ *error* DCHANDLE INPT OV PT RTN S1_LIST VL)

 (defun *error* (msg)
   (and dcHandle (unload_dialog dcHandle))
   (and ov (mapcar 'setvar vl ov))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq S1_list
  '("*** General Notes ***" 
    "All coords related to..."
    "All dimensions in m..." 
    "All levels to Malin Head..."
    "Any queries to be conveyed..." 
    "Dimensions not to be scaled..."
    "The information on this plan..." 
    "Diversion of existing river..."
    "--------------------------------------"
    "*** Pedestrian Notes ***" 
    "Controlled ped crossing..."
    "Directions of blisters..." 
    "Maximum projection of dropped kerbs..."
    "Uncontrolled ped crossing..." 
    "--------------------------------------"
    "*** Watermain Notes ***"  
    "All blockwork brickwork used in chambers..."
    "All mortar used in chambers..."  
    "All sluice valves to be right hand closing..."
    "Chamber size for sluice valves..." 
    "Floor slab depth to be min 200mm..."
    "--------------------------------------"
    "*** Reinforced Concrete Notes ***" 
    "All concrete to be grade 35A..."
    "All steel to be checked and approved..."
    "All steel to be Type 2 deformed 460..."
    "Cutting and bending BS8666..."
    "EF - Earth Face, FF - Far Face..."
    "Minimum cover to steel to be 50mm..."
    "Minimum lap length to be 38 times bar dia..."
   )
 )

 (setq vl '("CMDECHO" "CLAYER" "OSMODE") ov (mapcar 'getvar vl))

 (cond (  (<= (setq dcHandle (load_dialog "insertnotes.dcl")) 0)

          (princ "\n** Dialog file not Found **"))

       (  (not (new_dialog "insertnotes" dcHandle))

          (princ "\n** Dialog Definition Not Found **"))

       (t

          (start_list "S1")
          (mapcar (function add_list) S1_list)
          (end_list)

          (set_tile "S1" (setq *def* (cond (*def*) ("1"))))

          (action_tile "S1"     "(setq *def* $value)")
        
          (action_tile "accept" "(cond ((member (atoi *def*) '(0 8 9 14 15 21 22)) (alert \"Invalid Note\"))
                                       ((done_dialog 1)))")
        
          (action_tile "cancel" "(done_dialog 0)")

          (setq rtn (start_dialog))

          (setq dcHandle (unload_dialog dcHandle))

          (if (and (= 1 rtn)
                   (setq pt (getpoint "\nPick Insertion Point: ")))
            (progn

              (or (tblsearch "LAYER" "CCC_SHEET_LAYOUT_Notes")
                  (entmake (list (cons 0 "LAYER")
                                 (cons 100 "AcDbSymbolTableRecord")
                                 (cons 100 "AcDbLayerTableRecord")
                                 (cons 2 "CCC_SHEET_LAYOUT_Notes")
                                 (cons 70 0)
                                 (cons 62 7)
                                 (cons 370 30))))

              (mapcar 'setvar vl '(0 "CCC_SHEET_LAYOUT_Notes" 0))

              (command "_.-insert" (nth (atoi *def*) S1_list) INPT "1" "1" "0")))))

 (mapcar 'setvar vl ov)
 (princ))

Please study the way it works, and not just copy/paste it into other routines.

Link to comment
Share on other sites

ok LeeMac. I will try. I used to know basic a quite some time ago in college but I am really struggling to get my head around Lisp. I have bought books on it and tried studying it but I really struggle. Hence it is easier to take something that works and modify it even if the code ends up being a bit chunky. Anyway will try.

 

The insert command in the lisp throws up an error. It is like the (nth (atoi *def*) S1_list) causes the routine to end before it get to the 1 1 0

Link to comment
Share on other sites

I would recommend breaking the code down line by line and making sure that you understand what each line is doing and why it is there - what difference would it make to the code if the line was removed for example.

 

As for the error with the insert command - I wasn't sure what you were trying to do with the return of the dialog - so I guessed.

Link to comment
Share on other sites

LeeMac,

 

I sorted the issue with the insert command and that now works. but it is still only inserting one of the blocks??

 

 
(defun c:insertnotes (/ *error* DCHANDLE INPT OV PT RTN S1_LIST VL Note)
 (defun *error* (msg)
   (and dcHandle (unload_dialog dcHandle))
   (and ov (mapcar 'setvar vl ov))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))
 (setq S1_list
  '("*** General Notes ***" 
    "All coords related to..."
    "All dimensions in m..." 
    "All levels to Malin Head..."
    "Any queries to be conveyed to CCC NNRDO..." 
    "Dimensions not to be scaled..."
    "The information on this plan..." 
    "Diversion of existing river..."
    "--------------------------------------"
    "*** Pedestrian Notes ***" 
    "Controlled ped crossing..."
    "Directions of blisters..." 
    "Maximum projection of dropped kerbs..."
    "Uncontrolled ped crossing..." 
    "--------------------------------------"
    "*** Watermain Notes ***"  
    "All blockwork brickwork used in chambers..."
    "All mortar used in chambers..."  
    "All sluice valves to be right hand closing..."
    "Chamber size for sluice valves..." 
    "Floor slab depth to be min 200mm..."
    "--------------------------------------"
    "*** Reinforced Concrete Notes ***" 
    "All concrete to be grade 35A..."
    "All steel to be checked and approved..."
    "All steel to be Type 2 deformed 460..."
    "Cutting and bending BS8666..."
    "EF - Earth Face, FF - Far Face..."
    "Minimum cover to steel to be 50mm..."
    "Minimum lap length to be 38 times bar dia..."
   )
 )
 (setq vl '("CMDECHO" "CLAYER" "OSMODE") ov (mapcar 'getvar vl))
 (cond (  (<= (setq dcHandle (load_dialog "insertnotes.dcl")) 0)
          (princ "\n** Dialog file not Found **"))
       (  (not (new_dialog "insertnotes" dcHandle))
          (princ "\n** Dialog Definition Not Found **"))
       (t
          (start_list "S1")
          (mapcar (function add_list) S1_list)
          (end_list)
          (set_tile "S1" (setq *def* (cond (*def*) ("1"))))
          (action_tile "S1"     "(setq *def* $value)")
        
          (action_tile "accept" "(cond ((member (atoi *def*) '(0 8 9 14 15 21 22)) (alert \"Invalid Note\"))
                                       ((done_dialog 1)))")
        
          (action_tile "cancel" "(done_dialog 0)")
          (setq rtn (start_dialog))
          (setq dcHandle (unload_dialog dcHandle))
          (if (and (= 1 rtn)
                   (setq INPT (getpoint "\nPick Insertion Point: ")))
            (progn
              (or (tblsearch "LAYER" "CCC_SHEET_LAYOUT_Notes")
                  (entmake (list (cons 0 "LAYER")
                                 (cons 100 "AcDbSymbolTableRecord")
                                 (cons 100 "AcDbLayerTableRecord")
                                 (cons 2 "CCC_SHEET_LAYOUT_Notes")
                                 (cons 70 0)
                                 (cons 62 7)
                                 (cons 370 30))))
              (mapcar 'setvar vl '(0 "CCC_SHEET_LAYOUT_Notes" 0))
(setq note (nth (atoi *def*) S1_list))
              (command "_.insert" note INPT "1" "1" "0")))))
 (mapcar 'setvar vl ov)
 (princ))

Link to comment
Share on other sites

LeeMac,

 

I sorted the issue with the insert command and that now works. but it is still only inserting one of the blocks??

 

 

Woodman,

 

Are you using a popup_list (like in your first post) or a list_box? With a popup_list you can only select one option.

Link to comment
Share on other sites

Try this:

 

(defun c:test (/ *error* DCHANDLE INPT OV PT RTN S1_LIST VL)

 (defun *error* (msg)
   (and dcHandle (unload_dialog dcHandle))
   (and ov (mapcar 'setvar vl ov))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq S1_list
  '("*** General Notes ***" 
    "All coords related to..."
    "All dimensions in m..." 
    "All levels to Malin Head..."
    "Any queries to be conveyed..." 
    "Dimensions not to be scaled..."
    "The information on this plan..." 
    "Diversion of existing river..."
    "--------------------------------------"
    "*** Pedestrian Notes ***" 
    "Controlled ped crossing..."
    "Directions of blisters..." 
    "Maximum projection of dropped kerbs..."
    "Uncontrolled ped crossing..." 
    "--------------------------------------"
    "*** Watermain Notes ***"  
    "All blockwork brickwork used in chambers..."
    "All mortar used in chambers..."  
    "All sluice valves to be right hand closing..."
    "Chamber size for sluice valves..." 
    "Floor slab depth to be min 200mm..."
    "--------------------------------------"
    "*** Reinforced Concrete Notes ***" 
    "All concrete to be grade 35A..."
    "All steel to be checked and approved..."
    "All steel to be Type 2 deformed 460..."
    "Cutting and bending BS8666..."
    "EF - Earth Face, FF - Far Face..."
    "Minimum cover to steel to be 50mm..."
    "Minimum lap length to be 38 times bar dia..."
   )
 )

 (setq vl '("CMDECHO" "CLAYER" "OSMODE") ov (mapcar 'getvar vl))

 (cond (  (<= (setq dcHandle (load_dialog "insertnotes.dcl")) 0)

          (princ "\n** Dialog file not Found **"))

       (  (not (new_dialog "insertnotes" dcHandle))

          (princ "\n** Dialog Definition Not Found **"))

       (t

          (start_list "S1")
          (mapcar (function add_list) S1_list)
          (end_list)

          (set_tile "S1" (setq *def* (cond (*def*) ("1"))))

          (action_tile "S1"     "(setq *def* $value)")
        
          (action_tile "accept" "(cond ((member (atoi *def*) '(0 8 9 14 15 21 22)) (alert \"Invalid Note\"))
                                       ((done_dialog 1)))")
        
          (action_tile "cancel" "(done_dialog 0)")

          (setq rtn (start_dialog))

          (setq dcHandle (unload_dialog dcHandle))

          (if (= 1 rtn)
            (progn

              (or (tblsearch "LAYER" "CCC_SHEET_LAYOUT_Notes")
                  (entmake (list (cons 0 "LAYER")
                                 (cons 100 "AcDbSymbolTableRecord")
                                 (cons 100 "AcDbLayerTableRecord")
                                 (cons 2 "CCC_SHEET_LAYOUT_Notes")
                                 (cons 70 0)
                                 (cons 62 7)
                                 (cons 370 30))))

              (mapcar 'setvar vl '(0 "CCC_SHEET_LAYOUT_Notes" 0))

              (foreach block (mapcar
                               (function
                                 (lambda (x) (nth x S1_list)))

                               (read (strcat "(" *def* ")")))
                
                (if (setq pt (setq pt (getpoint "\nPick Insertion Point: ")))
                  (command "_.-insert" block INPT "1" "1" "0"))))

            (princ "\n*Cancel*"))))

 (mapcar 'setvar vl ov)
 (princ))

Link to comment
Share on other sites

  • 11 months later...
Guest natsha61
Try this:

 

(defun c:test (/ *error* DCHANDLE INPT OV PT RTN S1_LIST VL)

 (defun *error* (msg)
   (and dcHandle (unload_dialog dcHandle))
   (and ov (mapcar 'setvar vl ov))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq S1_list
  '("*** General Notes ***" 
    "All coords related to..."
    "All dimensions in m..." 
    "All levels to Malin Head..."
    "Any queries to be conveyed..." 
    "Dimensions not to be scaled..."
    "The information on this plan..." 
    "Diversion of existing river..."
    "--------------------------------------"
    "*** Pedestrian Notes ***" 
    "Controlled ped crossing..."
    "Directions of blisters..." 
    "Maximum projection of dropped kerbs..."
    "Uncontrolled ped crossing..." 
    "--------------------------------------"
    "*** Watermain Notes ***"  
    "All blockwork brickwork used in chambers..."
    "All mortar used in chambers..."  
    "All sluice valves to be right hand closing..."
    "Chamber size for sluice valves..." 
    "Floor slab depth to be min 200mm..."
    "--------------------------------------"
    "*** Reinforced Concrete Notes ***" 
    "All concrete to be grade 35A..."
    "All steel to be checked and approved..."
    "All steel to be Type 2 deformed 460..."
    "Cutting and bending BS8666..."
    "EF - Earth Face, FF - Far Face..."
    "Minimum cover to steel to be 50mm..."
    "Minimum lap length to be 38 times bar dia..."
   )
 )

 (setq vl '("CMDECHO" "CLAYER" "OSMODE") ov (mapcar 'getvar vl))

 (cond (  (<= (setq dcHandle (load_dialog "insertnotes.dcl")) 0)

          (princ "\n** Dialog file not Found **"))

       (  (not (new_dialog "insertnotes" dcHandle))

          (princ "\n** Dialog Definition Not Found **"))

       (t

          (start_list "S1")
          (mapcar (function add_list) S1_list)
          (end_list)

          (set_tile "S1" (setq *def* (cond (*def*) ("1"))))

          (action_tile "S1"     "(setq *def* $value)")
        
          (action_tile "accept" "(cond ((member (atoi *def*) '(0 8 9 14 15 21 22)) (alert \"Invalid Note\"))
                                       ((done_dialog 1)))")
        
          (action_tile "cancel" "(done_dialog 0)")

          (setq rtn (start_dialog))

          (setq dcHandle (unload_dialog dcHandle))

          (if (= 1 rtn)
            (progn

              (or (tblsearch "LAYER" "CCC_SHEET_LAYOUT_Notes")
                  (entmake (list (cons 0 "LAYER")
                                 (cons 100 "AcDbSymbolTableRecord")
                                 (cons 100 "AcDbLayerTableRecord")
                                 (cons 2 "CCC_SHEET_LAYOUT_Notes")
                                 (cons 70 0)
                                 (cons 62 7)
                                 (cons 370 30))))

              (mapcar 'setvar vl '(0 "CCC_SHEET_LAYOUT_Notes" 0))

              (foreach block (mapcar
                               (function
                                 (lambda (x) (nth x S1_list)))

                               (read (strcat "(" *def* ")")))
                
                (if (setq pt (setq pt (getpoint "\nPick Insertion Point: ")))
                  (command "_.-insert" block INPT "1" "1" "0"))))

            (princ "\n*Cancel*"))))

 (mapcar 'setvar vl ov)
 (princ))

 

Same here TICK Box possible to create.because same method using for checklist option....after saving dwg thats chklist tic box also save is it possible

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...