PDA

View Full Version : Need Simple Routine Error Trapped



drawingisfun
2013-02-14, 07:21 AM
I wrote this, but unfortunately never learned to error trap real well... will someone help me?



(defun c:flt ()
(command "undo" "begin")
(setq suffix (getstring "\nSuffix?"))
(print "Select Featureline:")
(setq featureobj (vlax-ename->vla-object ([car (entsel))))
(while (= 0 0)
(setq location (getpoint "\nPoint Along Feature Line:"))
(setq location (vlax-curve-getClosestPointToProjection featureobj location '(0 0 1)))
(setq param (vlax-curve-getParamAtPoint featureobj location))
(setq pointdata (vlax-curve-getPointAtParam featureobj param))
(setq xpt (car pointdata))
(setq ypt (cadr pointdata))
(setq xy (list xpt ypt))
(setq elev (caddr pointdata))
(setq elev (rtos elev 2 2))
(command "-insert" "BlockName" xy 20.0 "45.0" elev suffix))
(command "undo" "end")
(princ));;;