mhy3sx Posted Saturday at 08:41 AM Posted Saturday at 08:41 AM Hi. I have this set scale lisp. I realized that the option to set "other" Scale not working now. Can any one knows why? (defun c:SETSC (/ *error* dch dcl des sng sngReturn cursc newsc) (defun *error* (msg) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) ) (princ (strcat "\nError: " msg)) ) (princ) ) (setvar "OSMODE" 13) (setq cursc (getvar "useri1")) (cond ((not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ((progn (foreach str '( "ed : edit_box { alignment = left; width = 25; edit_width = 10; fixed_width = true;}" "" "setscale : dialog { spacer; key = \"dcl\";" " : boxed_radio_column { key=\042key\042; label = \"S c a l e\"; height = 1.0;" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button01\"; label = \"1 : 50\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button02\"; label = \"1 : 100\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button03\"; label = \"1 : 200\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button04\"; label = \"1 : 250\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button05\"; label = \"1 : 500\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button06\"; label = \"1 : 2000\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button07\"; label = \"1 : 2500\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button08\"; label = \"1 : 5000\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button09\"; label = \"1 : 10000\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button10\"; label = \"1 : 20000\";" " }" " : ed {height = 1.0; width = 25; is_tab_stop = true;" " key = \"other\"; label = \"Other Scale 1 :\";" " }" " : ed {height = 1.0; width = 25; is_enabled = false;" " key = \"oldscale\"; label = \"ΟThe set scale is 1 :\";" " }" " }" " ok_only;" " }" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ((not (new_dialog "setscale" dch)) (princ "\nUnable to display 'setscale' dialog.") ) (t (set_tile "dcl" "Set the drawing Scale") (set_tile "oldscale" (itoa cursc)) ; set the old scale in the dialog box (action_tile "other" "(progn (setq sng \"other\") (setq sngReturn (atoi $value)))") (action_tile "key" "(setq sng $value)") (action_tile "OK" "(done_dialog 1)") (start_dialog) (if (setq sngReturn (cond ( (eq sng "radio_button01") 50 ) ( (eq sng "radio_button02") 100 ) ( (eq sng "radio_button03") 200 ) ( (eq sng "radio_button04") 250 ) ( (eq sng "radio_button05") 500 ) ( (eq sng "radio_button06") 2000 ) ( (eq sng "radio_button07") 2500 ) ( (eq sng "radio_button08") 5000 ) ( (eq sng "radio_button09") 10000 ) ( (eq sng "radio_button10") 20000 ) ( (eq sng "other") sngReturn) ( (eq sng "oldscale") cursc) ) ) (progn (princ "\nThe drawing scale set 1 : ")(princ sngReturn) (setvar "useri1" sngReturn) ) ) ) ) (*error* nil) ) Thanks Quote
mhy3sx Posted Saturday at 05:24 PM Author Posted Saturday at 05:24 PM Can anyone tell me if is any error in this lines of the code? (action_tile "other" "(progn (setq sng \"other\") (setq sngReturn (atoi $value)))") and (setq sngReturn (cond ....code..... ((eq sng "other") sngReturn) ......code......... ) ) Because when I try to set scale in "other" nothing happens, no scale set. Thanks Quote
mhy3sx Posted Saturday at 09:26 PM Author Posted Saturday at 09:26 PM Hi GLAVCVS. The DCL load perfect and the scales in radio buttons work perfect too. Only the "other" not working. Any ideas Thanks Quote
mhy3sx Posted Saturday at 09:39 PM Author Posted Saturday at 09:39 PM (edited) OK. I update the code to " : edit_box { height = 1.0; width = 25; is_tab_stop = true;" " key = \"other\"; label = \"Other Scale 1 :\";" " }" " : edit_box { height = 1.0; width = 25; is_enabled = false;" " key = \"oldscale\"; label = \"The set scale is 1 :\";" " }" But nothing change. Thanks Edited Saturday at 09:44 PM by mhy3sx Quote
GLAVCVS Posted Saturday at 11:18 PM Posted Saturday at 11:18 PM The 'edit_box' does not generate an event when editing in AutoCAD. To get the content of the edit_box you must do it when leaving the box, after pressing the accept button. You could do that like this: (action_tile "accept" "(if (wcmatch (setq custSc (get_tile \"other\")) \"#,##,###,####,#####\") (progn (setq sng \"other\") (setq sngReturn (atoi custSc))))") 1 Quote
BIGAL Posted Sunday at 05:52 AM Posted Sunday at 05:52 AM I have posted this many times you can make the dcl code and get an answer with like 4 lines of code. Have a look at examples in top of code. Something like this is displayed. Anyway I dont think this line is correct. "ed : edit_box { alignment = left; width = 25; edit_width = 10; fixed_width = true;}" I would use :boxed_column Quote
betterway Posted yesterday at 12:52 AM Posted yesterday at 12:52 AM Hello mhy3sx, I am looking to write a similar lisp file but with Imperial scales. I tried your coding and the dialog box worked great except when I pick from the list of scales and press "ok". Received the message that the scale was changed but actually did not change. Am I missing something, like adding a command line to zoom 1/200xp ? Thanks ! Quote
BIGAL Posted yesterday at 06:46 AM Posted yesterday at 06:46 AM The lisp is just a program for choosing it would replace your dcl code. I use something like this and the "Yes" or "No" would be returned in variable ans. Note the 1 is 1st button as defualt, the 'H"or "h" is horizontal dcl, for your scaes use "v" (setq ans (ah:butts 1 "h" '("Yes or No" "Yes" "No"))) Then use a cond comparing ans to then set your sclaeXP. Metric or imperial is ok as you set the scXP correct. Quote
betterway Posted 22 hours ago Posted 22 hours ago Added the command line to zoom scXP and it worked ! Was not able to use a variable for the zoom command so used if-statements to enter the text needed for each scale. Quote
BIGAL Posted 16 hours ago Posted 16 hours ago Glad you got it working, a good idea is post code so we my help improve it. Quote
betterway Posted 7 hours ago Posted 7 hours ago Attached is the latest working file. One improvement would be to have the scales read with the proper feet and inch symbols. Had trouble with the syntax. For example, for scale 6 ... would be better to read as 6" = 1'-0". Keep in mind I am still a newbie to lisp, but usually can figure things out enough to get results. Any suggestions are welcome. SETSC.lsp 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.