wesleyaqua 发表于 2022-7-5 23:27:56

list_box

Hi
 
i'm trying to get a list to the left of the .sld files now i could ad the list_box to the correct place. but i cant get it to work. i dont know what i need to type in at key.
 
i found this code at web2.airmail.net/terrycad/AutoLISP-Code.htm
blk_lib.lsp
blk_lib.dcl the dcl file i have modified.
 

//------------------------------------------------------------------------------// Dwg_Blks - View and select drawing blocks//------------------------------------------------------------------------------Dwg_Blks : dialog { label = ""; key = "title"; initial_focus = "cancel"; spacer; : row {   : column {   : list_box {       label ="";       key = "???";       height = 50;       width = 25;       multiple_select = false;       fixed_width_font = true;       value = "";   }   }   : column {   : row {       : icon_image {         key = "sld1";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld2";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld3";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld4";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld5";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }   }   : row {       : column {         : text {         key = "sld1text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld2text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld3text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld4text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld5text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }   }   : row {       : icon_image {         key = "sld6";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld7";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld8";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld9";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld10";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }   }   : row {       : column {         : text {         key = "sld6text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld7text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld8text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld9text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld10text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }   }   : row {       : icon_image {         key = "sld11";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld12";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld13";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld14";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld15";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }   }   : row {       : column {         : text {         key = "sld11text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld12text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld13text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld14text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld15text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }   }   : row {       : icon_image {         key = "sld16";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld17";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld18";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld19";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }      : icon_image {         key = "sld20";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }   }   : row {       : column {         : text {         key = "sld16text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld17text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld18text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld19text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }       }       : column {         : text {         key = "sld20text";         label = "";         width = 25.92;         fixed_width = true;         alignment = centered;         }      }   }   } } : row {   : column {   : button {       key   = "previous";       label = "< Previous";       mnemonic = "P";       width = 70;       fixed_width = true;       alignment = centered;   }   : ok_button {       mnemonic = "O";       alignment = right;       width = 11;   }   }   : column {   : button {       key   = "next";       label = "Next >";       mnemonic = "N";       width = 70;       fixed_width = true;       alignment = centered;   }   : cancel_button {       mnemonic = "C";       alignment = left;       width = 11;   }   } }}//Dwg_Blksso this part of dcl i have changed.
now i would like to get in the list box a list of all files that are displayed as .sld on that part of the library
 
do i need to make changes also to the .lsp file cause i searched and tried some different names as key but none show me a list or even a word
 
thx in advance

MSasu 发表于 2022-7-5 23:49:40

To list the SLD files should look to VL-DIRECTORY-FILES function.

(vl-directory-files "C:\\MySLDLibrary\\" "*.SLD" 0)
 
Please post the AutoLISP code along to get an apropriate answer.

wesleyaqua 发表于 2022-7-6 00:03:05

 
hi
 
I edited my first one now the site should work where to get those files.
i cant past the code in here cause it is to long.
 
with those 3 codes it should work, the program
now i don't realy onderstand where to add your part
also each part of the library loads his own .def and .sld file at the location where the .dwg stands
 
 
its a verry nice tool that library but it need some tweeking for me.
am also looking to adjust some default values.
but that is for afhter this qeust

Jef! 发表于 2022-7-6 00:14:24

To use a listbox, you need a key. In the DCL file, the only thing you specify is which key should be used. The key however has to be defined into the lisp.
To define a key you need the following functions
(start_list key)
(add_list)
...
(end_list)
 
 
Many made simple sub routines to help, I've seen (one by MSasu and Lee Mac..)
This one is simple and understandable even for beginners (posted by Lee originally me think... )

(defun FillPopupList ( key lst )       (start_list key)       (foreach item lst (add_list item))       (end_list))
 
 
If you want to change the lock (key in DCL), you'll need to make new key (and ideally get rid of unused one). Look and search you'll find 95% of what you need.
 
 
Good luck

wesleyaqua 发表于 2022-7-6 00:31:25

 
I'm i right that tis part is controlling the dcl part with the list
 
 

;----------------------------------------------------------------------------- ; Dwg_Blks: - Controls dialog Dwg_Blks.dcl to view select drawing blocks. ;----------------------------------------------------------------------------- (defun Dwg_Blks: (LibTitle$ DefFile$ / Attribs$ AttribsList@ BlkList@ Block$   BlockLen# Option# Cnt# Dcl_Id% EOF Explode$ ExplodeList@ Field# FileName%   ImageName$ Item$ Layer$ LayerList@ Mid$ No_Blks# No_Pages# PathBlock$   PathFile$ Pg_No# Pick Point@ PointList@ Q$ Ref# Rep# ScaleList@ Scale~   SlideRef$ StartNo# Text$ UserPoint@ UserScale~   );variables   ;---------------------------------------------------------------------------   ; Get Lists from DefFile$.   ;---------------------------------------------------------------------------   (if (setq PathFile$ (findfile (strcat "C:\\Custom\\Blk_Sld\\" DefFile$)))   (setq FileName% (open PathFile$ "r"))   (progn       (GetOK (strcat LibTitle$ " Library")         (strcat DefFile$ " file not found.") "AlertX"       );GetOK       (exit)   );progn   );if   (setq Q$ "\"")   (setq EOF nil)(setq Item$ "")   (while (null EOF)   (setq Text$ (read-line FileName%))   (if Text$       (if (= (substr Text$ 1 1) Q$)         (progn         (setq StartNo# 2)         (setq Cnt# 1)         (setq Field# 1)         (while (and (
页: [1]
查看完整版本: list_box