wesleyaqua Posted March 6, 2014 Posted March 6, 2014 (edited) 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 [Drawing Blocks] - 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_Blks so 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 Edited March 6, 2014 by wesleyaqua Quote
MSasu Posted March 6, 2014 Posted March 6, 2014 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. Quote
wesleyaqua Posted March 6, 2014 Author Posted March 6, 2014 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. 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 Quote
Jef! Posted March 6, 2014 Posted March 6, 2014 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 Quote
wesleyaqua Posted March 7, 2014 Author Posted March 7, 2014 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 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 (<= Cnt# (strlen Text$)) (< Field# 6)) (setq Mid$ (substr Text$ Cnt# 3)) (if (= Mid$ "\",\"") (progn (setq Item$ (substr Text$ StartNo# (- Cnt# StartNo#)) );setq (cond ((= Field# 1) (if BlkList@ (setq BlkList@ (append BlkList@ (list Item$))) (setq BlkList@ (list Item$)) );if );Field# 1 ((= Field# 2) (if LayerList@ (setq LayerList@ (append LayerList@ (list Item$))) (setq LayerList@ (list Item$)) );if );Field# 2 ((= Field# 3) (if PointList@ (setq PointList@ (append PointList@ (list Item$))) (setq PointList@ (list Item$)) );if );Field# 3 ((= Field# 4) (if ScaleList@ (setq ScaleList@ (append ScaleList@ (list Item$))) (setq ScaleList@ (list Item$)) );if );Field# 4 ((= Field# 5) (if ExplodeList@ (setq ExplodeList@ (append ExplodeList@ (list Item$))) (setq ExplodeList@ (list Item$)) );if );Field# 5 (t (exit)) );cond (setq Field# (1+ Field#)) (setq StartNo# (+ Cnt# 3)) );progn );if (setq Cnt# (1+ Cnt#)) );while (setq Item$ (substr Text$ StartNo# (- (strlen Text$) StartNo#)) );setq (if AttribsList@ (setq AttribsList@ (append AttribsList@ (list Item$))) (setq AttribsList@ (list Item$)) );if );progn );if (setq EOF t) );if );while (close FileName%) (setq No_Pages# (fix (/ (1- (length BlkList@)) 20.0)) Pg_No# 0 BlockLen# (length BlkList@) Option# 99 );setq i found this part some further in the Lsp file i think the (start_list "block")(mapcar 'add_list BlkList@)(end_list) (set_tile "block" nthBlkList$) is the one i could use ;--------------------------------------------------------------------------- ; Load DCL dialog: Blk_Mgr in Blk_Lib.dcl ;--------------------------------------------------------------------------- (setq Dcl_Id% (load_dialog "Blk_Lib.dcl")) (setq Option# 99) (while (/= Option# 1) (new_dialog "Blk_Mgr" Dcl_Id%) (set_tile "title" (strcat " " LibTitle$ " Library Manager")) (start_list "block")(mapcar 'add_list BlkList@)(end_list) (set_tile "block" nthBlkList$) (start_list "point")(mapcar 'add_list PntList@)(end_list) (set_tile "point" nthPntList$) (start_list "layer")(mapcar 'add_list LayList@)(end_list) (set_tile "layer" nthLayList$) (start_list "scale")(mapcar 'add_list ScaList@)(end_list) (set_tile "scale" nthScaList$) (set_tile "explode" Explode$) (set_tile "dot" Dot$) (start_image "blocksld") (slide_image 0 0 (dimx_tile "blocksld") (dimy_tile "blocksld") (strcat "C:\\Custom\\Blk_Sld\\" Block$ ".sld") );slide_image (end_image) (action_tile "block" "(BlockSub:)") (action_tile "point" "(PointSub:)") (action_tile "layer" "(LayerSub:)") (action_tile "scale" "(ScaleSub:)") (action_tile "explode" "(ExplodeSub:)") (action_tile "viewblk" "(done_dialog 5)") (action_tile "dot" "(DotSub:)") (action_tile "addlib" "(done_dialog 4)") (action_tile "editlib" "(done_dialog 3)") (action_tile "cancel" "(done_dialog 2)") (setq Option# (start_dialog)) (setq *Blk_Mgr@ (list Block$ Layer$ Point$ Scale$ Explode$ Dot$)) (if (= Option# 5);viewblk (progn (ViewBlkSub:) (setq Option# 99) );progn );if (if (= Option# 4);addlib (progn (AddLibSub:) (setq Option# 1) );progn );if (if (= Option# 3);editlib (setq Option# 1 MslideList@ nil EditLib$ "Yes" );setq );if (if (= Option# 2);cancel (setq Option# 1 MslideList@ nil );setq );if );while (unload_dialog Dcl_Id%) MslideList@ );defun BlockMgr: but what do i need to copy to the other part cause it doesn't work what i tried Quote
Recommended Posts
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.