CAD_Noob Posted June 28, 2022 Share Posted June 28, 2022 Hi All, I have attached a sample titleblock. Our company workflow is xref the title block and from there, freeze the project phase that are to be frozen and leave the one need to be Thaw / ON Example : I have these following project phase : 30% 60% 90% etc.. I want the 60% to show in the Titleblock, that means i need to turn off or freeze the layers of the rest of the Project Phase. It would be easier if there is a button where i can select which one i need. Hope somebody can help. TEMP.dwg Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 28, 2022 Share Posted June 28, 2022 (edited) Instead of layering this why don't you make an attributed block that has this as well as sheet number, drawing title etc. Or just change the %. Edited June 28, 2022 by ronjonp 1 1 Quote Link to comment Share on other sites More sharing options...
Steven P Posted June 28, 2022 Share Posted June 28, 2022 I would be going that way too rather than a LISP, use what CAD gives you. However if you want to have this by LISP and each stage on a separate layer there is a load of LISPs out there to show and hide layers, the basis is these, and you can make up a LISP and button accordingly I think?: (command "-layer" "freeze" "LAYER1Name,LAYER2Name,LAYER3Name" "") (command "-layer" "thaw" "LAYER1Name,LAYER2Name,LAYER3Name" "") (command "-layer" "off" "LAYER1Name,LAYER2Name,LAYER3Name" "Y" "") (command "-layer" "on" "LAYER1Name,LAYER2Name,LAYER3Name" "") If all you are changing is the % text, you could also get the same result changing just the text, however turning on the layers is probably the easiest to implement. Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 28, 2022 Author Share Posted June 28, 2022 (edited) 8 hours ago, ronjonp said: Instead of layering this why don't you make an attributed block that has this as well as sheet number, drawing title etc. Or just change the %. Yes I agree. that is the ideal way but I am not in the position to change the company standard it has a designation Block for each % and set to its corresponding layer actually. Edited June 29, 2022 by CAD_Noob Quote Link to comment Share on other sites More sharing options...
mhupp Posted June 29, 2022 Share Posted June 29, 2022 (edited) Prob a better way to do this. but will cycle thought the layers i=1 30 on 60,90 off i=2 60 on 30,90 off i=3 90 on 30,60 off i=4 30,60,90 off --edit this uses ldata thats saved with the drawing. So next time you run the command it will cycle to the next % ;;----------------------------------------------------------------------------;; ;;LAYER CYCLE % DESIGN (defun C:LC (/ i) (or (setq i (vlax-ldata-get "Design" "%")) (setq i 1)) ;1=30% 2=60% 3=90% (if (eq i 5) (setq i 1)) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-30%_Design_Review")) :vlax-true) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-60%_Design_Review")) :vlax-true) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-90%_Design_Review")) :vlax-true) (cond ((eq i 1) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-30%_Design_Review")) :vlax-false) ) ((eq i 2) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-60%_Design_Review")) :vlax-false) ) ((eq i 3) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-90%_Design_Review")) :vlax-false) ) ) (vlax-ldata-put "Design" "%" (1+ i)) (princ) ) Edited June 29, 2022 by mhupp Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 29, 2022 Author Share Posted June 29, 2022 (edited) 42 minutes ago, mhupp said: Prob a better way to do this. but will cycle thought the layers i=1 30 on 60,90 off i=2 60 on 30,90 off i=3 90 on 30,60 off i=4 30,60,90 off --edit this uses ldata thats saved with the drawing. So next time you run the command it will cycle to the next % ;;----------------------------------------------------------------------------;; ;;LAYER CYCLE % DESIGN (defun C:LC (/ i) (or (setq i (vlax-ldata-get "Design" "%")) (setq i 1)) ;1=30% 2=60% 3=90% (if (eq i 5) (setq i 1)) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-30%_Design_Review")) :vlax-true) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-60%_Design_Review")) :vlax-true) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-90%_Design_Review")) :vlax-true) (cond ((eq i 1) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-30%_Design_Review")) :vlax-false) ) ((eq i 2) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-60%_Design_Review")) :vlax-false) ) ((eq i 3) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "TEST-PP-90%_Design_Review")) :vlax-false) ) ) (vlax-ldata-put "Design" "%" (1+ i)) (princ) ) Thanks will try this out ... Have tried it out but i think it will be a bit difficult for users who have no lisp experience. I don't know how @BIGAL radio button works but i think that would be useful Edited June 29, 2022 by CAD_Noob Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 29, 2022 Share Posted June 29, 2022 (edited) Here's another way to do it with very little error checking. (defun c:foo (/ n) (or (setq n (getint "\nEnter percent:<30>")) (setq n 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 "*" (itoa n) "*")) 0 -1 ) ) ) ) (princ) ) Edited June 29, 2022 by ronjonp 3 Quote Link to comment Share on other sites More sharing options...
Steven P Posted June 29, 2022 Share Posted June 29, 2022 To me this is asking for the multi radio buttons LISP from the downloads as the control method and then behind that button press turn on and off as you need and with whatever method you choose whether it is updating text strings, dynamic blocks or turning off layers. You might need to update the user commands a bit so that 'close' runs this first, pops up the DCL box, change state, save close. Or do it on open though of course, if it was me I would have no way to know on opening a drawing whether I would be drawing 30% of it or 90% of it in that session - all depending who phones up and asks for more urgent stuff - so my preference would be to update the save on close Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 29, 2022 Author Share Posted June 29, 2022 5 hours ago, ronjonp said: Here's another way to do it with very little error checking. (defun c:foo (/ n) (or (setq n (getint "\nEnter percent:<30>")) (setq n 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 "*" (itoa n) "*")) 0 -1 ) ) ) ) (princ) ) Thank you very much! It's working find. If I need to add more options can i just add it to the "for each "list? One thing that's not working is that if say all are thawed / on and I press 60, it works but if I press 30, 60 will be frozen and nothing is shown anymore. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 30, 2022 Share Posted June 30, 2022 (edited) I don't have anything to test with not sure about (or but should work. (defun c:foo (/ n) ; (or (setq n (getint "\nEnter percent:<30>")) (setq n 30)) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (or (setq n (atoi (ah:butts 1 "h" '("Choose revision" "30%" "60%" "90%")))) ; n holds the button picked value Multi radio buttons.lsp Edited June 30, 2022 by BIGAL 3 Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 30, 2022 Author Share Posted June 30, 2022 (edited) thanks Bigal. works! maybe need some more on the lisp itself... when I click 60 - 30 and 90 are frozen. when i click 90, nothing will show up anymore... Edited June 30, 2022 by CAD_Noob typo error Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 30, 2022 Share Posted June 30, 2022 I am sure Ronjonp will follow up. 1 Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 30, 2022 Author Share Posted June 30, 2022 17 minutes ago, BIGAL said: I am sure Ronjonp will follow up. Hope so.. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 30, 2022 Share Posted June 30, 2022 1 hour ago, CAD_Noob said: Thank you very much! It's working find. If I need to add more options can i just add it to the "for each "list? One thing that's not working is that if say all are thawed / on and I press 60, it works but if I press 30, 60 will be frozen and nothing is shown anymore. Try a regen. 1 Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 30, 2022 Author Share Posted June 30, 2022 14 minutes ago, ronjonp said: Try a regen. Thanks. regen works. Can i insert the regen in the code? Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 30, 2022 Share Posted June 30, 2022 50 minutes ago, CAD_Noob said: Thanks. regen works. Can i insert the regen in the code? (command "_.regen") 1 Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 30, 2022 Author Share Posted June 30, 2022 (edited) 27 minutes ago, ronjonp said: (command "_.regen") like this? (defun c:foo (/ n) ;;(or (setq n (getint "\nEnter percent:<30>")) (setq n 30)) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (or (setq n (atoi (ah:butts 1 "h" '("Choose revision" "30%" "60%" "90%"))))) (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) ) can i add more option in the foreach list? Edited June 30, 2022 by CAD_Noob Quote Link to comment Share on other sites More sharing options...
mhupp Posted June 30, 2022 Share Posted June 30, 2022 44 minutes ago, CAD_Noob said: can i add more option in the foreach list? Of course, but you would have to add it to the "Choose revision" list also. (or (setq n (atoi (ah:butts 1 "h" '("Choose revision" "30%" "60%" "90%" "Finished"))))) (foreach l '("TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review" "TEST-PP-Finished_Design") Basically what you choose has to be in the layer name for this lisp to work properly 1 Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted June 30, 2022 Author Share Posted June 30, 2022 1 minute ago, mhupp said: Of course, but you would have to add it to the "Choose revision" list also. (or (setq n (atoi (ah:butts 1 "h" '("Choose revision" "30%" "60%" "90%" "Finished"))))) (foreach l '("TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review" "TEST-PP-Finished_Design") Basically what you choose has to be in the layer name for this lisp to work properly Thank you. one more question...can I add the radio button lisp in the lsp itself ? something like a function rather than an external separate lisp? Quote Link to comment Share on other sites More sharing options...
mhupp Posted June 30, 2022 Share Posted June 30, 2022 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. 1 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.