Jump to content

DCL Radio Buttons


woodman78

Recommended Posts

I have a question. Why are you pausing for width? And twice.

(command "pline" pause "width" "0.0" "0.0" pause "width" "0.0" "0.0" "")

Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

  • The Buzzard

    39

  • woodman78

    18

  • Lee Mac

    1

  • dober

    1

Top Posters In This Topic

Posted Images

That seems to do it alright. Just one thing though. When I run the lsp it loads the dialog box and when I choose my options and press OK it disappears. I start to draw the pline and at the second point the box reappears and I have to press OK again. the Pline command then starts again. Does the box need to be hidden on the userclick??

 

Here is the code that I made a few small changes to to get the linetypes to load and the linetype file.

 

woodman78,

 

I removed the loop command (POPUP_MF) from the end of the ANSWER function for now. I am working on something else that will make your eyes pop out. I will need a little time to get it done, But in the mean time can you let me know about the line width question I had asked you about. I also removed the real numbers as well since it is not really needed. I have your code functioning well, But I need your reply first.

 

We will get this all cleared up soon.

The Buzzard

Link to comment
Share on other sites

I see your point about the pause twice. I'm out of the office now i'll check it first thing in the morning. Thanks.

Link to comment
Share on other sites

I see your point about the pause twice. I'm out of the office now i'll check it first thing in the morning. Thanks.

 

No problem, I have something completely different for you. You will find it interesting. I am still working on it at the moment. I will contact you then.

 

The Buzzard

Link to comment
Share on other sites

Look forward to seeing it. I changed the end of the code a bit. I removed the pause and used plinewid instead. Now when i run it the plinewid runs fine but when the pline command kicks in i get the following at the command line.

 

 

Command: plinewid

Enter new value for PLINEWID : 0

Command: pline

Specify start point: ._-layer

Invalid point.

; error: Function cancelled

Specify start point:

Current line-width is 0.0000

Specify next point or [Arc/Halfwidth/Length/Undo/Width]:

Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:

Command:

 

It seems that the layer command is kicking it at the start of the pline.

Link to comment
Share on other sites

I just commented out the (POPUP_MF) at the end of the code and it works fine. It remembers the settings selected previously when I want to draw another line so do i need to loop back to (POPUP_MF)???

Link to comment
Share on other sites

I just commented out the (POPUP_MF) at the end of the code and it works fine. It remembers the settings selected previously when I want to draw another line so do i need to loop back to (POPUP_MF)???

 

The attached program has some new stuff. I noticed when you use the pline command to draw custom linetypes with lettering, The lettering can come out in the wrong reading direction. I made adjustments to the program to correct this.

I also added a line width edit box if you decide to change line width in this manner. The program still sets your plot line width thru the layers as before so this is just another method since I noticed that line width issue I was mentioning to you. There is also variable save features and restore features. The program will draw line plines in segments rather than constant. This will allow the linetypes to be rotated automatically to correct the wrong text reading direction.

View the images so you can see what I am talking about.

 

DCL

popup4 : dialog {                                   //*dialog name
        label = "Existing Storm Sewers";           //*give it a label
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Choose a Type";               //*give it a label 
            : popup_list {                         //*define popup_list
              key = "T1";                          //*give it a name
              label = "Type";                      //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end column
        }                                          //*end row
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Choose a Size";               //*give it a label 
            : popup_list {                         //*define popup_list
              key = "S1";                          //*give it a name
              label = "Size";                      //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end boxed_column
        }                                          //*end row
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Set Line Width";              //*give it a label 
            : edit_box {                           //*define edit_box
              key = "P1";                          //*give it a name
              label = "Line Width";                //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end boxed_column
        }                                          //*end row
        : row {                                    //*define row
          : column {                               //*define column
            ok_cancel ;                            //*predifined OK/Cancel
            : paragraph {                          //*define paragraph
              : text_part {                        //*define text
                label = "Designed by Brian Deasy"; //*give it some text
              }                                    //*end text
              : text_part {                        //*define more text
                label = "for CCC NNRDO";           //*some more text
              }                                    //*end text
            }                                      //*end paragraph
          }                                        //*end column
        }                                          //*end row
      }                                            //*end dialog

 

LSP

;/////////////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:POPUP4 ()
 (POPUP_MF)
 (princ)
)
;
;/////////////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun POPUP_MF (/ HOLE$ SIZE$ HOLE SIZE PWID a b)
 (setq SUOM (getvar "orthomode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq temperr *error*)
 (setq *error* ETRAP)
 (or P:WID (setq P:WID "0.0"))
 (setq T1_list
  '("Type 1" "Type 2"
    "Type 3" "Type 4"
   )
 )
 (setq S1_list
  '("1500mm" "1350mm"
    "1200mm" "1050mm"
     "900mm"  "750mm"
     "675mm"  "600mm"
     "525mm"  "450mm"
     "375mm"  "300mm"
     "225mm"  "150mm"
   )
 )
 (setq dcl_id (load_dialog "popup4.dcl"))
 (if
   (not
     (new_dialog "popup4" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
 (start_list "T1")
 (mapcar 'add_list T1_list)
 (end_list)
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
 (set_tile "P1" P:WID)
 (if HOLE:DEF
   (set_tile "T1" (itoa HOLE:DEF))
 )
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)(RESTOREUSERSET)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     (setq H:OLE (atoi (get_tile \"T1\")) HOLE:DEF H:OLE)"
    "(setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(setq P:WID (get_tile \"P1\"))"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (VARIABLE)
 )
 (princ)
)
;
;/////////////////////////////////////////////////////////////////////////////////
;
; Variable Function
;
(defun VARIABLE ()
 (progn
   (setq HOLE$ (fix H:OLE))
   (setq HOLE$ (nth H:OLE T1_list))
   (cond
     ((= HOLE$ "Type 1"))
     ((= HOLE$ "Type 2"))
     ((= HOLE$ "Type 3"))
     ((= HOLE$ "Type 4"))
   )
 )
 (setq HOLE HOLE$)
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
     ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
     ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
     ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
     ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
     ((= SIZE$  "900mm")(setq SIZE$  "900"))
     ((= SIZE$  "750mm")(setq SIZE$  "750"))
     ((= SIZE$  "675mm")(setq SIZE$  "675"))
     ((= SIZE$  "600mm")(setq SIZE$  "600"))
     ((= SIZE$  "525mm")(setq SIZE$  "525"))
     ((= SIZE$  "450mm")(setq SIZE$  "450"))
     ((= SIZE$  "375mm")(setq SIZE$  "375"))
     ((= SIZE$  "300mm")(setq SIZE$  "300"))
     ((= SIZE$  "225mm")(setq SIZE$  "225"))
     ((= SIZE$  "150mm")(setq SIZE$  "150"))
   )
 )
 (setq SIZE SIZE$) 
 (setq PWID P:WID)
 (OUTPUT)
 (princ)
)
;
;/////////////////////////////////////////////////////////////////////////////////
;
; Output Function
;
(defun OUTPUT ()
 (progn
   (setq a (strcat "CCC_DR_"SIZE"_"HOLE)
         b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE"_"HOLE)
   )
   (if
     (not
       (tblsearch "LTYPE" a)
     )
     (command "_.-linetype" "_l" a "acadiso.lin" "")
   )
   (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" )
   (setvar "angbase" 0.0000)
   (setvar "angdir"  0)
   (setvar "orthomode" 1)
   (setq PT01 (getpoint "\nEnter the line start point:")
         PT02 (getpoint pt01 "\nEnter the line end point:")
   )
   (command "_.pline" PT01 "w" PWID PWID PT02 "")
   (setq RADIANS (angle PT01 PT02))
   (setq DEGREES (RTD radians))
   (setq PIPELINELEN (distance PT01 PT02))
   (setq MIDPT (polar PT01 (DTR degrees)(/ PIPELINELEN 2.0)))
   (if
     (and
       (>  DEGREES 90.0)
       (<= DEGREES 270.0)
     )
     (command "_.rotate" "last" "" MIDPT "180.0")
   )
   (POPUP_MF)
 )
 (RESTOREUSERSET)
 (princ)
)
;
;/////////////////////////////////////////////////////////////////////////////////
;
; Degrees to Radians Function
;
(defun DTR (DEGREES)
(* pi (/ DEGREES 180.0))
)
;
;/////////////////////////////////////////////////////////////////////////////////
;
; Radians to Degrees Function
;
(defun RTD (RADIANS)
 (* 180.0 (/ RADIANS pi))
)
;
;/////////////////////////////////////////////////////////////////////////////////
;
; Restore User Settings
;
(defun RESTOREUSERSET ()
 (setq *error* temperr)
 (setvar "orthomode" SUOM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ)
)
;
;/////////////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "orthomode" SUOM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring Variables.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;/////////////////////////////////////////////////////////////////////////////////

Test-1.jpg

Test-2.jpg

Document1.JPG

Link to comment
Share on other sites

I just commented out the (POPUP_MF) at the end of the code and it works fine. It remembers the settings selected previously when I want to draw another line so do i need to loop back to (POPUP_MF)???

 

woodman78,

 

These two lines written the way they were in POPUP3.lsp are the primary cause for the problem in the loop.

 

    (command "pline" pause "width" "0.0" "0.0" pause "width" "0.0" "0.0" "")
   (command "pline")

 

I had enquired on these and needed to know what you wanted to do with them. In POPUP4.lsp this is written a different way and is more flexible. If they are not needed, They can be removed. If you do not want to go this way with the program I am open to your suggestions.

I found the last program works well and places the plines in the correct orientation. The pline width is optional as you can always leave it at zero. I posted it as an example for your opinion.

 

Please let me know how you would like to proceed,

The Buzzard

Link to comment
Share on other sites

woodman78,

 

This is your version! No more dialog loop. I use the while function to make the polylines run continuously as the regular pline command, However the text reading direction is not effected at all. The program has the user settings saved and restores them when the program is complete. An error trap has been placed in the program incase the user hits escape mid-command. I tested this version completely and I must say it works very well. I put alot of effort into this one. I can assure you, This is the version you will want to use.

 

Give this program the once over.

I believe all will go well.

Look forward to your comments.

Command Syntax: POPUP5

Good Luck,

The Buzzard

 

DCL

popup5 : dialog {                                   //*dialog name
        label = "Existing Storm Sewers";           //*give it a label
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Choose a Type";               //*give it a label 
            : popup_list {                         //*define popup_list
              key = "T1";                          //*give it a name
              label = "Type";                      //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end column
        }                                          //*end row
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Choose a Size";               //*give it a label 
            : popup_list {                         //*define popup_list
              key = "S1";                          //*give it a name
              label = "Size";                      //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end boxed_column
        }                                          //*end row
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Set Line Width";              //*give it a label 
            : edit_box {                           //*define edit_box
              key = "P1";                          //*give it a name
              label = "Line Width";                //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end boxed_column
        }                                          //*end row
        : row {                                    //*define row
          : column {                               //*define column
            ok_cancel ;                            //*predifined OK/Cancel
            : paragraph {                          //*define paragraph
              : text_part {                        //*define text
                label = "Designed by Brian Deasy"; //*give it some text
              }                                    //*end text
              : text_part {                        //*define more text
                label = "for CCC NNRDO";           //*some more text
              }                                    //*end text
            }                                      //*end paragraph
          }                                        //*end column
        }                                          //*end row
      }                                            //*end dialog

 

LSP

;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:POPUP5 ()
 (POPUP_MF)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun POPUP_MF (/ HOLE$ SIZE$ HOLE SIZE PWID
                  SUCE  SUOM  SUSM SUAB SUAD
                  MIDPT PLEN  PT01 PT02 a b)
 (setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq temperr *error*)
 (setq *error* ETRAP)
 (or P:WID (setq P:WID "0.0"))
 (setq T1_list
  '("Type 1" "Type 2"
    "Type 3" "Type 4"
   )
 )
 (setq S1_list
  '("1500mm" "1350mm"
    "1200mm" "1050mm"
     "900mm"  "750mm"
     "675mm"  "600mm"
     "525mm"  "450mm"
     "375mm"  "300mm"
     "225mm"  "150mm"
   )
 )
 (setq dcl_id (load_dialog "popup5.dcl"))
 (if
   (not
     (new_dialog "popup5" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
 (start_list "T1")
 (mapcar 'add_list T1_list)
 (end_list)
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
 (set_tile "P1" P:WID)
 (if HOLE:DEF
   (set_tile "T1" (itoa HOLE:DEF))
 )
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     (setq H:OLE (atoi (get_tile \"T1\")) HOLE:DEF H:OLE)"
    "(setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(setq P:WID (get_tile \"P1\"))"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (VARIABLE)
 )
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Variable Function
;
(defun VARIABLE ()
 (progn
   (setq HOLE$ (fix H:OLE))
   (setq HOLE$ (nth H:OLE T1_list))
   (cond
     ((= HOLE$ "Type 1"))
     ((= HOLE$ "Type 2"))
     ((= HOLE$ "Type 3"))
     ((= HOLE$ "Type 4"))
   )
 )
 (setq HOLE HOLE$)
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
     ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
     ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
     ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
     ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
     ((= SIZE$  "900mm")(setq SIZE$  "900"))
     ((= SIZE$  "750mm")(setq SIZE$  "750"))
     ((= SIZE$  "675mm")(setq SIZE$  "675"))
     ((= SIZE$  "600mm")(setq SIZE$  "600"))
     ((= SIZE$  "525mm")(setq SIZE$  "525"))
     ((= SIZE$  "450mm")(setq SIZE$  "450"))
     ((= SIZE$  "375mm")(setq SIZE$  "375"))
     ((= SIZE$  "300mm")(setq SIZE$  "300"))
     ((= SIZE$  "225mm")(setq SIZE$  "225"))
     ((= SIZE$  "150mm")(setq SIZE$  "150"))
   )
 )
 (setq SIZE SIZE$) 
 (setq PWID P:WID)
 (OUTPUT)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Output Function
;
(defun OUTPUT ()
 (setq a (strcat "CCC_DR_"SIZE"_"HOLE)
       b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE"_"HOLE)
 )
 (if
   (not
     (tblsearch "LTYPE" a)
   )
   (command "_.-linetype" "_l" a "acadiso.lin" "")
 )
 (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" )
 (setvar "angbase" 0.0000)
 (setvar "angdir"  0)
 (setvar "orthomode" 1)
 (setvar "osmode"    16383)
 (setq PT01 (getpoint "\nEnter the line start point:"))
 (while (/= nil (setq PT02 (getpoint pt01 "\nEnter the line end point:")))
   (setvar "osmode" 0)
   (command "_.pline" PT01 "w" PWID PWID PT02 "")
   (setq RADIANS (angle PT01 PT02))
   (setq DEGREES (RTD RADIANS))
   (setq PLEN (distance PT01 PT02))
   (setq MIDPT (polar PT01 (DTR DEGREES)(/ PLEN 2.0)))
   (setq PT01 PT02)
   (setvar "osmode" 16383)
   (if
     (and
       (>  DEGREES 90.0)
       (<= DEGREES 270.0)
     )
     (command "_.rotate" "last" "" MIDPT "180.0")
   )
 )
 (setq *error* temperr)
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Degrees to Radians Function
;
(defun DTR (DEGREES)
(* pi (/ DEGREES 180.0))
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Radians to Degrees Function
;
(defun RTD (RADIANS)
 (* 180.0 (/ RADIANS pi))
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring Variables.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////

acadiso.txt

Link to comment
Share on other sites

Hallo bekomme folgende Fehlermeldung

Error:Funktion abgebrochen

Error, Restoring Variables.

 

woodman78,

 

This is your version! No more dialog loop. I use the while function to make the polylines run continuously as the regular pline command, However the text reading direction is not effected at all. The program has the user settings saved and restores them when the program is complete. An error trap has been placed in the program incase the user hits escape mid-command. I tested this version completely and I must say it works very well. I put alot of effort into this one. I can assure you, This is the version you will want to use.

 

Give this program the once over.

I believe all will go well.

Look forward to your comments.

Command Syntax: POPUP5

Good Luck,

The Buzzard

 

DCL

popup5 : dialog {                                   //*dialog name
        label = "Existing Storm Sewers";           //*give it a label
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Choose a Type";               //*give it a label 
            : popup_list {                         //*define popup_list
              key = "T1";                          //*give it a name
              label = "Type";                      //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end column
        }                                          //*end row
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Choose a Size";               //*give it a label 
            : popup_list {                         //*define popup_list
              key = "S1";                          //*give it a name
              label = "Size";                      //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end boxed_column
        }                                          //*end row
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Set Line Width";              //*give it a label 
            : edit_box {                           //*define edit_box
              key = "P1";                          //*give it a name
              label = "Line Width";                //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end boxed_column
        }                                          //*end row
        : row {                                    //*define row
          : column {                               //*define column
            ok_cancel ;                            //*predifined OK/Cancel
            : paragraph {                          //*define paragraph
              : text_part {                        //*define text
                label = "Designed by Brian Deasy"; //*give it some text
              }                                    //*end text
              : text_part {                        //*define more text
                label = "for CCC NNRDO";           //*some more text
              }                                    //*end text
            }                                      //*end paragraph
          }                                        //*end column
        }                                          //*end row
      }                                            //*end dialog

LSP

;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:POPUP5 ()
 (POPUP_MF)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun POPUP_MF (/ HOLE$ SIZE$ HOLE SIZE PWID
                  SUCE  SUOM  SUSM SUAB SUAD
                  MIDPT PLEN  PT01 PT02 a b)
 (setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq temperr *error*)
 (setq *error* ETRAP)
 (or P:WID (setq P:WID "0.0"))
 (setq T1_list
  '("Type 1" "Type 2"
    "Type 3" "Type 4"
   )
 )
 (setq S1_list
  '("1500mm" "1350mm"
    "1200mm" "1050mm"
     "900mm"  "750mm"
     "675mm"  "600mm"
     "525mm"  "450mm"
     "375mm"  "300mm"
     "225mm"  "150mm"
   )
 )
 (setq dcl_id (load_dialog "popup5.dcl"))
 (if
   (not
     (new_dialog "popup5" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
 (start_list "T1")
 (mapcar 'add_list T1_list)
 (end_list)
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
 (set_tile "P1" P:WID)
 (if HOLE:DEF
   (set_tile "T1" (itoa HOLE:DEF))
 )
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     (setq H:OLE (atoi (get_tile \"T1\")) HOLE:DEF H:OLE)"
    "(setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(setq P:WID (get_tile \"P1\"))"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (VARIABLE)
 )
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Variable Function
;
(defun VARIABLE ()
 (progn
   (setq HOLE$ (fix H:OLE))
   (setq HOLE$ (nth H:OLE T1_list))
   (cond
     ((= HOLE$ "Type 1"))
     ((= HOLE$ "Type 2"))
     ((= HOLE$ "Type 3"))
     ((= HOLE$ "Type 4"))
   )
 )
 (setq HOLE HOLE$)
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
     ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
     ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
     ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
     ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
     ((= SIZE$  "900mm")(setq SIZE$  "900"))
     ((= SIZE$  "750mm")(setq SIZE$  "750"))
     ((= SIZE$  "675mm")(setq SIZE$  "675"))
     ((= SIZE$  "600mm")(setq SIZE$  "600"))
     ((= SIZE$  "525mm")(setq SIZE$  "525"))
     ((= SIZE$  "450mm")(setq SIZE$  "450"))
     ((= SIZE$  "375mm")(setq SIZE$  "375"))
     ((= SIZE$  "300mm")(setq SIZE$  "300"))
     ((= SIZE$  "225mm")(setq SIZE$  "225"))
     ((= SIZE$  "150mm")(setq SIZE$  "150"))
   )
 )
 (setq SIZE SIZE$) 
 (setq PWID P:WID)
 (OUTPUT)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Output Function
;
(defun OUTPUT ()
 (setq a (strcat "CCC_DR_"SIZE"_"HOLE)
       b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE"_"HOLE)
 )
 (if
   (not
     (tblsearch "LTYPE" a)
   )
   (command "_.-linetype" "_l" a "acadiso.lin" "")
 )
 (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" )
 (setvar "angbase" 0.0000)
 (setvar "angdir"  0)
 (setvar "orthomode" 1)
 (setvar "osmode"    16383)
 (setq PT01 (getpoint "\nEnter the line start point:"))
 (while (/= nil (setq PT02 (getpoint pt01 "\nEnter the line end point:")))
   (setvar "osmode" 0)
   (command "_.pline" PT01 "w" PWID PWID PT02 "")
   (setq RADIANS (angle PT01 PT02))
   (setq DEGREES (RTD radians))
   (setq PLEN (distance PT01 PT02))
   (setq MIDPT (polar PT01 (DTR degrees)(/ PLEN 2.0)))
   (setq PT01 PT02)
   (setvar "osmode" 16383)
   (if
     (and
       (>  DEGREES 90.0)
       (<= DEGREES 270.0)
     )
     (command "_.rotate" "last" "" MIDPT "180.0")
   )
 )
 (setq *error* temperr)
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Degrees to Radians Function
;
(defun DTR (DEGREES)
(* pi (/ DEGREES 180.0))
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Radians to Degrees Function
;
(defun RTD (RADIANS)
 (* 180.0 (/ RADIANS pi))
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring Variables.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////

Link to comment
Share on other sites

Hallo bekomme folgende Fehlermeldung

Error:Funktion abgebrochen

Error, Restoring Variables.

If you do not have the linetypes in your system, Then expect that error. This is a custom program.

Link to comment
Share on other sites

Buzzard,

 

That is great. That was my one concern yesterday when i tested popup4 that the dialog box reloaded every time I wanted to do a new line segment. I know the guys in the office here and if it is anyway difficult or even slightly annoying then they will simply ignore it. They will have no excuses now. Great program. The "Designed by......" line needs to be changed or removed at this stage!!!!!!!!! Credit where credit is due.

Link to comment
Share on other sites

Buzzard,

 

That is great. That was my one concern yesterday when i tested popup4 that the dialog box reloaded every time I wanted to do a new line segment. I know the guys in the office here and if it is anyway difficult or even slightly annoying then they will simply ignore it. They will have no excuses now. Great program. The "Designed by......" line needs to be changed or removed at this stage!!!!!!!!! Credit where credit is due.

 

I am glad you like this one. I am not worried about the credit, This is your program as far as I am concerned. If you have any other changes or additions, Please feel free to mention them. I get my own personal joy from working with lisp and knowing its useful to someone. I also hope you got a good learning experience from all this as well.

 

Enjoy The Program,

The Buzzard

Link to comment
Share on other sites

If you do not have the linetypes in your system, Then expect that error. This is a custom program.

 

Only tagging onto the end of this thread but, you could include some error trapping to overcome that.

 

Just something simple like:

 

(if (not (tblsearch "LTYPE"...

 

Or, you could load the linetypes for the user using VL:

 

(vla-load
 (vla-get-linetypes
   (vla-get-ActiveDocument
     (vlax-get-acad-object))) <ltname> "acad.lin")

 

Lee

Link to comment
Share on other sites

Only tagging onto the end of this thread but, you could include some error trapping to overcome that.

 

Just something simple like:

 

(if (not (tblsearch "LTYPE"...

 

Or, you could load the linetypes for the user using VL:

 

(vla-load
 (vla-get-linetypes
   (vla-get-ActiveDocument
     (vlax-get-acad-object))) <ltname> "acad.lin")

 

Lee

 

Hey Lee,

 

The program was set to look for linetypes called by the dialog. It does tablsearch for those linetypes. He did not modify it for his own use.

 

But Thanks,

The Buzzard

Link to comment
Share on other sites

Hey woodman78,

 

One more thing I would like for you to try out. I took your linetypes and placed them in their own file name (POPUP5.lin). The following line in the program was changed to:

 

    (command "_.-linetype" "_l" a "POPUP5.lin" "")

 

As long as this file remains with the POPUP5.dcl & POPUP5.lsp and their all in the ACAD Support File Search Path they will be found no problem. This is a much better way to store your linetypes especially when you go to do any upgrading for any future versions of AutoCAD. You will not have to place them in the new versions acadiso.lin file. Of course you can name the lsp, dcl & lin to whatever name you wish as long as you make the correct edit to these files.

The attached ZIP file will allow others to test this as well.

 

Attached below is a POPUP5.zip file with all the files to test.

You need not do anything to these files to test it as they are already setup. Again be sure all files stay together and are in ACAD's Support File Search Path.

 

Give this a whirl,

The Buzzard

POPUP5.zip

Link to comment
Share on other sites

Excellent stuff Buzzard,

 

The inclusion of the linetype file will save alot of headaches. Thanks for that. I was out of the office yesterday and just got to try it now.

 

Mighty!!!

Link to comment
Share on other sites

Excellent stuff Buzzard,

 

The inclusion of the linetype file will save alot of headaches. Thanks for that. I was out of the office yesterday and just got to try it now.

 

Mighty!!!

 

Thanks woodman78,

 

I have another program similar to this I wrote about 3yrs ago. I will be posting it with some new ideas I got from Lee Mac, so keep an eye out for it.

Link to comment
Share on other sites

Buzzard,

I have a situation where I need the size but not the type for some pipes. I have tried to comment out the type but when I run it it seems to get stuck in a loop and I have to force Cad to shut down. Any thoughts on this would help.

 

 
;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:ESS ()
 (POPUP_MF)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun POPUP_MF (/ HOLE$ SIZE$ HOLE SIZE PWID
                  SUCE  SUOM  SUSM SUAB SUAD
                  MIDPT PLEN  PT01 PT02 a b)
 (setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq temperr *error*)
 (setq *error* ETRAP)
;;;;;(or P:WID (setq P:WID "0.0"))
 ;;(setq T1_list
  ;;'("Type 1" "Type 2"
   ;; "Type 3" "Type 4"
   ;
;; )
 (setq S1_list
  '("1500mm" "1350mm"
    "1200mm" "1050mm"
     "900mm"  "750mm"
     "675mm"  "600mm"
     "525mm"  "450mm"
     "375mm"  "300mm"
     "225mm"  "150mm"
   )
 )
 (setq dcl_id (load_dialog "ESS.dcl"))
 (if
   (not
     (new_dialog "ESS" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
;;;; (start_list "T1")
;;;;; (mapcar 'add_list T1_list)
;;;;;; (end_list)
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
;;;;;;(set_tile "P1" P:WID)
 ;;(if HOLE:DEF
   ;;(set_tile "T1" (itoa HOLE:DEF))
 ;
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     ;;;;;;;;(setq H:OLE (atoi (get_tile \"T1\")) HOLE:DEF H:OLE)"
    "(setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    ;;;;;"(setq P:WID (get_tile \"P1\"))"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (VARIABLE)
 )
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Variable Function
;
(defun VARIABLE ()
 ;;;(progn
   ;;;(setq HOLE$ (fix H:OLE))
   ;;;(setq HOLE$ (nth H:OLE T1_list))
   ;;;(cond
    ;;; ((= HOLE$ "Type 1"))
    ;;; ((= HOLE$ "Type 2"))
    ;;; ((= HOLE$ "Type 3"))
    ;;; ((= HOLE$ "Type 4"))
   ;;
;;
;;; (setq HOLE HOLE$)
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
     ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
     ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
     ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
     ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
     ((= SIZE$  "900mm")(setq SIZE$  "900"))
     ((= SIZE$  "750mm")(setq SIZE$  "750"))
     ((= SIZE$  "675mm")(setq SIZE$  "675"))
     ((= SIZE$  "600mm")(setq SIZE$  "600"))
     ((= SIZE$  "525mm")(setq SIZE$  "525"))
     ((= SIZE$  "450mm")(setq SIZE$  "450"))
     ((= SIZE$  "375mm")(setq SIZE$  "375"))
     ((= SIZE$  "300mm")(setq SIZE$  "300"))
     ((= SIZE$  "225mm")(setq SIZE$  "225"))
     ((= SIZE$  "150mm")(setq SIZE$  "150"))
   )
 )
 (setq SIZE SIZE$) 
 ;;;;;;(setq PWID P:WID)
 (OUTPUT)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Output Function
;
(defun OUTPUT ()
 (setq a (strcat "CCC_DR_"SIZE")
       b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE")
 )
 (if
   (not
     (tblsearch "LTYPE" a)
   )
   (command "_.-linetype" "_l" a "CCC_Drainage.lin" "")
 )
 (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" )
 (command "_-color"  "bylayer")
 (command "._-linetype"  "s"  "bylayer" "")
 (setvar "angbase" 0.0000)
 (setvar "angdir"  0)
 (setvar "orthomode" 0)
 (setvar "osmode"    16383)
 (setq PT01 (getpoint "\nEnter the line start point:"))
 (while
   (/= nil
     (setq PT02 (getpoint pt01 "\nEnter the line end point:"))
   )
   (setvar "osmode" 0)
   (command "_.pline" PT01 PT02 "")
   (setq RADIANS (angle PT01 PT02))
   (setq DEGREES (RTD RADIANS))
   (setq PLEN (distance PT01 PT02))
   (setq MIDPT (polar PT01 (DTR DEGREES)(/ PLEN 2.0)))
   (setq PT01 PT02)
   (setvar "osmode" 16383)
   (if
     (and
       (>  DEGREES 90.0)
       (<= DEGREES 270.0)
     )
     (command "_.rotate" "last" "" MIDPT "180.0")
   )
 )
 (setq *error* temperr)
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Degrees to Radians Function
;
(defun DTR (DEGREES)
(* pi (/ DEGREES 180.0))
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Radians to Degrees Function
;
(defun RTD (RADIANS)
 (* 180.0 (/ RADIANS pi))
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring Variables.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////

 

 

 

 

 

 
ESS : dialog {                                   //*dialog name
        label = "Drainage";           //*give it a label
: row {                                    //*define row
             : paragraph {                          //*define paragraph
              : text_part {                        //*define more text
                label = "Existing Storm Sewer";           //*some more text
              }                                    //*end text
              : text_part {                        //*define more text
                label = "to be removed";           //*some more text
              }                                    //*end text
              : text_part {                        //*define more text
                label = " ";           //*some more text
              }                                    //*end text
            }                                      //*end paragraph
        }                                          //*end row
        //: row {                                    //*define row
         //: boxed_column {                         //*define boxex_column
            //label = "Choose a Type";               //*give it a label 
            //: popup_list {                         //*define popup_list
             // key = "T1";                          //*give it a name
             // label = "Type";                      //*give it a label 
              //edit_width=8;                        //*edit_width
              //alignment = right;                   //*alignment
            //}                                      //*end popup_list
            //: spacer {                             //*define spacer
             // height = 0;                          //*height
            //}                                      //*end spacer
          //}                                        //*end column
       // }                                          //*end row
        : row {                                    //*define row
          : boxed_column {                         //*define boxex_column
            label = "Choose a Size";               //*give it a label 
            : popup_list {                         //*define popup_list
              key = "S1";                          //*give it a name
              label = "Size";                      //*give it a label 
              edit_width=8;                        //*edit_width
              alignment = right;                   //*alignment
            }                                      //*end popup_list
            : spacer {                             //*define spacer
              height = 0;                          //*height
            }                                      //*end spacer
          }                                        //*end boxed_column
        }                                          //*end row
        //: row {                                    //*define row
          //: boxed_column {                         //*define boxex_column
            //label = "Set Line Width";              //*give it a label 
            //: edit_box {                           //*define edit_box
              //key = "P1";                          //*give it a name
             //label = "Line Width";                //*give it a label 
              //edit_width=8;                        //*edit_width
              //alignment = right;                   //*alignment
            //}                                      //*end popup_list
            //: spacer {                             //*define spacer
             // height = 0;                          //*height
            //}                                      //*end spacer
          //}                                        //*end boxed_column
        //}                                          //*end row
        : row {                                    //*define row
          : column {                               //*define column
            ok_cancel ;                            //*predifined OK/Cancel
            : paragraph {                          //*define paragraph
               : text_part {                        //*define more text
                label = "CCC NNRDO     v1.0.24.07.2009";           //*some more text
              }                                    //*end text
            }                                      //*end paragraph
          }                                        //*end column
        }                                          //*end row
      }                                            //*end dialog

 

Also I have been thinking about the Line Width and would like to run both without that. I want to reduce the options the guys have to make things different.

 

Thanks.

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...