Jump to content

Radio Button for Project Phase Selection


CAD_Noob

Recommended Posts

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

Link to comment
Share on other sites

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 by ronjonp
  • Like 1
  • Agree 1
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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 by CAD_Noob
Link to comment
Share on other sites

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 by mhupp
Link to comment
Share on other sites

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 by CAD_Noob
Link to comment
Share on other sites

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 by ronjonp
  • Like 3
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

 

image.png.06db9e2bec91e1c6e3486ad534ef7e79.png

 

Multi radio buttons.lsp

Edited by BIGAL
  • Like 3
Link to comment
Share on other sites

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 by CAD_Noob
typo error
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

14 minutes ago, ronjonp said:

Try a regen.

 

Thanks. regen works.

Can i insert the regen in the code?

 

Link to comment
Share on other sites

50 minutes ago, CAD_Noob said:

 

Thanks. regen works.

Can i insert the regen in the code?

 

(command "_.regen")

  • Like 1
Link to comment
Share on other sites

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 by CAD_Noob
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...