CAD_Noob Posted June 30, 2022 Author Posted June 30, 2022 4 minutes ago, mhupp said: look to see where your temp files are being made. run the command but don't pick anything their will be a temp .dcl file there. nm ill just convert it for you. give me a sec. Thank you so much! Quote
mhupp Posted June 30, 2022 Posted June 30, 2022 (edited) little help from a dragon (defun c:foo (/ n) ;;(or (setq n (getint "\nEnter percent:<30>")) (setq n 30)) (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line "AHbutts : dialog \t{" fo) (write-line " label =\"Choose revision\" ;" fo) (write-line " : row\t{" fo) (write-line " : boxed_radio_row\t{" fo) (write-line " : radio_button\t{" fo) (write-line " key = \"Rb1\";" fo) (write-line " label = \"30%\";" fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " : radio_button\t{" fo) (write-line " key = \"Rb2\";" fo) (write-line " label = \"60%\";" fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " : radio_button\t{" fo) (write-line " key = \"Rb3\";" fo) (write-line " label = \"90%\";" fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " } " fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " ok_only;" fo) (write-line "}" fo) (close fo) (setq dcl_id (load_dialog fn)) (new_dialog "AHbutts" dcl_id) (set_tile "Rb1" "1") (action_tile "Rb1" "(setq n \"30%\")(done_dialog)") (action_tile "Rb2" "(setq n \"60%\")(done_dialog)") (action_tile "Rb3" "(setq n \"90%\")(done_dialog)") (action_tile "accept" "(setq n \"30%\")(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete fn) (foreach l '( "TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review") (vl-catch-all-apply 'vla-put-freeze (list (vlax-ename->vla-object (tblobjname "layer" l)) (if (wcmatch l (strcat "*" n "*")) 0 -1 ) ) ) ) (command "_.regen") (princ) ) Edited June 30, 2022 by mhupp updated code 2 Quote
CAD_Noob Posted June 30, 2022 Author Posted June 30, 2022 5 minutes ago, mhupp said: (defun c:foo (/ n) ;;(or (setq n (getint "\nEnter percent:<30>")) (setq n 30)) (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line "AHbutts : dialog \t{" fo) (write-line " label =\"Choose revision\" ;" fo) (write-line " : row\t{" fo) (write-line " : boxed_radio_row\t{" fo) (write-line " : radio_button\t{" fo) (write-line " key = \"Rb1\";" fo) (write-line " label = \"30%\";" fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " : radio_button\t{" fo) (write-line " key = \"Rb2\";" fo) (write-line " label = \"60%\";" fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " : radio_button\t{" fo) (write-line " key = \"Rb3\";" fo) (write-line " label = \"90%\";" fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " } " fo) (write-line " }" fo) (write-line " spacer_1 ;" fo) (write-line " ok_only;" fo) (write-line "}" fo) (close fo) (new_dialog "AHbutts" (setq d (load_dialog fn))) (start_dialog) (unload_dialog d) (vl-file-delete fo) (foreach l '( "TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review") (vl-catch-all-apply 'vla-put-freeze (list (vlax-ename->vla-object (tblobjname "layer" l)) (if (wcmatch l (strcat "*" (itoa n) "*")) 0 -1 ) ) ) ) (command "_.regen") (princ) ) Am getting an error : ; error: bad argument type: stringp #<FILE internal> Quote
mhupp Posted June 30, 2022 Posted June 30, 2022 Oops little more in "Multi radio buttons.lsp" then making the dcl should be fixed now. Quote
CAD_Noob Posted June 30, 2022 Author Posted June 30, 2022 26 minutes ago, mhupp said: Oops little more in "Multi radio buttons.lsp" then making the dcl should be fixed now. Thanksso much for your assistance.... am getting this error now : ; error: bad argument type: fixnump: "60%" Quote
mhupp Posted June 30, 2022 Posted June 30, 2022 (edited) oops again didn't look closely at @ronjonp super clean code. just change the following since I'm setting strings with the dcl instead of a number (if (wcmatch l (strcat "*" (itoa n) "*")) to (if (wcmatch l (strcat "*" n "*")) It will be a little harder to "add" things (write-line " : radio_button\t{" fo) (write-line " key = \"Rb#\";" fo) ;replace # with a number 1-3 are taken (write-line " label = \"@@@@\";" fo) ;what it will show (write-line " }" fo) (write-line " spacer_1 ;" fo) .... (action_tile "Rb#" "(setq n \"@@@@\")(done_dialog)") also add the layer name to the l list Edited June 30, 2022 by mhupp 1 Quote
CAD_Noob Posted June 30, 2022 Author Posted June 30, 2022 thank you so much ! working properly now. Thank you @ronjonpfor the code.. @BIGALfor the radio button and @mhuppfor merging the 2 lisps together. thanks so much! appreciate your great help 1 Quote
CAD_Noob Posted June 30, 2022 Author Posted June 30, 2022 56 minutes ago, mhupp said: oops again didn't look closely at @ronjonp super clean code. just change the following since I'm setting strings with the dcl instead of a number (if (wcmatch l (strcat "*" (itoa n) "*")) to (if (wcmatch l (strcat "*" n "*")) It will be a little harder to "add" things (write-line " : radio_button\t{" fo) (write-line " key = \"Rb#\";" fo) ;replace # with a number 1-3 are takeng (write-line " label = \"@@@@\";" fo) ;what it will show (write-line " }" fo) (write-line " spacer_1 ;" fo) .... (action_tile "Rb#" "(setq n \"@@@@\")(done_dialog)") also add the layer name to the l list Am thinking that if I add more choices...i may need to convert to to vertical. let me see i can try to understand how it works... thanks again Quote
mhupp Posted June 30, 2022 Posted June 30, 2022 Column version (defun c:foo (/ n) (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line "AHbutts : dialog {" fo) (write-line " label =\"Choose revision\" ;" fo) (write-line " : row{" fo) (write-line " : boxed_radio_column {" fo) 3 Quote
ronjonp Posted June 30, 2022 Posted June 30, 2022 (edited) IMO DCL is not needed for this simple task. If you format the input correctly and have DYNMODE set to 1, it makes for a pretty clean interface. (defun c:foo (/ a n) (initget 0 (setq a "30 60 90")) (setq n (cond ((getkword (strcat "\nSelect Option [" (vl-string-translate " " "/" a) "] <30>: "))) ("30") ) ) (foreach l '("TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review") (vl-catch-all-apply 'vla-put-freeze (list (vlax-ename->vla-object (tblobjname "layer" l)) (if (wcmatch l (strcat "*" n "*")) 0 -1 ) ) ) ) (command "_.regen") (princ) ) Edited June 30, 2022 by ronjonp 4 Quote
CAD_Noob Posted July 1, 2022 Author Posted July 1, 2022 (edited) 6 hours ago, ronjonp said: IMO DCL is not needed for this simple task. If you format the input correctly and have DYNMODE set to 1, it makes for a pretty clean interface. (defun c:foo (/ a n) (initget 0 (setq a "30 60 90")) (setq n (cond ((getkword (strcat "\nSelect Option [" (vl-string-translate " " "/" a) "] <30>: "))) ("30") ) ) (foreach l '("TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review") (vl-catch-all-apply 'vla-put-freeze (list (vlax-ename->vla-object (tblobjname "layer" l)) (if (wcmatch l (strcat "*" n "*")) 0 -1 ) ) ) ) (command "_.regen") (princ) ) Thanks @ronjonp i have DYNMODE set to 0 as it slows down my computer... still working great though. edit : when i tested on a xref'd title block it return an error : Select Option [30/60/90] <30>: bad argument type: VLA-OBJECT nil When working on the native file it's working fine... Edited July 1, 2022 by CAD_Noob Quote
mhupp Posted July 1, 2022 Posted July 1, 2022 (edited) 5 hours ago, CAD_Noob said: i have DYNMODE set to 0 as it slows down my computer... So toggle it for just this command. The error "bad argument type: VLA-OBJECT nil" is probably because the layer doesn't exist in that drawing. added an if statement to check for layer. if missing will let you know. --edit Quote when i tested on a xref'd title block it return an error : Layers that are in the xref have the name of the xref in front like this xref named "typical-motel-room" --edit had to build a list of layers that contain the strings in check (old l list) from there builds a new l list of the layers that need to be frozen or thawed. (defun c:foo (/ a n check lay match l) (setvar 'DYNMODE 1) ;set dynmode @ pointer (initget 0 (setq a "30 60 90")) (setq n (cond ((getkword (strcat "\nSelect Option [" (vl-string-translate " " "/" a) "] <30>: "))) ( "30") ) ) (setvar 'DYNMODE 0) ;turn off dynmode (foreach check '("TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review") (foreach lay (Table "layer") (if (wcmatch lay (strcat "*" check "*")) (setq match (cons lay match)) ) ) ) (foreach l match (vl-catch-all-apply 'vla-put-freeze (list (vlax-ename->vla-object (tblobjname "layer" l)) (if (wcmatch l (strcat "*" n "*")) 0 -1) ) ) ) (command "_.regen") (princ) ) ;Written By Michael Puckett. (defun Table (s / d r) (while (setq d (tblnext s (null d))) (setq r (cons (cdr (assoc 2 d)) r)) ) ) Edited July 1, 2022 by mhupp 2 Quote
CAD_Noob Posted July 1, 2022 Author Posted July 1, 2022 1 hour ago, mhupp said: So toggle it for just this command. The error "bad argument type: VLA-OBJECT nil" is probably because the layer doesn't exist in that drawing. added an if statement to check for layer. if missing will let you know. --edit Layers that are in the xref have the name of the xref in front like this xref named "typical-motel-room" This will fix that (if (tblsearch "Layer" (strcat "*" l)) so instead of searching for layers names that only match whats in quotes "TEST-PP-30%_Design_Review" it will search for layers that end whats in quotes. (defun c:foo (/ a n) (setvar 'DYNMODE 1) ;set dynmode @ pointer (initget 0 (setq a "30 60 90")) (setq n (cond ((getkword (strcat "\nSelect Option [" (vl-string-translate " " "/" a) "] <30>: "))) ("30") ) ) (setvar 'DYNMODE 0) ;turn off dynmode (foreach l '("TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review") (if (tblsearch "Layer" (strcat "*" l));check if layer exists (vl-catch-all-apply 'vla-put-freeze (list (vlax-ename->vla-object (tblobjname "layer" (strcat "*" l))) (if (wcmatch l (strcat "*" n "*")) 0 -1) ) ) (prompt (strcat "\nLayer " l " not in drawing")) ) ) (command "_.regen") (princ) ) the layers are there...but reports show that its not... Quote
mhupp Posted July 1, 2022 Posted July 1, 2022 (edited) lol this is what happens when you don't test code before posting. Had to build a list of layers that contain the strings in check (old l list) from there builds a new l list of the layers that need to be frozen or thawed. --edit no more missing message code updated above Edited July 1, 2022 by mhupp Quote
CAD_Noob Posted July 1, 2022 Author Posted July 1, 2022 30 minutes ago, mhupp said: lol this is what happens when you don't test code before posting. Had to build a list of layers that contain the strings in check (old l list) from there builds a new l list of the layers that need to be frozen or thawed. --edit no more missing message code updated above thank you so much! working perfectly now. Quote
BIGAL Posted July 2, 2022 Posted July 2, 2022 Multi Radio buttons supports vertical or horizontal choice no need to redo code. (ah:butts ahdef "V" (ah:butts ahdef "H" 1 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.