Search the Community
Showing results for tags 'dcl'.
-
Hi to all, I need a basic instructions to try to learn with DCL files!... 1 - How I can show a preview of a image in a chosen item in one toggle button, I have 3 toggles to select, when one of them is chosen it will show a preview of the image (the image is a block inside of dwg file); 2 - Chose, how I can start a Dialog with one item selected (the variable [value = "1"], only fill a image as selected item, but don't select it. Thanks in advance to any help.
- 38 replies
-
Dynamically Generated .DCL file issues
ericjlarson-metopera posted a topic in AutoLISP, Visual LISP & DCL
Hi Everyone, I've been lurking here for over a year now and have found lots of useful information (thanks!), but I've finally done something that doesn't seem to have been solved before, and that there may be no easy answer to. We use a complicated system of layer states, views, and freezing and unfreezing layers to set up different print states to create a package of drawings. It is sort of a wacky use of AutoCAD, but this is due to the necessity of showing an opera as it progresses through time (Act 1, Act 2, etc.). We have hundreds of operas in our repertory and this won't be changing anytime soon. Anyway, as it stands now, there is a .txt file that lives in the same directory as the file containing the scenery that is manually created so that print scripts can work. I am attempting to turn that .txt file into something that lives in a dialog box for ease of use and cleanliness. The data will be stored in a mulitline attribute in a block. I've spent a fair amount of time creating a dialog box that changes size dynamically, allows for reordering of printouts and having multiple scenery layers appear on the same printout. My only real issue (which is of course a big one) is that if you add too many rows, the dialog box becomes too big to fit on the screen. What I would love to be able to do is to make the whole box (except the buttons at the bottom) scroll up and down so that the height of the dialog box is fixed to the smallest screen we use here (~800 pixels). I've spent a little time with OpenDCL but find it a bit byzantine, and I don't know any .NET or VBA so either of those solutions will involve me learning some new programming languages--not necessarily a deal breaker but not ideal either. I'm attaching a .dwg with the attributed block and the .lsp file for anyone who wants to take a look. The command c:met_plot_2015 will create and open the dialog box, which you can then manipulate. I appreciate anyone who read to the end of this post, and any help you can provide. Thanks, Eric P.S. The printing function doesn't actually work yet; that's next on the list once I solve this. specialblock.dwg BETTERPRINTING 5.LSP -
Hello Everyone, I am trying to work on DCL program for my coworker and I. I went through the tutorials by Kenny on Afralisp but I am stuck. My DCL keeps freezing. I tried checking it in Visual Lisp Editor and I couldn't figure it out. If anyone has any suggestions on DCL resources. I want to write a larger program for generating detail sheets for company but have a lot to learn. Is there a better way to write interfaces than DCL? ;;;;Original Code by by Kenny Ramage (defun C:PL_TRADE_SELECT () ;define function (setq PL_FILE (findfile "PL_WEIGHT.DAT")) (setq CODE_CHOICE "2007 OPA") ; (setq CODES "*COV_CODES") ; (list_find PL_FILE CODES) ; (setq CODE_LIST FIND_RESULT) ; (setq FIND_RESULT nil) ; (setq CODE_LIST_MOD (COMMA_PULL CODE_LIST "STRING")) (setq CODE_LIST_MOD '("1998 CBC" "2003 IBC" "2007 OPA")) ; (setq dcl_id (load_dialog "PL_TRADE_SELECT.dcl")) ;load dialog (if (not (new_dialog "PL_TRADE_SELECT" dcl_id) ;test for dialog );not (exit) ;exit if no dialog );if (setq w (dimx_tile "im") ;get image tile width h (dimy_tile "im") ;get image tile height );setq (start_image "im") ;start the image (fill_image 0 0 w h 5) ;fill it with blue (end_image) ;end image (start_list "CODE_CHOICES") ;start the list box (mapcar 'add_list CODE_LIST_MOD) ;fill the list box (end_list) ;end list (action_tile "PU" "(setq PL_TYPE \"PU\")") ;store point load type (action_tile "MP" "(setq PL_TYPE \"MP\")") ;store point load type (action_tile "HV" "(setq PL_TYPE \"HV\")") ;store point load type (action_tile "EL" "(setq PL_TYPE \"EL\")") ;store point load type (action_tile "cancel" ;if cancel button pressed "(done_dialog) (setq userclick nil)" ;close dialog, set flag );action_tile (action_tile "accept" ;if O.K. pressed (strcat ;string 'em together "(progn (setq CODE_CHOICE (atof (get_tile \"CODE_CHOICES\")))" ;get list selection " (done_dialog)(setq userclick T))" ;close dialog, set flag );strcat );action tile (start_dialog) ;start dialog (unload_dialog dcl_id) ;unload (if userclick ;check O.K. was selected (progn (setq CODE_CHOICE (fix CODE_CHOICE)) ;convert to integer (setq CODE_CHOICE (nth CODE_CHOICE CODE_LIST_MOD)) ;get the size );progn );if userclick (princ) );defun C:PL_TRADE_SELECT (princ) And the DCL... PL_TRADE_SELECT : dialog { //dialog name label = "Point Load Trade Selection" ; //give it a label :boxed_radio_column { //define radio column label = "&Code" ; //give it a label : popup_list { //define popup list key = "CODE_CHOICES"; //give it a name value = "2007 OPA" ; //initial value } //end list } :boxed_radio_column { //define radio column label = "Trade" ; //give it a label : radio_button { //define radion button key = "PU" ; //give it a name label = "&Plumbing" ; //give ]it a label value = "1" ; //switch it on } //end definition : radio_button { //define radio button key = "MP" ; //give it a name label = "&Mechancical Pipe" ; //give it a label } //end definition : radio_button { //define radio button key = "HV" ; //give it a name label = "&HVAC" ; //give it a label } //end definition : radio_button { //define radio button key = "EL" ; //give it a name label = "&Electrical" ; //give it a label } //end definition } //end radio column ok_cancel ; //predifined OK/Cancel : row { //define row : image { //define image tile key = "im" ; //give it a name height = 1.0 ; //and a height width = 1.0 ; //and now a width } //end image : paragraph { //define paragraph : text_part { //define text label = "Message 1"; //give it some text } //end text : text_part { //define more text label = "Message 2"; //some more text } //end text } //end paragraph } //end row }
-
How to fix Block thumbnail preview in dialog box of a custom program
shailujp posted a topic in AutoLISP, Visual LISP & DCL
I have made updates to an old library block (file) and saved my changes. We have a custom menu, custom program and dialog box shows all different blocks to choose from and I frequently use it. The inserted block shows updates correctly but wont change the thumbnail preview inside the dialog box. Its not an attribute block or a dynamic block. Is there anyway to resolve the preview issue? -
Do you need a separate .dcl file to load each dialog box?
-
I have 2 questions about a dialog box I wrote. 1. The drop down boxes aren’t wide enough to display all of the text. How do I fix this? 2. Currently in order to select a second line in the list box you have to hold down the shift key. How can I change it so that the selections remain selected without holding down the control key? The command that luanches the dcl (defun c:bprint ( / ) (setq retlist1 nil) ;;; lm:directorydialog ;;; Author: Lee Mac, Copyright © 2013 - www.lee-mac.com ;;; (setq thedirectory (lm:directorydialog "Select folder: " nil 0)) (if (/= thedirectory nil) (setq List1 (vl-directory-files thedirectory "*.dwg")) end ) (setq List2 (list "")) (batch thedirectory List1 List2) (if (/= retlist1 nil) (progn (if (/= (findfile "BPlotData.txt") nil) (setq filedata (readfile (findfile "BPlotData.txt") ) files (cdr filedata) batchplotfiles (list ) ) ) (foreach file files (setq batchplotfiles (append batchplotfiles (list (strcat "open \"" thedirectory "\\" file "\" (mybatchprint) ZOOM E close Y") ) ) ) ) (makefile (strcat (strcat "C:\\Users\\" (getvar "loginname") "\\Documents") "\\" "BatchPlot.scr" ) batchplotfiles ) (command "_.script" (strcat "C:\\Users\\" (getvar "loginname") "\\Documents\\BatchPlot.scr") ) ) ) ) The function the runs the dcl (defun batch ( mydir lista listb / prin ) (setq dir mydir poplist1 (list ) mylist1 lista mylist2 listb ) (setq poplist1 (getplotters) poplist2 (getplotstyles) ) (if (not (setq dcl_id (load_dialog "batch.dcl"))) (progn (alert "The DCL file could not be loaded!") (exit) ) (progn (if (not (new_dialog "batch" dcl_id)) (progn (alert "The BATCH definition could not be loaded!") (exit) ) (progn (start_list "poplist1" 3) (mapcar 'add_list poplist1) (end_list) (start_list "poplist2" 3) (mapcar 'add_list poplist2) (end_list) (start_list "mylist1" 3) (mapcar 'add_list mylist1) (end_list) (action_tile "pickdir" " (setq pickdir \"Yes\")(done_dialog 1)") (action_tile "accept" "(saveVars)(done_dialog 2)") (action_tile "cancel" "(done_dialog 3)") (setq ddiag (start_dialog)) (unload_dialog dcl_id) (if (= ddiag 1) (princ "\nSelect directory . . . ") ) (if (= ddiag 2) (princ "\nPlease wait. . . ") ) (if (= ddiag 3) (princ "\nBatch print has been cancelled! ") ) ) ) ) ) (princ) ) The DLC code batch : dialog { : boxed_column { : row { : popup_list { label ="Choose printer"; key = "poplist1"; height = 15; width = 30; multiple_select = true; fixed_width_font = true; value = "0"; } } : row { : popup_list { label ="Choose plot style table"; key = "poplist2"; height = 15; width = 30; multiple_select = true; fixed_width_font = true; value = "0"; } } : list_box { label ="Choose Item"; key = "mylist1"; height = 15; width = 25; multiple_select = true; fixed_width_font = true; value = ""; } : row { : button { key = "accept"; label = " Print "; is_default = true; } : button { key = "cancel"; label = " Cancel "; is_default = false; is_cancel = true; } } } }
-
Dear friends, I would like to learn how to apply a edit_box imput rules. For example, if you only want to accept a number with the following format: 888.8.88 How do I impose this rule? Thank you, and sorry for my bad English.
-
Please I need your help. I have a DCL with 3 columns with 8 Radio Buttons in each column. I wanted the switch could only be done in only one of 24 Radio Buttons. What do I have to change? Attached files. Thanks for the help. Greetings. samp5.dcl samp5.lsp
-
I am trying to write a routine that allows users to input items and weights in a dialog box, and outputs a formatted MText (among other things). I allow the user to input up to 10 items, but I only want the MText to use the values that are filled in. Here's what my dialog box looks like: And here's what my output looks like: Here's my code for the Mtext: (setq val (strcat "\\pxtr18,c20,r30;\t" eq1 "\t=\t" wt1 " LB \\P\t" eq2 "\t=\t" wt2 " LB \\P\t" eq3 "\t=\t" wt3 " LB \\P\t" eq4 "\t=\t" wt4 " LB \\P\t" eq5 "\t=\t" wt5 " LB \\P\t" eq6 "\t=\t" wt6 " LB \\P\t" eq7 "\t=\t" wt7 " LB \\P\t" eq8 "\t=\t" wt8 " LB \\P\t" eq9 "\t=\t" wt9 " LB \\P\t" eq10 "\t=\t" wt10 " LB" )) (entmake (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt1) (cons 1 val) (cons 8 "NOTES") (cons 40 0.09375) (cons 7 "ROMANS") (cons 41 4))) Any suggestions how to make it ignore the "0" values? Thanks in advance!
-
I have started to attempt to learn DCL and am currently using VLIDE as code editor. But when I write a DCL code and click "Format edit window" it returns an error: If I execute the code it runs just fine ("Preview DCL in editor" works, too), but I can't get it to organize my text. Doesn't it work at all or am I the only one having difficulties? I have been searching this since yesterday and have found not a single person mentioning it, which means either one of two things: no one has ever had this problem before or it is so simple to solve that no one ever needed to ask in internet forums. Hope I'm not asking a stupid question here This is an example of code I am trying to format (copied from a DCL tutorial by Jeff Sanders): EXAMPLE : dialog { label = "EXAMPLE.lsp"; : column { : boxed_column { label = "column 1"; : boxed_column { label = "column2"; } : boxed_column { label = "column 3"; } } ok_cancel; } } Thank you all in advance! Felipe
- 1 reply
-
- symbol
- formatting
-
(and 3 more)
Tagged with:
-
OK LISP Masters! I have this one ALMOST where I need it. (some of the functions are still incomplete, but I know how to get those to work). Here is what this lisp is supposed to do. You are presented with a dialog box with options for device type, and other device options, then based on your options, it inserts a block, adds your other picked options, then keeps going. When you right click, the dialog should return, letting you pick different options, so you can insert different blocks. I have the whole thing working, EXCEPT for the "right click to return the dialog". Can anyone please help? (defun c:notif(/ :dlgId :done);new combined notification (setq CVR (getvar "useri2") SCL (GETVAR "userr1") lyr (getvar "clayer") osm (getvar "osmode") ) (if (= 0 scl)(command (alert "Please Set your scale and try agagin")(exit))) (COMMAND "OSMODE" "514") (COMMAND "-LAYER" "s" "F-ALRM-INDC" "") (setq :dlgId (load_dialog "notif.dcl")) (setq :done 3) (while (/= :done 0) (if (not (new_dialog "DLG_Notif" :dlgId)) (exit) ) (action_tile "devStrobe" "(setq dev 1)") (action_tile "devHRNStrobe" "(setq dev 2)") (action_tile "devSPKStrobe" "(setq dev 3)") (action_tile "devHorn" "(setq dev 4)") (action_tile "devSpeaker" "(setq dev 5)") (action_tile "mtWall" "(setq mt 1)") (action_tile "mtCeil" "(setq mt 2)") (action_tile "cd15" "(setq cd 15)") (action_tile "cd30" "(setq cd 30)") (action_tile "cd75" "(setq cd 75)") (action_tile "cd95" "(setq cd 95)") (action_tile "cd110" "(setq cd 110)") (action_tile "cd135" "(setq cd 135)") (action_tile "cd177" "(setq cd 177)") (action_tile "cd185" "(setq cd 185)") (action_tile "wat25" "(setq wat 4)") (action_tile "wat5" "(setq wat 5)") (action_tile "wat1" "(setq wat 1)") (action_tile "wat2" "(setq wat 2)") (action_tile "wat75" "(setq wat 7)") (action_tile "lensClear" "(setq lens 1)") (action_tile "lensAmber" "(setq lens 2)") (action_tile "lensCombo" "(setq lens 3)") (action_tile "spcWP" "(setq wp 1)") (action_tile "spcWG" "(setq wg 1)") (action_tile "accept" "(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (setq :done (start_dialog)) (cond ((= :done 1) (setvar "cmdecho" 0) (if (= wat 4)(setq watt ".25W")) (if (= wat 5)(setq watt ".5W")) (if (= wat 1)(setq watt "1W")) (if (= wat 2)(setq watt "2W")) (if (= wat 7)(setq watt "7.5W")) (setq :txting 0) (while (= 0 :txting) (initget 0) (if (= dev 1) (progn (COMMAND "_.-INSERT" "FA_STROBE_ONLYW" pause SCL "" pause CD) (setq :txting 0))(setq :txting 1)) (if (= dev 2) (COMMAND "_.-INSERT" "FA_Hornstrobe" pause SCL "" pause CD)) (if (= dev 3) (COMMAND "_.-INSERT" "FA_Speakerstrobe" pause SCL "" pause CD watt)) ) (setvar "cmdecho" 1) );done ((= :done 0) (prompt "\nEnd notification command.") ) );cond ; (if (= 1 cvr)(command "-layer" "s" "F-STRB-COVR" "")) ; (setq elast (entlast)) ; (IF (= 1 CVR)(command "_.-insert" "sg-15cd" "_non" ; (cdr (assoc 10 (entget elast))) "1" "" (* 180. (/ (cdr (assoc 50 (entget elast))) pi)))) ); while (unload_dialog :dlgId) (COMMAND "CLAYER" LYR) (COMMAND "OSMODE" OSM) (princ) ) I also have the LISP and DCL files attached. NOTIF.LSP notif.dcl
-
Hello All, I tried to solve a problem lisp and DCL but it is clear that I have a lot to learn. With lisp's trying to insert text in Autocad list opens (see DCL). Any help is welcome. Dialog Text.zip
- 1 reply
-
- insert
- dialog box
-
(and 2 more)
Tagged with:
-
Hello All, In trying to learn LISP and DCL (http://www.afralisp.net/dialog-control-language/tutorials/dialog-boxes-and-autolisp-part-2.php) I have a question regarding the attached example: selected values can be inserted into the drawing (see attached dwg and jpg's site)? Best Regards All. Samp5.zip
-
I've posted an earlier version of this in the past, but decided to update the code and provide a proper write-up. Designed as a bit of fun, the program will allow you to create your own custom Tip of the Day messages, which will be randomly selected and displayed once each day. Whether it's used to constructively provide help for AutoCAD users, or merely provide a funny message for each day - I leave it up to you Have fun with it! Lee Code is available here - if you have any questions about how to set it up, let me know.
-
Hello everyone. I'm hoping one of you LISP geniuses can help me out. I dont know a whole lot about Lisp, but I think my question would be pretty simple for someone with a good LISP knowledge to figure out quite fast. I have attached a LISP and a DCL. Everything is working properly on it except for one thing. There are two checkboxes on the right of the dialogue box, one says EOL, and the other says Amber CKT. What I would like the lisp to do is, when one of the check boxes is checked, to add a fixed suffix onto the text string that the program is already building. They need to add these suffixes: EOL - "(EOL)" Amber - "A" Like I said, I think this would be pretty easy for somone who has experience writing LISP. If anyone can help me out I would greatly appreciate it! map.zip