You can always find the sequence of prompts to respond to by starting the command in an AutoLisp (command) function at the command line, i.e. (command "_.wblock"). [That's better than using -WBLOCK at the command line, because in some cases they work a little differently.]
You should be able to do it like this [untested -- I didn't set up the folder structure]:
(defun c:dt (/ DIA OFF c1)
(setq
DIA (getdist "Outside diameter: ")
OFF (getdist "Wall Thickness: ")
)
(command "_.circle" "0,0" "D" DIA)
(setq c1 (entlast)); for later object selection
(command
"_.circle" "0,0" "D" (- DIA (* OFF 2))
"_.wblock"
(strcat "C:\\SteelProfiles\\CHS\\CHS " (rtos DIA 2 1) " " (rtos OFF 2 1))
"" "0,0" ; new-drawing option, insertion point
c1 (entlast) "" ; object selection
)
(princ)
)
Come to think of it, if you start in a clean empty Purged drawing, with 0,0 as its insertion base point, you could use the whole-drawing option instead of object selection. That would eliminate the need for the c1 variable and the splitting up of the commands, but it retains the Circles, so if you want them gone to make another, they need to be Erased:
(defun c:dt (/ DIA OFF)
(setq
DIA (getdist "Outside diameter: ")
OFF (getdist "Wall Thickness: ")
)
(command
"_.circle" "0,0" "D" DIA
"_.circle" "0,0" "D" (- DIA (* OFF 2))
"_.wblock"
(strcat "C:\\SteelProfiles\\CHS\\CHS " (rtos DIA 2 1) " " (rtos OFF 2 1))
"*" ; entire-drawing option
"_.erase" "_all" ""
)
(princ)
)
EDIT: [I've removed an erroneous right parenthesis from the second one, so if you caught it before that, it would explain the fact that it didn't work right.]
Then there's the question, in all of these, of whether you should build in a check on whether the drawing name is already in that folder....
Further EDIT: Come to think of it some more, if you start in a clean drawing like that, you could use SAVE instead of WBLOCK, and eliminate the need to answer a prompt beyond giving it the file location/name:
(defun c:dt (/ DIA OFF)
(setq
DIA (getdist "Outside diameter: ")
OFF (getdist "Wall Thickness: ")
)
(command
"_.circle" "0,0" "D" DIA
"_.circle" "0,0" "D" (- DIA (* OFF 2))
"_.save" (strcat "C:\\SteelProfiles\\CHS\\CHS " (rtos DIA 2 1) " " (rtos OFF 2 1))
"_.erase" "_all" ""
)
(princ)
)
Kent Cooper, AIA