(defun c:dx(/ oldWdt varLst oldVar plObj eDis
cDis curAng plLst cWid *error*)
(vl-load-com)

(defun *error*(msg)
(if oldVar(mapcar 'setvar varLst oldVar))
(princ)
); end of *error*

(if(not flex:width)(setq flex:width 6.0))
(setq oldWdt flex:width
flex:width(getdist(strcat "\nSpecify flex width by 2 points on screen : "))
varLst(list "CMDECHO" "FILLMODE" "PLINEWID" "OSMODE")
oldVar(mapcar 'getvar varLst))
(if(null flex:width)(setq flex:width oldWdt))
(mapcar 'setvar varLst(list 0 1 flex:width 0))
(princ "\nSpecify first point: ")
(command "_.pline" pause "_arc")
(while(= 1(getvar "CMDACTIVE"))
(princ "\nSpcecify next point: ")(command pause))
(setq plObj(vlax-ename->vla-object(entlast))
eDis(/ flex:width 8) cWid(/ flex:width 2) cDis 0.0)
(while(setq cPnt(vlax-curve-GetPointAtDist plObj cDis))
(setq cDer(vlax-curve-GetFirstDeriv plObj
(vlax-curve-GetParamAtPoint plObj cPnt))
curAng(- pi(atan(/(car cDer)(cadr cDer)))))
(if(< curAng pi)(setq curAng(- curAng pi)))
(setq plLst(cons(polar cPnt curAng(setq cWid(- cWid)))plLst)
cDis(+ cDis eDis)))
(vla-Delete plObj)(setvar "PLINEWID" 0.0)
(command "_.pline")(mapcar 'command plLst)(command)
(mapcar 'setvar varLst oldVar)
(princ)
); end of c:dx
(c:dx)

Advertisements