woodman78 Posted July 29, 2009 Posted July 29, 2009 I have created dynamic blocks for creating legends on our drawing sheets. Rather that trying to create an automated legend I have the blocks as pieces that can be dropped in the legend space on the sheet and the legend built up in that way. The thing is that some of the pipes I use are one off and some have 4 types depending on where they are laid (roadway, grass verge etc.) I have the blocks already setup but I just wanted to create a dialog and code that would do the following: Allow the user to select the type of Pipe to be inserted. (If this pipe had no "types" then the following 2 popup lists would become greyed out. If it had "types" then one of the following 2 lists would become active. There are 2 because there are Types 1 - 4 and Types A - D in the National standards. Then when OK is pressed the info selected would be combined to form a block name that can be inserted. These are my thoughts on this. If anybody thinks I'm staring up the wrong end of the cow please let me know a better way of doing it. ///////////////////////////////////// // // Block Inserter // ///////////////////////////////////// Blins : dialog { label = "Drainage - Legend" ; initail_focus = "List1" ; spacer ; : row { fixed_width = true ; : column { width = 25 ; fixed_width = true ; spacer ; : text { label = "Choose Drainage Pipe" ; } } : popup_list { key = "List1" ; width = 25 ; fixed_width = true ; } } : row { fixed_width = true ; : column { width = 25 ; fixed_width = true ; spacer ; : text { label = "Choose Surround Type" ; } } : popup_list { key = "List2" ; width = 25 ; fixed_width = true ; } } : row { fixed_width = true ; : column { width = 25 ; fixed_width = true ; spacer ; : text { label = "Choose Surround Type" ; } } : popup_list { key = "List3" ; width = 25 ; fixed_width = true ; } } ok_cancel ; }//Blins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Block Inserter ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun Blins () (setq Value1$ (nth 1 *Blins@) Value2$ (nth 2 *Blins@) Value3$ (nth 3 *Blins@) List1@ (list " " "Existing Storm Sewer" "Existing Storm Sewer to be Removed" "Existing Storm Sewer to be Relaid" "Existing Foul Sewer" "Existing Foul Sewer to be Removed" "Existing Foul Sewer to be Relaid" "Existing Filter Drains" "Existing Filter Drains to be Removed" "Proposed Concrete Class H Piped Culvert" "Proposed Ductile Iron Storm Sewer" "Proposed Filter Drain with Geotextile")) List2@ (list " " "Type 1" "Type 2" "Type 3" "Type 4") List3@ (list " " "Type A" "Type B" "Type C" "Type D") ) (setq Dcl_Id$ (load_dialog "Blins.dcl")) (new_dialog "Blins" Dcl_Id$) (set_tile_list "List1" List1@ Value1$) (set_tile_list "List2" List2@ Value2$) (set_tile_list "List3" List3@ Value3$) (action_tile "List1" "(set_list_value \"List1@\" \"Value1$\")") (action_tile "List2" "(set_list_value \"List2@\" \"Value2$\")") (action_tile "List3" "(set_list_value \"List3@\" \"Value3$\")") (setq Return# (start_dialog)) (unload_dialog Dcl_Id$) (setq *Blins@ (list nil Value1$ Value2$ Value3$)) (princ) ) Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 For starters you have an extra right parenthese. The fix is below. Looks like a Terry CAD program. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Block Inserter ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun Blins () (setq Value1$ (nth 1 *Blins@) Value2$ (nth 2 *Blins@) Value3$ (nth 3 *Blins@) List1@ (list " " "Existing Storm Sewer" "Existing Storm Sewer to be Removed" "Existing Storm Sewer to be Relaid" "Existing Foul Sewer" "Existing Foul Sewer to be Removed" "Existing Foul Sewer to be Relaid" "Existing Filter Drains" "Existing Filter Drains to be Removed" "Proposed Concrete Class H Piped Culvert" "Proposed Ductile Iron Storm Sewer" "Proposed Filter Drain with Geotextile" ) List2@ (list " " "Type 1" "Type 2" "Type 3" "Type 4") List3@ (list " " "Type A" "Type B" "Type C" "Type D") ) (setq Dcl_Id$ (load_dialog "Blins.dcl")) (new_dialog "Blins" Dcl_Id$) (set_tile_list "List1" List1@ Value1$) (set_tile_list "List2" List2@ Value2$) (set_tile_list "List3" List3@ Value3$) (action_tile "List1" "(set_list_value \"List1@\" \"Value1$\")" ) (action_tile "List2" "(set_list_value \"List2@\" \"Value2$\")" ) (action_tile "List3" "(set_list_value \"List3@\" \"Value3$\")" ) (setq Return# (start_dialog)) (unload_dialog Dcl_Id$) (setq *Blins@ (list nil Value1$ Value2$ Value3$)) (princ) ) Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 I have created dynamic blocks for creating legends on our drawing sheets. Rather that trying to create an automated legend I have the blocks as pieces that can be dropped in the legend space on the sheet and the legend built up in that way. The thing is that some of the pipes I use are one off and some have 4 types depending on where they are laid (roadway, grass verge etc.) I have the blocks already setup but I just wanted to create a dialog and code that would do the following: Allow the user to select the type of Pipe to be inserted. (If this pipe had no "types" then the following 2 popup lists would become greyed out. If it had "types" then one of the following 2 lists would become active. There are 2 because there are Types 1 - 4 and Types A - D in the National standards. Then when OK is pressed the info selected would be combined to form a block name that can be inserted. These are my thoughts on this. If anybody thinks I'm staring up the wrong end of the cow please let me know a better way of doing it. You indicate that there are two types Types 1-4 & Types A-D which each has it own respected popup list. Well, Only one and not two can be active. You can use one popup list and have the contents of the list change if it applies. If types do not apply the one popup list then can be grayed out. Quote
woodman78 Posted July 29, 2009 Author Posted July 29, 2009 Yeah, I was trying to follow his "myDialogs" examples just to get the thing up and running and I then came across the cadalyst post about using the CAR to pass the information back to the dialog to change the items in the popup list but I don't think that would work for me. Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 Yeah, I was trying to follow his "myDialogs" examples just to get the thing up and running and I then came across the cadalyst post about using the CAR to pass the information back to the dialog to change the items in the popup list but I don't think that would work for me. If you look where my signature is you will see Imperial Doors Lisp. It uses popup list with contents that change with the selection of other buttons. This will give you an idea on how to go about this. I would do it a bit different then the way you have this posted. I would need some specific information with regards to the block naming and what else you can supply. If you want take a look at the program I mentioned so you can see how this works. Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 will have a look Buzzard thanks. woodman78, I am assembling a dialog now. I have the Drainage Pipes listed in the dialog. Can you tell me which Type groups belong to which Drainage Pipes? I will get this put together for you and allow you to take it from there. If you need further help, Then you know I am available to back you up. Also just another idea. Would you like images of the linetypes blocks to show in an image tile as you select the from the popup lists? Just a thought. Quote
woodman78 Posted July 29, 2009 Author Posted July 29, 2009 Here is a list of the drainage pipes with there types. I don't need the image to be shown, although I do like the idea, because all the blocks will appear to be the same in a preview image and they guys won't be given a choice anyway. Thanks Existing Filter Drains Existing Filter Drains to be Removed Existing Foul Sewer Existing Foul Sewer to be Removed Existing PVC to be Replaced with Concrete Type 1 Existing PVC to be Replaced with Concrete Type 2 Existing PVC to be Replaced with Concrete Type 3 Existing PVC to be Replaced with Concrete Type 4 Existing Storm Sewer Existing Storm Sewer to be Relaid Type 1 Existing Storm Sewer to be Relaid Type 2 Existing Storm Sewer to be Relaid Type 3 Existing Storm Sewer to be Relaid Type 4 Existing Storm Sewer to be Removed Proposed Concrete Class H Piped Culvert Type 1 Proposed Concrete Class H Piped Culvert Type 2 Proposed Concrete Class H Piped Culvert Type 3 Proposed Concrete Class H Piped Culvert Type 4 Proposed Ductile Iron Storm Sewer Type 1 Proposed Ductile Iron Storm Sewer Type 2 Proposed Ductile Iron Storm Sewer Type 3 Proposed Ductile Iron Storm Sewer Type 4 Proposed Filter Drain RCD 500 1 Geotextile Type A Proposed Filter Drain RCD 500 1 Geotextile Type B Proposed Filter Drain RCD 500 1 Geotextile Type C Proposed Filter Drain RCD 500 1 Geotextile Type D Proposed Thermoplastic Integrally Socketed Carrier Drain Type 1 Proposed Thermoplastic Integrally Socketed Carrier Drain Type 2 Proposed Thermoplastic Integrally Socketed Carrier Drain Type 3 Proposed Thermoplastic Integrally Socketed Carrier Drain Type 4 Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 Here is a list of the drainage pipes with there types. I don't need the image to be shown, although I do like the idea, because all the blocks will appear to be the same in a preview image and they guys won't be given a choice anyway. Thanks Existing Filter Drains Existing Filter Drains to be Removed Existing Foul Sewer Existing Foul Sewer to be Removed Existing PVC to be Replaced with Concrete Type 1 Existing PVC to be Replaced with Concrete Type 2 Existing PVC to be Replaced with Concrete Type 3 Existing PVC to be Replaced with Concrete Type 4 Existing Storm Sewer Existing Storm Sewer to be Relaid Type 1 Existing Storm Sewer to be Relaid Type 2 Existing Storm Sewer to be Relaid Type 3 Existing Storm Sewer to be Relaid Type 4 Existing Storm Sewer to be Removed Proposed Concrete Class H Piped Culvert Type 1 Proposed Concrete Class H Piped Culvert Type 2 Proposed Concrete Class H Piped Culvert Type 3 Proposed Concrete Class H Piped Culvert Type 4 Proposed Ductile Iron Storm Sewer Type 1 Proposed Ductile Iron Storm Sewer Type 2 Proposed Ductile Iron Storm Sewer Type 3 Proposed Ductile Iron Storm Sewer Type 4 Proposed Filter Drain RCD 500 1 Geotextile Type A Proposed Filter Drain RCD 500 1 Geotextile Type B Proposed Filter Drain RCD 500 1 Geotextile Type C Proposed Filter Drain RCD 500 1 Geotextile Type D Proposed Thermoplastic Integrally Socketed Carrier Drain Type 1 Proposed Thermoplastic Integrally Socketed Carrier Drain Type 2 Proposed Thermoplastic Integrally Socketed Carrier Drain Type 3 Proposed Thermoplastic Integrally Socketed Carrier Drain Type 4 Thanks, I will post what I have put together later for your review. We can build around it as we go. For now I will get the lists working the way you want. Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 woodman78, I am going to assume that the previous list is the Surround Type list. I can tell some of the ones that connect with the Drainage Pipe list, But there are others in this list that I am not sure which Drainage Pipe to connect with. They are not described in the Drainage Pipe list. Can you please explain which connects with which? Quote
woodman78 Posted July 29, 2009 Author Posted July 29, 2009 The list contains all the pipe types. those with type 1 -4 or type a-d are the ones with different surround types. The types 1-4 and types a-d are surround types listed in the national standard. I'm not sure what you mean by which is linked to which?? Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 What is the list you just gave me for? Let me reprhase that question. If I select a pipe from the Drainage Pipe list. What should appear in the Surround Type list. I am not familar with your piping standards. You need to be specific with me. Quote
woodman78 Posted July 29, 2009 Author Posted July 29, 2009 My bad, a break down of the list. Existing Filter Drains Has no types Existing Filter Drains to be Removed Has no types Existing Foul Sewer Has no types Existing Foul Sewer to be Removed Has no types Existing PVC to be Replaced with Concrete Has Types 1 to 4 Existing Storm Sewer Has no types Existing Storm Sewer to be Relaid Has Types 1 to 4 Existing Storm Sewer to be Removed Has no types Proposed Concrete Class H Piped Culvert Has Types 1 to 4 Proposed Ductile Iron Storm Sewer Has Types 1 to 4 Proposed Filter Drain RCD 500 1 Geotextile Has Types 1 to 4 Proposed Thermoplastic Integrally Socketed Carrier Drain Has Types 1 to 4 Hope this clarifies it. If not just let me know. woodman78 Quote
The Buzzard Posted July 29, 2009 Posted July 29, 2009 My bad, a break down of the list. Existing Filter Drains Has no types Existing Filter Drains to be Removed Has no types Existing Foul Sewer Has no types Existing Foul Sewer to be Removed Has no types Existing PVC to be Replaced with Concrete Has Types 1 to 4 Existing Storm Sewer Has no types Existing Storm Sewer to be Relaid Has Types 1 to 4 Existing Storm Sewer to be Removed Has no types Proposed Concrete Class H Piped Culvert Has Types 1 to 4 Proposed Ductile Iron Storm Sewer Has Types 1 to 4 Proposed Filter Drain RCD 500 1 Geotextile Has Types 1 to 4 Proposed Thermoplastic Integrally Socketed Carrier Drain Has Types 1 to 4 Hope this clarifies it. If not just let me know. woodman78 That clarifies it alot, That must be why you have a " " for no types. Which ones then use Types A to B. Quote
The Buzzard Posted July 30, 2009 Posted July 30, 2009 That clarifies it alot, That must be why you have a " " for no types.Which ones then use Types A to B. woodman78, There was just some confusion as to what you had from your original list from the first post to the more recent. I have it all sorted and will post shortly. Quote
The Buzzard Posted July 30, 2009 Posted July 30, 2009 Ok Mr.woodman78, I ran into some difficulty using two popup lists. I could get them to function, But not correctly. Rather than post nothing, I posted what you see below with combination radio_buttons and popup list. I am familar with this method and it works. If you are still sold on two popups, Maybe Lee_Mac can assist you here since he is well versed in this. The method shown here uses a Choose List Items function that was written by ASMI and which I had learned from Lee_Mac. Try it out anyway to see if this does what you want. It is a starting point. DCL BLINS : dialog { label = "Drainage Legend"; : row { : boxed_radio_column { label = "Select a Drainage Pipe:"; : radio_button { label = "Existing Filter Drains"; key = "DP01"; } : radio_button { label = "Existing Filter Drains to be Removed"; key = "DP02"; } : radio_button { label = "Existing Foul Sewer"; key = "DP03"; } : radio_button { label = "Existing Foul Sewer to be Removed"; key = "DP04"; } : radio_button { label = "Existing PVC to be Replaced with Concrete"; key = "DP05"; } : radio_button { label = "Existing Storm Sewer"; key = "DP06"; } : radio_button { label = "Existing Storm Sewer to be Relaid"; key = "DP07"; } : radio_button { label = "Proposed Concrete Class H Piped Culvert"; key = "DP08"; } : radio_button { label = "Proposed Ductile Iron Storm Sewer"; key = "DP09"; } : radio_button { label = "Proposed Filter Drain RCD 500 1 Geotextile"; key = "DP10"; } : radio_button { label = "Proposed Thermoplastic Integrally Socketed Carrier Drain"; key = "DP11"; } } } : row { : boxed_column { label = "Select a Surround Type:"; : popup_list { key = "ST"; label = "Surround Type:"; edit_width = 12; alignment = right; } : spacer { height = 0; } } } : row { : column { ok_cancel; : paragraph { : text_part { label = "Designed by Brian Deasy"; } : text_part { label = "for CCC NNRDO"; } } } } } LSP ;////////////////////////////////////////////////////////////////////////// ; ; Start-Up Function ; (defun C:BLINS () (BLINS_MF) (princ) ) (princ "\nBLINS.lsp Loaded....") (princ "\nType BLINS to start program.") ; ;////////////////////////////////////////////////////////////////////////// ; ; Choose List Items Function ; (defun BLINS_CLI (lst items) (mapcar '(lambda (i) (nth i lst)) items) ) ; ;////////////////////////////////////////////////////////////////////////// ; ; Update Type List Function ; (defun BLINS_UTL (D:PIP) (setq ST_list '("Type A" "Type B" "Type C" "Type D" "Type 1" "Type 2" "Type 3" "Type 4" "No selection")) (cond ((= D:PIP "DP01")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '())) (end_list)) ((= D:PIP "DP02")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '())) (end_list)) ((= D:PIP "DP03")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '())) (end_list)) ((= D:PIP "DP04")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '())) (end_list)) ((= D:PIP "DP05")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list)) ((= D:PIP "DP06")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '())) (end_list)) ((= D:PIP "DP07")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list)) ((= D:PIP "DP08")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list)) ((= D:PIP "DP09")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list)) ((= D:PIP "DP10")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(0 1 2 3))))(end_list)) ((= D:PIP "DP11")(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list)) ) ) ; ;////////////////////////////////////////////////////////////////////////// ; ; Main Function ; (defun BLINS_MF (/ DPIP$ DPIP STYP$ STYP) (setq dcl_id (load_dialog "BLINS.dcl")) (if (not (new_dialog "BLINS" dcl_id)) (progn (ALERT "Can not find your dcl file")(exit))) (or D:PIP (setq D:PIP "DP01")) (set_tile D:PIP "1") (BLINS_UTL D:PIP) (action_tile "DP01" "(BLINS_UTL (setq D:PIP \"DP01\"))") (action_tile "DP02" "(BLINS_UTL (setq D:PIP \"DP02\"))") (action_tile "DP03" "(BLINS_UTL (setq D:PIP \"DP03\"))") (action_tile "DP04" "(BLINS_UTL (setq D:PIP \"DP04\"))") (action_tile "DP05" "(BLINS_UTL (setq D:PIP \"DP05\"))") (action_tile "DP06" "(BLINS_UTL (setq D:PIP \"DP06\"))") (action_tile "DP07" "(BLINS_UTL (setq D:PIP \"DP07\"))") (action_tile "DP08" "(BLINS_UTL (setq D:PIP \"DP08\"))") (action_tile "DP09" "(BLINS_UTL (setq D:PIP \"DP09\"))") (action_tile "DP10" "(BLINS_UTL (setq D:PIP \"DP10\"))") (action_tile "DP11" "(BLINS_UTL (setq D:PIP \"DP11\"))") (if STYP:DEF (set_tile "ST" (itoa STYP:DEF))) (action_tile "accept" (strcat "(progn (setq S:TYP (atoi (get_tile \"ST\")) STYP:DEF S:TYP)" "(done_dialog)(setq userclick T))")) (action_tile "cancel" "(done_dialog)(setq userclick nil)") (start_dialog)(unload_dialog dcl_id) (if userclick (BLINS_VF)) ) ; ;////////////////////////////////////////////////////////////////////////// ; ; Variable Function ; (defun BLINS_VF () (setq DPIP$ D:PIP) (cond ((= DPIP$ "DP01")(setq DPIP "Existing Filter Drains")) ((= DPIP$ "DP02")(setq DPIP "Existing Filter Drains to be Removed")) ((= DPIP$ "DP03")(setq DPIP "Existing Foul Sewer")) ((= DPIP$ "DP04")(setq DPIP "Existing Foul Sewer to be Removed")) ((= DPIP$ "DP05")(setq DPIP "Existing PVC to be Replaced with Concrete")) ((= DPIP$ "DP06")(setq DPIP "Existing Storm Sewer")) ((= DPIP$ "DP07")(setq DPIP "Existing Storm Sewer to be Relaid")) ((= DPIP$ "DP08")(setq DPIP "Proposed Concrete Class H Piped Culvert")) ((= DPIP$ "DP09")(setq DPIP "Proposed Ductile Iron Storm Sewer")) ((= DPIP$ "DP10")(setq DPIP "Proposed Filter Drain RCD 500 1 Geotextile")) ((= DPIP$ "DP11")(setq DPIP "Proposed Thermoplastic Integrally Socketed Carrier Drain")) ) (progn (setq S:TYP (fix S:TYP)) (setq S:TYP (nth S:TYP ST_list)) (setq STYP$ S:TYP) (cond ((= STYP$ "Type A") (setq STYP "Type A")) ((= STYP$ "Type B") (setq STYP "Type B")) ((= STYP$ "Type C") (setq STYP "Type C")) ((= STYP$ "Type D") (setq STYP "Type D")) ((= STYP$ "Type 1") (setq STYP "Type 1")) ((= STYP$ "Type 2") (setq STYP "Type 2")) ((= STYP$ "Type 3") (setq STYP "Type 3")) ((= STYP$ "Type 4") (setq STYP "Type 4")) ((= STYP$ "No selection")(setq STYP "No selection")) ) ) (BLINS_OF) ) ; ;////////////////////////////////////////////////////////////////////////// ; ; Output Function ; (defun BLINS_OF () (ALERT (strcat "\nThe Drainage Pipe you selected was "DPIP"." "\nThe Surround Type you selected was "STYP".")) (princ) ) ; ;////////////////////////////////////////////////////////////////////////// Quote
The Buzzard Posted July 30, 2009 Posted July 30, 2009 woodman78, There is a quirk with the above code. I am trying to contact Lee for some feedback. I will contact you later. The Buzzard Quote
woodman78 Posted July 30, 2009 Author Posted July 30, 2009 Buzzard, I made the follwoing changes to the output section of the code and it works a dream. Only one thing is whether it is possible to make the type be greyed out if no type is to be selected. Apart from that it is excellent. Thanks ;////////////////////////////////////////////////////////////////////////// ; ; Output Function ; (defun BLINS_OF () (setq outp (strcat DPIP " " STYP)) (command "_-insert" outp pause "1" "1" "0") (princ) ) ; ;////////////////////////////////////////////////////////////////////////// Quote
Lee Mac Posted July 30, 2009 Posted July 30, 2009 Use "mode_tile" to grey out tiles, and enable them 0 to enable, 1 to disable. 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.