Jump to content

MINOR edits to a lisp? please help


dnovember99

Recommended Posts

Ok I set it all up and thought it was working and then wondered why values were wrong, when you create the block it is very important to create the attributes in some form of order, when you use the (command "insert" it fills in the block attributes in order not matching tag names. You can insert a block supply defaults then change via tag names but this adds a lot more code to a simple task. The other way is to leave as is and change the "Insert" order.

 

I rehacked the block and recreated the attributes only got 1 out of order and just used the option in bedit to fix.

 

; simple example of filling in a block attributes with calcs
; by Alan H Dec 2017

(defun c:pipe-calc ( / len ans div slabd inv safety tot totslope oldatt )

(if (not AH:getval7) (load "getvals1-8")(princ "loaded"))
(setq oldatt (getvar 'attdia))
(setvar 'attdia 0)
(ah:getval7 "Enter desired slope 1/x 4 8 16" 5 4  "4" "Enter Finished FLR Elev. " 5 4  "100" "Enter length " 5 4 "50"  "Enter Fittings Factor  %" 5 4 "25" "Enter Starting inv " 5 4 "24" "Enter slab depth" 5 4 "4" "Enter safety " 5 4 "6" )

(setq div (/ (/ 1.0 (atof val1)) 12.0 ))
(setq flr (atof val2))
(setq len (atof val3))
(setq perc (/ (atof val4) 100.0))
(setq inv (/ (atof val5) 12.0))
(setq slabd (/ (atof val6) 12.0))
(setq safety (/ (atof val7) 12.0))

(setq totlen (+  (* len  perc) len ))
; this should return the value of total length multiplied by 25%
(setq totslope (* totlen  div) )
(setq totoall (+ (+ (+ inv slabd) safety) totslope))
(setq tot  (- flr totoall))

; this should return a value in decimal format for the finished floor elevation - total overall slope. example would be 5' 5-1/2" - 100' = 94.542

(command "-insert" "PIPE-CALC" (getpoint) 1 1 0   (strcat "1/" val1 "\"") val2 val3 val4 val5 val6 val7  (rtos (* totoall 12.0) 3 1)  (rtos tot  2 2))

(setvar 'attdia oldatt)
)
(c:pipe-calc)

PIPE-BLOCK.dwg

GETVALS1-8.lsp

Edited by BIGAL
Link to comment
Share on other sites

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

  • dnovember99

    30

  • BIGAL

    25

  • Roy_043

    4

  • Grrr

    2

Top Posters In This Topic

Posted Images

ok so I downloaded the block that you updated and when I insert it, it is giving me the option to add the values that I am looking for. however it is leaving the last two (total length for architectural and absolute feet in decimals) blank. so I thought that was a little weird that it was asking for that information.

 

 

I also copied the lisp that you updated and when I load that, at first it didn't want to load. I was getting an error msg again. I am able to go thru "appload" and it will state that it is "successful" and then once I hit ok, it errors out.

 

 

when i was able to get the lisp to finally load one time, the dialog box popped up as "edit atributes" to enter the values and there is an additional ""enter length" i think that was just a typo so i went in and change up a few thing on that to get the wording to make sense.

 

 

but i am still not able to get the lisp to load and i don't know why. i must be the most unlucky sucker on the internet. i am wondering if i need to give up on all of this lol

block when inserted.png

loading thru appload.png

new dialog box for values.png

Link to comment
Share on other sites

I will check it needs Attdia 0 for it to work may have left that off, also realised the 1/4" refers to drop per 1 foot so I need to correct the maths also.

 

I see that attdia 0 is on line 8. Buy I also see this at line 26:

 

 

 

(Setvar 'attdia oldatt)

Link to comment
Share on other sites

Updated code and I think it all correct now I work metric so had to have a think about feet units, that was what was screwing my testing up. Its doing my head in not getting the correct numbers just post here the correct values as a column of numbers then I can see where my maths is wrong.

Link to comment
Share on other sites

Here is the math that I use when doing this the long hand way: (sorry trying to put this in the code selected window isnt working right for me right now.)

 

 

SLOPE VALUE = 1/8INCH (1/4" OR 1/8" OR 1/16")

TOTAL LENGTH = 265FT

FITTINGS FACTOR = 25%

STARTING INVERT = 24INCHES

SLAB THICKNESS = 4INCHES

SAFTY FACTOR = 6INCHES

 

 

THE LONG MATH LOOKS LIKE THIS:

 

 

(265 * 25% = 66.25 +(ORIGINAL LENGTH) 265FT = 331.25FT)

(331.25FT / 1/8INCH = 41.40625 (COULD BE 1/4” 1/8” 1/16”)(MIGHT NEED TO CONVERT FROM FRACTION TO DECIMAL TO MAKE THE MATH EASIER 1/4 = .25 - 1/8 = .125 – 1/16 = .062)SHOULD ONLY NEED TO HAVE 2 DECIMAL POINTS - 41.40)

(24INCHES + 4 INCHES + 6INCHES = 34INCHES)(41.41INCHES + 34INCHES = 75.41) (CONVERT TO ARCHITECTURAL FT AND INCHES 6’ – 3.41”)))

(6.29FT – 100’(100’ IS THE FINISHED FLOOR ELEAVTION) = 93.7FT)

 

 

CONVERSION MATH:

 

 

6FT – 3-1/2 IN = 6.29 FT

6 FT GETS MOVED SO WE HAVE 6

NOW WE CONVERT THE INCHES TO FT

3 + (1/2IN) = 3.5IN

NOW WE CAN CONVERT THAT INTO FT BY DIVIDING IT BY 12 AS 12IN =1FT

3.5 / 12 = 0.29166666666’

AND NOW LETS CONVERT IT TO 2 DECIMAL POINTS

0.29166666666 = 0.29’

Link to comment
Share on other sites

I have updated the code again, now I know why I love metric. As I dont work in feet just had to find the correct inch/foot values.

 

I have reloaded pipe-block again also.

Link to comment
Share on other sites

I have updated the code again, now I know why I love metric. As I dont work in feet just had to find the correct inch/foot values.

 

I have reloaded pipe-block again also.

 

well i have to say that i am one that feels that the US needs to jump on board with the metric system. but we all know that will never happen.

 

i didnt see anything attached?

Link to comment
Share on other sites

Ok I set it all up and thought it was working and then wondered why values were wrong, when you create the block it is very important to create the attributes in some form of order, when you use the (command "insert" it fills in the block attributes in order not matching tag names. You can insert a block supply defaults then change via tag names but this adds a lot more code to a simple task. The other way is to leave as is and change the "Insert" order.

 

I rehacked the block and recreated the attributes only got 1 out of order and just used the option in bedit to fix.

 

; simple example of filling in a block attributes with calcs
; by Alan H Dec 2017

(defun c:pipe-calc ( / len ans div slabd inv safety tot totslope oldatt )

(if (not AH:getval7) (load "getvals1-8")(princ "loaded"))
(setq oldatt (getvar 'attdia))
(setvar 'attdia 0)
(ah:getval7 "Enter desired slope 1/x 4 8 16" 5 4  "4" "Enter Finished FLR Elev. " 5 4  "100" "Enter length " 5 4 "50"  "Enter Fittings Factor  %" 5 4 "25" "Enter Starting inv " 5 4 "24" "Enter slab depth" 5 4 "4" "Enter safety " 5 4 "6" )

(setq div (/ (/ 1.0 (atof val1)) 12.0 ))
(setq flr (atof val2))
(setq len (atof val3))
(setq perc (/ (atof val4) 100.0))
(setq inv (/ (atof val5) 12.0))
(setq slabd (/ (atof val6) 12.0))
(setq safety (/ (atof val7) 12.0))

(setq totlen (+  (* len  perc) len ))
; this should return the value of total length multiplied by 25%
(setq totslope (* totlen  div) )
(setq totoall (+ (+ (+ inv slabd) safety) totslope))
(setq tot  (- flr totoall))
 
; this should return a value in decimal format for the finished floor elevation - total overall slope. example would be 5' 5-1/2" - 100' = 94.542

(command "-insert" "PIPE-CALC" (getpoint) 1 1 0   (strcat "1/" val1 "\"") val2 val3 val4 val5 val6 val7  (rtos (* totoall 12.0) 3 1)  (rtos tot  2 2))

(setvar 'attdia oldatt)
)
(c:pipe-calc)

 

 

 

ok so i went ahead and did a copy and past of the code that you had updated, saved the getval1-8 and the new block. i created a new folder to place these in and give them a go.

 

well the block and getval1-8 load just fine. the pipe-calc when i load this it is giving me everything in my command line and then stating

 

(Error: bad argument type: streamp nil)

 

so i went thru both of them to see if it was a mis-spelling (like you told me about the changes i made) and the only thing that i could find in the getval1-8 was additional spaces on the line starting (defun AH:getval8.)

 

with the lsp file, line 6 shows getvals1-8 vs getval1-8 like it is in the getval file. not sure if that had anything to do with it so i tried and changed it and i was getting an Error: to few arguments.

 

but this is what is loading in my command line when nothing is changed.

 

loadedddgetval3 : dialog {
: column {
: edit_box {
   key = "key1";
label = "Enter desired slope 1/x 4 8 16";
    edit_width = 5;
    edit_limit = 4;
  is_enabled = true ;
   }
spacer_1 ;
: edit_box {
   key = "key2";
label = "Enter Finished FLR Elev. ";
    edit_width = 5;
    edit_limit = 4;
  is_enabled = true ;
   }
spacer_1 ;
: edit_box {
   key = "key3";
label = "Enter length ";
    edit_width = 5;
    edit_limit = 4;
  is_enabled = true ;
   }
spacer_1 ;
: edit_box {
   key = "key4";
label = "Enter Fittings Factor  %";
    edit_width = 5;
    edit_limit = 4;
  is_enabled = true ;
   }
spacer_1 ;
: edit_box {
   key = "key5";
label = "Enter Starting inv ";
    edit_width = 5;
    edit_limit = 4;
  is_enabled = true ;
   }
spacer_1 ;
: edit_box {
   key = "key6";
label = "Enter slab depth";
    edit_width = 5;
    edit_limit = 4;
  is_enabled = true ;
   }
spacer_1 ;
: edit_box {
   key = "key7";
label = "Enter safety ";
    edit_width = 5;
    edit_limit = 4;
  is_enabled = true ;
   }
   }
spacer_1 ;
ok_only;}
Error: bad argument type: streamp nil
_$ 

 

am i doing something wrong?

Link to comment
Share on other sites

Sorry it was my fault I hardcoded where the dcl was to go, becuase this exists on my pc's it did not cause an error.

 

I have changed this line in all 1-8 (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) it was set to open c:\acadtemp and if it does not exist an error will occur.

 

; Input  Dialog box with variable title
; multiple lines of dcl input supported
; add extra lines if required by copying code defun
; By Alan H 2015
(vl-load-com)
; 1 line dcl
; sample code (ah:getval1 "Line 1" 5 4 "-")
(defun AH:getval1 (title width limit def1 / fo fname)
; you can hard code a directory if you like for dcl file
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : row {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = "  (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title (chr 34) ";"  )   fo)
; these can be replaced with shorter value etc
(write-line (strcat "     edit_width = " (rtos width 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit 2 0) ";" ) fo)
(write-line "   is_enabled = true;" fo)
(write-line "    }" fo)
(write-line "  }" fo)
(write-line "ok_only;}" fo)
(close fo)
(setq dcl_id (load_dialog  fname))
; pt is a list 2 numbs -1 -1 centre ('(20 20))
;(not (new_dialog "test" dch "" *screenpoint*)) 
(if (not (new_dialog "ddgetval" dcl_id))
(exit))
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key1" 3)
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 as a string
(vl-file-delete fname)
) ; defungetval1
; 2 line dcl
; sample code (ah:getval2 "Line 1" 5 4 "1" "Line2" 8 7 "2")
(defun AH:getval2 (title1 width1 limit1 def1 title2 width2 limit2 def2 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval2 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval2" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 as strings
(vl-file-delete fname)
) ; defungetval2
; 3 line dcl
; sample code (ah:getval3 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123")
(defun AH:getval3 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
(vl-file-delete fname)
) ; defungetval3
; 4 line dcl
; sample code (ah:getval4 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456")
(defun AH:getval4 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval4 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval4" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
(vl-file-delete fname)
) ; defungetval4
; 5 line dcl
; sample code (ah:getval5 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789")
(defun AH:getval5 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  title5 width5 limit5 def5  / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval5 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval5" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
;(vl-file-delete fname)
) ; defungetval5
; 6 line dcl
; sample code (ah:getval5 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789")
(defun AH:getval6 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  title5 width5 limit5 def5  title6 width6 limit6 def6 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval5 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key6" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title6 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width6 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit6 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval6" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(mode_tile "key6" 3)
(set_tile "key5" (setq val6 def6))
(action_tile "key5" "(setq val6 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
;(vl-file-delete fname)
) ; defungetval6

; 7 line dcl
; sample code (ah:getval5 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789" "Line 6" 6 4 "789" "Line 7" 6 4 "789")
(defun AH:getval7 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  title5 width5 limit5 def5  title6 width6 limit6 def6  title7 width7 limit7 def7 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key6" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title6 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width6 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit6 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key7" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title7 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width7 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit7 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(mode_tile "key6" 3)
(set_tile "key6" (setq val6 def6))
(action_tile "key6" "(setq val6 $value)")
(mode_tile "key7" 3)
(set_tile "key7" (setq val7 def7))
(action_tile "key7" "(setq val7 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
;(vl-file-delete fname)
) ; defungetval7
; 8 line dcl
; sample code (AH:getval8 "Line 1" 6 4 "0.9" "Line 2" 6 4 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789" "Line 6" 6 4 "987" "Line 7" 6 4 "654" "Line 8" 6 4 "321")
;(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(defun AH:getval8 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  
              title5 width5 limit5 def5 title6 width6 limit6 def6  title7 width7 limit7 def7   title8 width8 limit8 def8 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval8 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key6" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title6 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width6 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit6 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key7" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title7 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width7 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit7 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key8" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title8 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width8 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit8 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval8" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(mode_tile "key6" 3)
(set_tile "key6" (setq val6 def6))
(action_tile "key6" "(setq val6 $value)")
(mode_tile "key7" 3)
(set_tile "key7" (setq val6 def7))
(action_tile "key7" "(setq val7 $value)")
(mode_tile "key8" 3)
(set_tile "key8" (setq val8 def8))
(action_tile "key8" "(setq val8 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
;(vl-file-delete fname)
) 
; defungetval8
; returns the value of val1 val2 and val3 as strings

Link to comment
Share on other sites

Sorry it was my fault I hardcoded where the dcl was to go, becuase this exists on my pc's it did not cause an error.

 

I have changed this line in all 1-8 (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) it was set to open c:\acadtemp and if it does not exist an error will occur.

 

; Input  Dialog box with variable title
; multiple lines of dcl input supported
; add extra lines if required by copying code defun
; By Alan H 2015
(vl-load-com)
; 1 line dcl
; sample code (ah:getval1 "Line 1" 5 4 "-")
(defun AH:getval1 (title width limit def1 / fo fname)
; you can hard code a directory if you like for dcl file
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : row {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = "  (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title (chr 34) ";"  )   fo)
; these can be replaced with shorter value etc
(write-line (strcat "     edit_width = " (rtos width 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit 2 0) ";" ) fo)
(write-line "   is_enabled = true;" fo)
(write-line "    }" fo)
(write-line "  }" fo)
(write-line "ok_only;}" fo)
(close fo)
(setq dcl_id (load_dialog  fname))
; pt is a list 2 numbs -1 -1 centre ('(20 20))
;(not (new_dialog "test" dch "" *screenpoint*)) 
(if (not (new_dialog "ddgetval" dcl_id))
(exit))
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key1" 3)
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 as a string
(vl-file-delete fname)
) ; defungetval1
; 2 line dcl
; sample code (ah:getval2 "Line 1" 5 4 "1" "Line2" 8 7 "2")
(defun AH:getval2 (title1 width1 limit1 def1 title2 width2 limit2 def2 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval2 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval2" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 as strings
(vl-file-delete fname)
) ; defungetval2
; 3 line dcl
; sample code (ah:getval3 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123")
(defun AH:getval3 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
(vl-file-delete fname)
) ; defungetval3
; 4 line dcl
; sample code (ah:getval4 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456")
(defun AH:getval4 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval4 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval4" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
(vl-file-delete fname)
) ; defungetval4
; 5 line dcl
; sample code (ah:getval5 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789")
(defun AH:getval5 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  title5 width5 limit5 def5  / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval5 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval5" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
;(vl-file-delete fname)
) ; defungetval5
; 6 line dcl
; sample code (ah:getval5 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789")
(defun AH:getval6 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  title5 width5 limit5 def5  title6 width6 limit6 def6 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval5 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key6" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title6 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width6 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit6 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval6" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(mode_tile "key6" 3)
(set_tile "key5" (setq val6 def6))
(action_tile "key5" "(setq val6 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
;(vl-file-delete fname)
) ; defungetval6

; 7 line dcl
; sample code (ah:getval5 "Line 1" 5 4 "0.9" "Line 2" 8 7 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789" "Line 6" 6 4 "789" "Line 7" 6 4 "789")
(defun AH:getval7 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  title5 width5 limit5 def5  title6 width6 limit6 def6  title7 width7 limit7 def7 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key6" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title6 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width6 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit6 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key7" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title7 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width7 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit7 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(mode_tile "key6" 3)
(set_tile "key6" (setq val6 def6))
(action_tile "key6" "(setq val6 $value)")
(mode_tile "key7" 3)
(set_tile "key7" (setq val7 def7))
(action_tile "key7" "(setq val7 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
;(vl-file-delete fname)
) ; defungetval7
; 8 line dcl
; sample code (AH:getval8 "Line 1" 6 4 "0.9" "Line 2" 6 4 "wow" "Line 3" 6 4 "123" "Line 4" 6 4 "456" "Line 5" 6 4 "789" "Line 6" 6 4 "987" "Line 7" 6 4 "654" "Line 8" 6 4 "321")
;(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(defun AH:getval8 (title1 width1 limit1 def1 title2 width2 limit2 def2 title3 width3 limit3 def3  title4 width4 limit4 def4  
              title5 width5 limit5 def5 title6 width6 limit6 def6  title7 width7 limit7 def7   title8 width8 limit8 def8 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval8 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key4" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title4 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width4 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit4 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key5" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title5 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width5 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit5 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key6" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title6 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width6 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit6 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key7" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title7 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width7 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit7 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key8" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title8 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width8 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit8 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval8" dcl_id))
(exit))
(mode_tile "key1" 3)
(set_tile "key1" (setq val1 def1))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(set_tile "key2" (setq val2 def2))
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(set_tile "key3" (setq val3 def3))
(action_tile "key3" "(setq val3 $value)")
(mode_tile "key4" 3)
(set_tile "key4" (setq val4 def4))
(action_tile "key4" "(setq val4 $value)")
(mode_tile "key5" 3)
(set_tile "key5" (setq val5 def5))
(action_tile "key5" "(setq val5 $value)")
(mode_tile "key6" 3)
(set_tile "key6" (setq val6 def6))
(action_tile "key6" "(setq val6 $value)")
(mode_tile "key7" 3)
(set_tile "key7" (setq val6 def7))
(action_tile "key7" "(setq val7 $value)")
(mode_tile "key8" 3)
(set_tile "key8" (setq val8 def8))
(action_tile "key8" "(setq val8 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
;(vl-file-delete fname)
) 
; defungetval8
; returns the value of val1 val2 and val3 as strings

 

 

 

wow the calc works great!!!

 

i am having some issues with the block though. attached pictures show when i insert it and after running the calc. i open the PIPE-BLOCK.DWG file and i have made the changes that i wanted to. (i.e. adjusting the text locations) and hit the save button. when i close out the drawing, and then insert the same DWG i was just in the block is back to the way that it was. i am not understanding what is happening?

 

when i try and purge things out it is stating that there are nested items and i can purge them. is there something that i am missing?

after i run the lisp routine.png

when i insert the block into a drawing.png

Link to comment
Share on other sites

Just copy and paste the block only into your new dwg, dont use insert, then erase it the block definition will remain, if you paste and the block already exists if it asks redefine say yes. (roy_043)

 

The block should be in your DWT if it exists now and is visible in the dwt erase it then purge just block "pipe-calc", then copy and paste erase as I said before.

 

Glad to hear its working, I need to spend more time with feet stuff.

Link to comment
Share on other sites

Just copy and paste the block only into your new dwg, dont use insert, then erase it the block definition will remain, if you paste and the block already exists if it asks redefine say yes. (roy_043)

 

The block should be in your DWT if it exists now and is visible in the dwt erase it then purge just block "pipe-calc", then copy and paste erase as I said before.

 

Glad to hear its working, I need to spend more time with feet stuff.

 

Well I was able to get it to work out. And it is working like a champ! Thank you again for taking all this time with someone very green. I have a few ideas that I would like to try, but this time it isn't with math. But not sure how It would work out. If you want me to post stuff to this thread I can or if you want I can directly message you. Let me know if you are interested and I will see about shooting you an example.

 

Thanks again

Link to comment
Share on other sites

Start a new post, their is plenty here that can help. Do a search first try different words if not sure of correct task wording. I use google all the time.

Link to comment
Share on other sites

Start a new post, their is plenty here that can help. Do a search first try different words if not sure of correct task wording. I use google all the time.

 

 

i will be sure to gather my ideas and do some searching. i ran into something when using this lisp and wanted to run it by you and see if you can help me understand. i googled it and i am not find an answer.

 

so when i load the DWG file, Getvals1-8.lsp and the pipe-calc.lsp into a drawing, i have to do the block first, then getvals1-8.lsp and then pipe-calc.lsp. Is there a reason for having to load it this way? cause if i dont load the gevals1-8.lsp first i am getting an error:

 

(Command: (LOAD "C:/Users/davesalzinger/Desktop/new invert lisp/pipe-calc.lsp") Error: no function definition: C:PIPE-CALC)

 

and i did make a change to the lisp here:

from: (defun c:pipe-calc ( / len ans div slabd inv safety tot totslope oldatt )

to: (defun c:invert ( / len ans div slabd inv safety tot totslope oldatt )

 

just so the keys i would type is a little easier. and what is the "AH" in this line:

(if (not AH:getval7) (load "getvals1-8")(princ "loaded"))

i am not finding this on google.

 

even though i am getting that error i am still able to run the command as if it was loaded already. just weird i guess

 

 

thanks again

Link to comment
Share on other sites

AH Alan H same as lee-mac most of his defuns are LM: this is done to make sure defuns are not duplicated by another programmer AH:T2T v's T2T,

 

As I suggested it sounds like your not using a drawing template this has all the stuff that you want already in a dwg but has no subject matter, it does have title blocks in layouts etc Google "why use dwt"

 

If you check your supported paths the getval load will work perfect. By that I mean you need to save the lisps in a directory where Autocad knows where to find them. Do CONFIG, FILES, Supportpath and make sure you add the location of your lisps, "C:/Users/davesalzinger/Desktop/new invert lisp. Just me I would have my stuff more like in a directory c:/my Autocad/lisps. I also have other directories under the myAutocad like /blocks, /dwts.

 

If your working on some one elses drawing then you need to do the add block bit, before I go down that path and change the code. Experienced users would have a script or lisp or combination that adds stuff, cleans up, changes layers and so on. We do this every day to our field survey dwg's where they want it one way and we want stuff a different way.

 

Can you clarify which scenario your starting your dwg's.

Link to comment
Share on other sites

AH Alan H same as lee-mac most of his defuns are LM: this is done to make sure defuns are not duplicated by another programmer AH:T2T v's T2T,

 

As I suggested it sounds like your not using a drawing template this has all the stuff that you want already in a dwg but has no subject matter, it does have title blocks in layouts etc Google "why use dwt"

 

If you check your supported paths the getval load will work perfect. By that I mean you need to save the lisps in a directory where Autocad knows where to find them. Do CONFIG, FILES, Supportpath and make sure you add the location of your lisps, "C:/Users/davesalzinger/Desktop/new invert lisp. Just me I would have my stuff more like in a directory c:/my Autocad/lisps. I also have other directories under the myAutocad like /blocks, /dwts.

 

If your working on some one elses drawing then you need to do the add block bit, before I go down that path and change the code. Experienced users would have a script or lisp or combination that adds stuff, cleans up, changes layers and so on. We do this every day to our field survey dwg's where they want it one way and we want stuff a different way.

 

Can you clarify which scenario your starting your dwg's.

 

 

Ok the AH makes sense. But if that is for someone to not duplicate the defuns, couldn't they just remove the AH: and put something else there? Or is that embedded somewhere? I am not looking to do this, just wondering cause a guy that I work with, happens to be one the "loud mouth, know it all" "hey that was my idea" kind of guys and I can’t stand when someone takes credit for something that they didn't do.

 

So everything that I am working on is through my work. We get the files from an Architect and then we use them to create our designs. I would agree that this should be in a file like you suggested. The hard part is that the company that I work for really doesn’t like people to save stuff like this on to the server. They actually do a system purge for things to make sure that we are doing things “their” way. This is the reason that I had this stuff on a flash drive and would load this in when I want to use it. Now I don’t have an issue doing this at all.

 

Now there is one case where we had someone working for us that was really good at doing custom lisps, and he found a file and create some custom stuff for people and did something so that it would get purged. (However from time to time they will lock out any and all lisp’s in our company directory (I saved down a copy of all of these so I still have access to them.) and this will lock our office out until they unlock it.)

 

I am able to get this to work with no issues, even If I am seeing that error pop up. I was just wondering. But right now what I need to do is make sure that I have the three files that work and are the ones that I want to keep and delete the rest of the ones that I have. (I kept them just to see the differences that I did)

 

I have one flash drive that has only my lisp routines, blocks etc. this way I know what is what and where it is. I still need to search this but I want to have something that I would be able to do a command and have it create certain layers for me. But like I said that is something I need to look into still. And I don’t want you to think that I want you to change the code or anything I just want to make sure that I understand everything, even if it is little by little. Sorry this was so long.

Link to comment
Share on other sites

create certain layers for me

 

This is what a script could do for you save as mylayer.scr basicly type it into a file what you would type on the command line without the dialouge help. This could include stuff like insert the pipe-calc block.

 

-layer m newlayer1 c 1 newlayer1 lt dashed newlayer1
-layer m newlayer2 c 4 newlayer2 lt dashed2 newlayer2
-layer m newlayer3 c 5 newlayer3 lt Contiuous newlayer3

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