Here's another trick you can use. The (mapcar) function can do things like add together the
corresponding elements of two lists, so you can make your NEWPT by adding BP to a virtual "point"
with INV for its Y component, and zero for the others. That way, you don't need to extract the
elements of your BP value, add to one of them, and then put them back together. You could replace
this much:
(setq X (car BP)
Y (+ INV (cadr BP))
Z (caddr BP)
)
(setq NEWPT (list X Y Z))
with just this:
(setq NEWPT (mapcar '+ BP (list 0 INV 0)))
and eliminate the X Y Z from the local variables list.
--
Kent Cooper
wrote...
Thank you both, Ian and Kent. That was a big help in getting this to function. Yes, the string was
breaking me. I added a couple of things and it is working perfectly. Here is the code with all
updates at this point in time. I am sure I will add some more error checking and the like.
[start code]
(defun c:sm (/ BP X Y Z NEWPT INV RIM YS)
(setvar "osmode" 1)
(setq BP (getpoint "\nPick point: "))
(setvar "osmode" 0)
(setq INV (getreal "\nInvert elevation:"))
(setq RIM (getreal "\nRim elevation:"))
(setq X (car BP)
Y (+ INV (cadr BP))
Z (caddr BP)
)
(setq NEWPT (list X Y Z))
(setq YS (- RIM INV))
(command "-insert" "smh" NEWPT "" YS "")
)
[end code]