Typical Detail List Box out of order

Typical Detail List Box out of order

aaroncYPGMN
Participant Participant
624 Views
13 Replies
Message 1 of 14

Typical Detail List Box out of order

aaroncYPGMN
Participant
Participant

I've been using this LISP in the office for putting in the typical details. When it works you click on the category you want and the List Box lists all the details in the appropriate file locations. After the office switched to Autocad LT, now the listbox will randomly be out of order. In one attempt the foundation details will be out of order, and in another attempt the concrete details will be out of order. It seemed to start doing this out of the blue, and my LISP knowledge is woefully beginner. Any ideas on why the list is randomly out of order?

 

LISP below V

 

;; List Box  -  Lee Mac
;; Displays a DCL list box allowing the user to make a selection from the supplied data.
;; msg - [str] Dialog label
;; lst - [lst] List of strings to display
;; bit - [int] 1=allow multiple; 2=return indexes
;; Returns: [lst] List of selected items/indexes, else nil
 
(defun LM:listbox ( msg lst bit / dch des tmp rtn )
    (cond
        (   (not
                (and
                    (setq tmp (vl-filename-mktemp nil nil ".dcl"))
                    (setq des (open tmp "w"))
                    (write-line
                        (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select="
                            (if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}"
                        )
                        des
                    )
                    (not (close des))
                    (< 0 (setq dch (load_dialog tmp)))
                    (new_dialog "listbox" dch)
                )
            )
            (prompt "\nError Loading List Box Dialog.")
        )
        (   t     
            (start_list "list")
            (foreach itm lst (add_list itm))
            (end_list)
            (setq rtn (set_tile "list" "0"))
            (action_tile "list" "(setq rtn $value)")
            (setq rtn
                (if (= 1 (start_dialog))
                    (if (= 2 (logand 2 bit))
                        (read (strcat "(" rtn ")"))
                        (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")")))
                    )
                )
            )
        )
    )
    (if (< 0 dch)
        (unload_dialog dch)
    )
    (if (and tmp (setq tmp (findfile tmp)))
        (vl-file-delete tmp)
    )
    rtn
)
 
(defun C:TD ( / k blocks) ;TYPICAL DETAILS
(initget 1 "F G O E T L W P S N D M I A")
(setq k (getkword "\nWhich table are you using? [concrete Footing/Grade beams/cOncrete shearwall/concrEte beams/concreTe moment/bLock walls/Wood/Panelized roof/Steel beams/Non-comp deck/comp Deck/Metal studs/tIlt-up concrete/post tension slAb] :"))
(cond
  ((= k "F")
(Foreach itm 
'("\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Concrete\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Misc\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Foundation\\"
)
(foreach dwg (LM:listbox "Select DWG" (vl-directory-files itm "*.dwg" 1) 1)
      (command "_insert" (strcat itm dwg) pause "1" "1" "0")
    )
)
)
    );cond
)
(princ)
;|PUT IN A KEYWORD STATEMENT AND MAKE DIFFERENTS LISTS THAT GET CALLED FOR EACH CATEROY IE: CONCRETE FOOTING, GRADE BEAMS/PILES,
The filepath you used works now. Does it work on other peoples computers, or is that just a yours thing? You may have to put in a generic 
FINDFILE code to apply to all computers. FINGERS CROSSED.
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Block\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Cold Form Steel\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Concrete\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Foundation\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Misc\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Modular\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\PT Slab\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Steel\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Tilt Up\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Truss\\"
"\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Wood\\"
|;

 

0 Likes
Accepted solutions (1)
625 Views
13 Replies
Replies (13)
Message 2 of 14

Sea-Haven
Mentor
Mentor

I will look more into the problem but here is an alternative to initget.

 

SeaHaven_0-1753321167340.png

(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (= but nil)(setq but 1))
(setq ans (ah:butts but "V"  '("Which table" "Concrete footing" "Grade beams" "Concrete shearwall" 
"Concrete beams" "Concrete moment" "Block walls" "Wood" "Panelized roof" "Steel beams" "Non-comp deck"
"Comp deck" "Metal studs" "Tilt-up concrete" "Post tension slab")))

Just save Muiti radio buttons.lsp into a support path. As its auto loaded.

 

Had a quick look and struggling the choices don't match the directories and there seems to be some not listed.  As part two of above. Can you correct the choices and repost. Then can look at the next step of select dwgs. Just a question how many dwgs in a subdirectory ? The multi radio has about a 20 limit due to screen size. So the get dwg names can be passed to a dcl as a please choose.

(cond
((= ans "BLock walls")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Block\\"))
((= ans "Steel beams") (setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Cold Form Steel\\"))
((= ans "Concrete footing")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Concrete\\"))
((= ans "Concrete footing") (setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Foundation\\"))
((= ans "Misc")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Misc\\"))
((= ans "Modular")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Modular\\"))
((= ans "Post tension slab")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\PT Slab\\"))
((= ans "Steel beams")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Steel\\"))
((= ans "Tilt-up concrete")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Tilt Up\\"))
((= ans "Truss")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Truss\\"))
((= ans "wood")(setq itm "\\\\wdmycloudex1040\\public\\cad\\autocad blocks\\details\\Wood\\"))
)

Just a side question have you thought about using a custom pop menu ? You can have each type as a choice then select from a image or name choice.

 

SeaHaven_1-1753323623610.png

Or you can call another custom dcl that has images.

0 Likes
Message 3 of 14

paullimapa
Mentor
Mentor

"...now the listbox will randomly be out of order. "

I assume you're seeing the drawing files not sorted properly.

The line of code that list the drawings in the directory is here:

(foreach dwg (LM:listbox "Select DWG" (vl-directory-files itm "*.dwg" 1) 1)

 

You can try adding a sort function like this:

(foreach dwg (LM:listbox "Select DWG" (vl-sort (vl-directory-files itm "*.dwg" 1) '<) 1)

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 4 of 14

scot-65
Advisor
Advisor

@aaroncYPGMN 

Limited testing.

Does not require support paths.

Registry entry remembers root directory.

Dialog closes for insert point and reopens until Close is selected.

 

IBLK-1.gifIBLK-h.gif

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 5 of 14

pbejse
Mentor
Mentor

In what way the list is out of order? As far as i can tell vl-directory-files function is always in alphabetical order.

 

Are you saying on some instances the same list  ( concrete details ) will be a different order when using the tool repeatedly? 

0 Likes
Message 6 of 14

aaroncYPGMN
Participant
Participant

So this is the Concrete Footing option. My list of FDN details will be in order, but the next window for the MISC details will be out of order. It'll randomly happen, so say next time FDN will be out of order and the MISC will be in order, alphabetically speaking.

 

aaroncYPGMN_0-1754502734121.png

 

0 Likes
Message 7 of 14

aaroncYPGMN
Participant
Participant

What is a custom pop out menu? I've never heard of that.

0 Likes
Message 8 of 14

aaroncYPGMN
Participant
Participant

That sort function seems to be working great. The only problem is it seems to grouping the uppercase file names and lower case file names in different spots (Misc1-03 is should be right above misc1-05). I'm looking at the vl-sort page right now but I wanted to see if you had any insights.

 

aaroncYPGMN_1-1754503455528.png

 

0 Likes
Message 9 of 14

paullimapa
Mentor
Mentor
Accepted solution

well the only way is to force all dwg names to either lower case or upper case:

lower case:

(foreach dwg (LM:listbox "Select DWG" (mapcar '(lambda (x) (strcase x t)) (vl-directory-files itm "*.dwg" 1)) 1)

upper case:

(foreach dwg (LM:listbox "Select DWG" (mapcar 'strcase (vl-directory-files itm "*.dwg" 1)) 1)

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 10 of 14

aaroncYPGMN
Participant
Participant

It is working like a dream. Thank you so much!

0 Likes
Message 11 of 14

paullimapa
Mentor
Mentor

You are welcome… cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 12 of 14

Sea-Haven
Mentor
Mentor

A pop menu is what goes along the top, you can have a pop menu with images of say blocks and choose either name or click on the image. Inside the menu would be the dwg name.

 

SeaHaven_0-1754528101741.png

 

0 Likes
Message 13 of 14

sigmmadesigner
Advocate
Advocate

sigmmadesigner_0-1754634115194.png

como posso chegar a essa solução usando  Multi Radio buttons?


(DEFUN C:DPAI () (STANDARD-BLOCOS "15 ADD ARQ PAISAGISTICO"))

(LSP (SUB-LSP "FOLDERNAME")
 
 
DCL SUB-LSP
EXECUTAR_MENUDCL : dialog
{label="DESIGNCENTER";
 
: row {
: row {
:column{
:column{
:row{
:column{ 
: image_button{key="i1";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b1";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i2";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b2";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i3";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b3";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i4";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b4";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i5";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b5";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}}
:row{
:column{
: image_button{key="i6";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b6";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i7";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b7";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i8";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b8";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i9";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b9";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i10";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b10";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}}
:row{
:column{
: image_button{key="i11";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b11";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i12";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b12";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i13";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b13";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i14";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b14";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}
:column{
: image_button{key="i15";width=35;height=8;fixed_width=true;color=-15;allow_accept=true;}
: text{key="b15";width=35;height=1;fixed_width=true;alignment=left;is_bold=true;}}}
 }
}
:column{
: list_box {key="blista";width=40;allow_accept=true;}}
 }
}
: row {
: image { key = "imm" ;height = 2.00 ;width = 2.00;}
: paragraph {
: text_part {label = "STANDARD ENGENHARIA ||| | | | |";}
: text_part {label = "Projetos e Consultoria";}}
: row {
uni_button; : spacer { width = 0; }
esc_button; : spacer { width = 1; }
prev_button; : spacer { width = 0; }
next_button; : spacer { width = 1; }
ok_button; : spacer { width = 0; }
cancel_button; : spacer { width = 1; }
cria_button; : spacer { width = 0; }}
 }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
 
cria_button : button {
label           = "Cria Slide";
key             = "CRSLD";
mnemonic        = "C";
fixed_width     = true;
width           = 10;
vertical_alignment = centered;
horizontal_alignment = centered;
}
next_button : button {
label           = "Proximo";
key             = "BTP";
mnemonic        = "P";
fixed_width     = true;
width           = 10;
vertical_alignment = centered;
horizontal_alignment = centered;
}
prev_button : button {
label           = "Anterior";
key             = "BTA";
mnemonic        = "A";
fixed_width     = true;
width           = 10;
vertical_alignment = centered;
horizontal_alignment = centered;
}
esc_button : popup_list {
label           = "ESCALA";
key             = "LESCALA";
mnemonic        = "E";
fixed_width     = true;
width           = 10;
vertical_alignment = centered;
horizontal_alignment = centered;
}
uni_button : popup_list {
label           = "UNIDADE";
key             = "LUNIDADE";
mnemonic        = "U";
fixed_width     = true;
width           = 10;
vertical_alignment = centered;
horizontal_alignment = centered;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 Likes
Message 14 of 14

Sea-Haven
Mentor
Mentor

This is Multi radio buttons.lsp by me, the limit is around 20 buttons. example code at top. It is simply autoloaded so does not need to live in your custom lisp.

0 Likes