wesleyaqua Posted March 10, 2014 Author Share Posted March 10, 2014 Sorry it is a bit difficult to understand what you're asking.What I'm trying to have you understand is that "key" is a way to link between the dcl and the lisp file. If a part of your DCL has a key "sld6text" , that is part of a ": text {" line, then I think it is establishing a naming convention- it's saying that this part of the DCL is meant to add text under "slide 6" in order to label it. That's how I would understand it at least. That means that there would be a Slide6, which would be an image_tile, but you're mentioning a list_box that is causing issues. Perhaps you should print out both your DCL and your LISP and then MATCH the KEYS of your lisp and DCL file, to make sure for each key there is either fully contained code for the key within the DCl or, that there is a KEY that is in the LISP and DCL.....hopefully that will help you. Once you've got your keys figured out you can process them better, that's my thinking at least. But again it's tough to understand the exact problem you're having because of the language used to describe it. HTH! yes i understand there is a problem with the language its hard to express myself specialy in this kind of technical way. i think this interacts with the dcl file. My problem here is i can't see a clear "sign" what generates the key and where it is called the key. in the whole lsp there isnt any sld1 and stuff. nor is there ; Load DCL dialog: Dwg_Blks in Blk_Lib.dcl ;------------------------------------------------------------------------- (princ "\nView Blocks ") (princ "\nSelect a block or option: ")(princ) (setq Dcl_Id% (load_dialog "Blk_Lib.dcl")) (while (/= Option# 1) (new_dialog "Dwg_Blks" Dcl_Id%) (if (= Pg_No# No_Pages#) (mode_tile "next" 1) (mode_tile "next" 0) );if (if (= Pg_No# 0) (mode_tile "previous" 1) (mode_tile "previous" 0) );if (if (> BlockLen# 19) (setq No_Blks# 20) (setq No_Blks# BlockLen#) );if (set_tile "title" (strcat " View Blocks " (itoa (+ Pg_No# 1)) " of " (itoa (+ No_Pages# 1))) );set_tile (action_tile "next" "(done_dialog 4)") (action_tile "previous" "(done_dialog 3)") (action_tile "cancel" "(done_dialog 2)") (setq Rep# 1) (repeat (fix No_Blks#) (action_tile (strcat "sld" (itoa Rep#)) "(setq SlideRef$ $key Pick t)" );action_tile (setq ImageName$ (nth (+ (* Pg_No# 20) (- Rep# 1)) BlkList@)) (start_image (strcat "sld" (itoa Rep#))) (slide_image 0 0 (dimx_tile (strcat "sld" (itoa Rep#))) (dimy_tile (strcat "sld" (itoa Rep#))) (strcat "C:\\Custom\\Blk_Sld\\" ImageName$ ".sld") );slide_image (end_image) (set_tile (strcat "sld" (itoa Rep#) "text") ImageName$ );set_tile (setq Rep# (1+ Rep#)) );repeat (setq Option# (start_dialog)) (if (= Option# 4);next (setq Pg_No# (1+ Pg_No#) BlockLen# (- BlockLen# 20) SlideRef$ nil );setq );if (if (= Option# 3);previous (setq Pg_No# (- Pg_No# 1) BlockLen# (+ BlockLen# 20) SlideRef$ nil );setq );if (if (= Option# 2);cancel (setq Option# 1 SlideRef$ nil );setq );if );while (unload_dialog Dcl_Id%) (if SlideRef$ (setq Ref# (- (+ (* Pg_No# 20) (atoi (substr SlideRef$ 4))) 1)) );if Ref# );defun View_Blks: maybe this is the key genarator. for the sld1text (set_tile (strcat "sld" (itoa Rep#) "text") ImageName$ );set_tile will this be my mapcar add list (strcat "sld" (itoa Rep#) "text") ImageName$) ? Quote Link to comment Share on other sites More sharing options...
Bhull1985 Posted March 10, 2014 Share Posted March 10, 2014 Unfortunately I can't tell what's what in the code you posted, my experience with DCL isn't as high as I would like it to be. Hopefully someone with a bit more knowledge will come and figure this out for you.... However, typically when using DCL to create a block library, there will be both of those items. Actually, all 3.....there should be slides (which are snap-shot images created by typing "MSLIDE" into autocad), there should be labels for the slides that are text. And there should be a list box in order to list all of the blocks , which are shown by the slides. That is how I remember "blib" lisp routine to work, but they are all synchronized....the list_box and the slides, when you select an item from the list_box, it updates the slide image... That is advanced stuff, I wish I knew it better so I could sort it out for you. BIGAL could perhaps be of assistance with the DCL/LISP problem if you were to reach out to him, perhaps.... (if not sorry for putting him out there like that, I just know he knows his dcl/lisp stuff!) Quote Link to comment Share on other sites More sharing options...
wesleyaqua Posted March 10, 2014 Author Share Posted March 10, 2014 Unfortunately I can't tell what's what in the code you posted, my experience with DCL isn't as high as I would like it to be.Hopefully someone with a bit more knowledge will come and figure this out for you.... However, typically when using DCL to create a block library, there will be both of those items. Actually, all 3.....there should be slides (which are snap-shot images created by typing "MSLIDE" into autocad), there should be labels for the slides that are text. And there should be a list box in order to list all of the blocks , which are shown by the slides. That is how I remember "blib" lisp routine to work, but they are all synchronized....the list_box and the slides, when you select an item from the list_box, it updates the slide image... That is advanced stuff, I wish I knew it better so I could sort it out for you. BIGAL could perhaps be of assistance with the DCL/LISP problem if you were to reach out to him, perhaps.... (if not sorry for putting him out there like that, I just know he knows his dcl/lisp stuff!) thougt it was very complex how he created it but thats probably why its a very good lsp. if he only created the list_box also. i think if it was a normal written lsp with dcl i would manage to understand it fast with not many help but for this one my first lsp almost i see its verry hard. also to explain myself in. i'm glad i managed to sort out how to get the list box in place . i'll wait a bid before contacting bigal, hopefully the writer of the lsp wil contact me again an help me with it. already thx for the help Quote Link to comment Share on other sites More sharing options...
Bhull1985 Posted March 10, 2014 Share Posted March 10, 2014 Youre very welcome! Quote Link to comment Share on other sites More sharing options...
wesleyaqua Posted March 24, 2014 Author Share Posted March 24, 2014 Youre very welcome! ; User_Lib [user Library] - Inserts blocks from Library with user options. ; Arguments: 3 ; LibTitle$ = Library title ; PathDef$ = Pathname and DefFile name for slides ; PathBlk$ = Pathname and DefFile name for blocks ; Returns: Inserts a block from Library. ;------------------------------------------------------------------------------- (defun User_Lib (LibTitle$ PathDef$ PathBlk$ / Attribs$ AttribsList@ BlkList@ BlkPath$ Block$ BlockLen# Cnt# Dcl_Id% DefFile$ DefPath$ EOF Explode$ ExplodeList@ Field# FileName% ImageName$ Item$ Layer$ LayerList@ Mid$ No_Blks# No_Pages# Old_error Option# Osmode PathBlock$ Pg_No# Pick Point@ PointList@ Q$ Ref# Rep# Scale~ ScaleList@ SlideRef$ StartNo# Text$ UserPoint@ UserScale~ );variables (setq Old_error *error* *error* *BL_error*) (setvar "ATTREQ" 0) (setvar "CMDECHO" 0) (setvar "REGENMODE" 1) ;----------------------------------------------------------------------------- ; Evaluate Arguments and get DefPath$ and DefFile$ variables. ;----------------------------------------------------------------------------- (if (null LibTitle$) (setq LibTitle$ "Block") );if (if (null PathDef$) (setq PathDef$ "C:\\Custom\\Blk_Lib\\Blk_Lib.def") );if (setq DefPath$ (car (GetPathFile PathDef$))) (setq DefFile$ (cadr (GetPathFile PathDef$))) (if (null PathBlk$) (setq PathBlk$ PathDef$) );if (setq BlkPath$ (car (GetPathFile PathBlk$))) (princ (strcat "\n" LibTitle$ " Library "))(princ) (Custom_Dirs LibTitle$ PathDef$ PathBlk$) ;----------------------------------------------------------------------------- ; Get Lists from PathDef$ file. ;----------------------------------------------------------------------------- (if (findfile PathDef$) (setq FileName% (open PathDef$ "r")) (progn (GetOK "Block Library" (strcat DefFile$ " file not found\nfor " LibTitle$ " Library.") "AlertX" );GetOK (exit) );progn );if (setq Q$ "\"") (setq Rep# 0) (setq EOF nil) (setq Item$ "") (while (null EOF) (setq Rep# (1+ Rep#)) (if (= Rep# 20) (progn (setq Rep# 0) (Whirl) );progn );if (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 (princ " ") (close FileName%) (setq No_Pages# (fix (/ (1- (length BlkList@)) 20.0)) Pg_No# 0 BlockLen# (length BlkList@) Option# 99 );setq ;----------------------------------------------------------------------------- ; Load DCL dialog: Dwg_Blks in Blk_Lib.dcl ;----------------------------------------------------------------------------- (princ "\nSelect a block or option: ")(princ) (setq Dcl_Id% (load_dialog "Blk_Lib.dcl")) (while (/= Option# 1) (new_dialog "Dwg_Blks" Dcl_Id%) (start_list "blocknameslist")(mapcar 'add_list blkList@)(end_list) (set_tile "title" (strcat " " LibTitle$ " Library " (itoa (+ Pg_No# 1)) " of " (itoa (+ No_Pages# 1))) );set_tile (if (= Pg_No# No_Pages#) (mode_tile "next" 1) (mode_tile "next" 0) );if (if (= Pg_No# 0) (mode_tile "previous" 1) (mode_tile "previous" 0) );if (if (> BlockLen# 19) (setq No_Blks# 20) (setq No_Blks# BlockLen#) );if (action_tile "next" "(done_dialog 4)") (action_tile "previous" "(done_dialog 3)") (action_tile "cancel" "(done_dialog 2)") (setq Rep# 1) (repeat (fix No_Blks#) (action_tile (strcat "sld" (itoa Rep#)) "(setq SlideRef$ $key Pick t)") (setq ImageName$ (nth (+ (* Pg_No# 20) (- Rep# 1)) BlkList@)) (start_image (strcat "sld" (itoa Rep#))) (slide_image 0 0 (dimx_tile (strcat "sld" (itoa Rep#))) (dimy_tile (strcat "sld" (itoa Rep#))) (strcat DefPath$ ImageName$ ".sld") );slide_image (end_image) (set_tile (strcat "sld" (itoa Rep#) "text") ImageName$ );set_tile (setq Rep# (1+ Rep#)) );repeat (setq Option# (start_dialog)) (if (= Option# 4);next (setq Pg_No# (1+ Pg_No#) BlockLen# (- BlockLen# 20) SlideRef$ nil );setq );if (if (= Option# 3);previous (setq Pg_No# (- Pg_No# 1) BlockLen# (+ BlockLen# 20) SlideRef$ nil );setq );if (if (= Option# 2);cancel (setq Option# 1 SlideRef$ nil );setq );if );while (unload_dialog Dcl_Id%) (if (and SlideRef$ Pick) (progn (setq Ref# (- (+ (* Pg_No# 20) (atoi (substr SlideRef$ 4))) 1)) (setq Block$ (nth Ref# BlkList@) Layer$ (nth Ref# LayerList@) Point@ (nth Ref# PointList@) Scale~ (nth Ref# ScaleList@) Explode$ (nth Ref# ExplodeList@) Attribs$ (nth Ref# AttribsList@) );setq (setq PathBlock$ (strcat BlkPath$ Block$ ".dwg")) (if (or (= Block$ " ") (not (findfile PathBlock$))) (progn (if (/= Block$ " ") (GetOK (strcat LibTitle$ " Library") (strcat PathBlock$ "\nblock not found.") "AlertX" );GetOK );if (exit) );progn );if (if (= Point@ "Lower left limits") (setq Point@ (getvar "LIMMIN")) );if (if (= Point@ "Lower right limits") (setq Point@ (list (car (getvar "LIMMAX")) (cadr (getvar "LIMMIN")))) );if (if (= Point@ "Upper left limits") (setq Point@ (list (car (getvar "LIMMIN")) (cadr (getvar "LIMMAX")))) );if (if (= Point@ "Upper right limits") (setq Point@ (getvar "LIMMAX")) );if (if (and (= Point@ "User selects") (/= Scale~ "User selects")) (progn (while (null UserPoint@) (setq UserPoint@ (getpoint (strcat "\nInsertion point for " Block$ " block: ")) );setq );while (setq Point@ UserPoint@) );progn );if (if (/= Point@ "User selects") (progn (if (= (type Point@) 'STR) (setq Point@ (RealList Point@)) );if (if (/= (type Point@) 'LIST) (progn (GetOK (strcat LibTitle$ " Library") (strcat "Invalid insertion point for " Block$ "\nblock in " DefFile$ " file.") "AlertX" );GetOK (exit) );progn );if );progn );if (if (= Scale~ "Dim scale") (if (= (getvar "DIMSCALE") 0) (progn (GetOK (strcat LibTitle$ " Library") "DIMSCALE value must be greater than 0." "AlertX" );GetOK (exit) );progn (setq Scale~ (getvar "DIMSCALE")) );if );if (if (and (= Scale~ "User selects") (/= Point@ "User selects")) (progn (while (or (null UserScale~) (< UserScale~ 0)) (setq UserScale~ (getreal (strcat "\nScale factor for " Block$ " block <1>: ") );getreal );setq (if (null UserScale~) (setq UserScale~ 1.0) );if (if (<= UserScale~ 0) (princ "\nScale factor must be greater than 0.")(princ) );if );while (setq Scale~ (rtosr UserScale~)) );progn );if (if (/= Scale~ "User selects") (progn (if (= (type Scale~) 'STR) (setq Scale~ (atof Scale~)) );if (if (<= Scale~ 0) (progn (GetOK (strcat LibTitle$ " Library") (strcat "Invalid scale factor for " Block$ "\nblock in " DefFile$ " file.") "AlertX" );GetOK (exit) );progn );if );progn );if (setq Osmode (getvar "OSMODE")) (setvar "OSMODE" 0);None (if (= Explode$ "1");Yes (progn (setq PathBlock$ (strcat "*" BlkPath$ Block$)) (if (and (= Point@ "User selects") (= Scale~ "User selects")) (command ".INSERT" PathBlock$) (command ".INSERT" PathBlock$ Point@ Scale~) );if );progn (progn (setq PathBlock$ (strcat BlkPath$ Block$)) (if (/= Layer$ "Current layer") (if (tblsearch "LAYER" Layer$) (command ".LAYER" "T" Layer$ "U" Layer$ "ON" Layer$ "S" Layer$ "") (command ".LAYER" "M" Layer$ "") );if );if (if (and (= Point@ "User selects") (= Scale~ "User selects")) (progn (command ".INSERT" PathBlock$) );progn (command ".INSERT" PathBlock$ Point@ Scale~ "") );if );progn );if (setvar "OSMODE" Osmode) );progn );if (setq *error* Old_error) (princ) );defun User_Lib have fount the solution almost for the list box i was adding it at the wrong part of the program. now i have a list of names at the left side and at the right the pictures with the also a the same name under it. is there a way to lay a connection between the left and right side so i can choose where to select but always insert the right block. now i select the left side and i don't get a block insert. Quote Link to comment Share on other sites More sharing options...
Terry Cadd Posted April 19, 2020 Share Posted April 19, 2020 The website http://web2.airmail.net/terrycad that hosted AutoLISP Exchange, Blk_Lib and Getting Started with DCL Dialogs has been moved to the new domain https://autolisp-exchange.com . All programs and files are free to download and share. Just click on a button to view the program, then right-click and choose Save as... Quote Link to comment Share on other sites More sharing options...
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.