 - (vl-load-com)
- (defun c:pp (/ en1 pt pt1 pt2 Deriv ang ang1 ang2 l n i)
- (setvar "cmdecho" 0)
- (command "undo" "group")
- (setq en1 (entsel "\n选择焊件:")
- pt (cadr en1)
- en1 (car en1)
- pt1 (vlax-curve-getClosestPointTo en1 pt)
- Deriv (vlax-curve-getSecondDeriv
- en1
- (vlax-curve-getParamAtPoint en1 pt1)
- )
- ang1 (angle pt1 pt)
- ang2 (angle pt1 (mapcar '+ pt1 Deriv))
- l (vlax-curve-getdistatPoint en1 (vlax-curve-getendPoint en1))
- n (fix(/ (- l 0.4) 0.533333))
- i 0
- )
- (repeat (1+ n)
- (setq pt (vlax-curve-getPointAtDist en1 (+ 0.4 (* 0.53333 i)))
- i (1+ i)
- )
- (if (equal Deriv '(0. 0. 0.) 1e-6)
- (entmake (list '(0 . "line")
- (cons 10 pt)
- (cons 11 (polar pt ang1 0.46666666666))
- )
- )
- (if (equal ang1 ang2 1e-6)
- (entmake
- (list
- '(0 . "line")
- (cons 10 pt)
- (cons
- 11
- (polar pt
- (angle pt
- (mapcar '+
- pt
- (vlax-curve-getSecondDeriv
- en1
- (vlax-curve-getParamAtPoint en1 pt)
- )
- )
- )
- 0.46666666666
- )
- )
- )
- )
- (entmake
- (list
- '(0 . "line")
- (cons 10 pt)
- (cons
- 11
- (polar
- pt
- (+ pi
- (angle pt
- (mapcar '+
- pt
- (vlax-curve-getSecondDeriv
- en1
- (vlax-curve-getParamAtPoint en1 pt)
- )
- )
- )
- )
- 0.46666666666
- )
- )
- )
- )
- )
- )
- )
- (command "undo" "end")
- (princ)
- )
|