求CAD一组串联的直线和圆弧,偏移后的坐标点,如图,求第三种情况的坐标点,如有计算方法请联系我,超级感谢!



(defun c:offset ()
(setq offset-distance 10)
(setq old-ents (ssget))
(setq new-ents (ssadd))
(repeat (sslength old-ents))
(setq old-ent (ssname old-ents 0))
(setq ss (ssadd (entget old-ent) new-ents))
(setq type (cdr (assoc 0 (entget old-ent))))
(if (or (eq type "LINE")
(eq type "ARC"))
(progn
(setq start-point (cdr (assoc 10 (entget old-ent))))
(setq end-point (cdr (assoc 11 (entget old-ent))))
(setq direction (mapcar '- end-point start-point))
(setq len (distance start-point end-point))
(if (eq type "ARC")
(progn
(setq center (cdr (assoc 10 (entget old-ent))))
(setq orientation (cdr (assoc 51 (entget old-ent))))
(if (> (car direction) 0)
(setq offset-direction (if (> orientation 0) (cons -1 0) (cons 1 0)))
(setq offset-direction (if (> orientation 0) (cons 1 0) (cons -1 0))))
(if (> orientation 0)
(setq normal-direction (if (> (car direction) 0) (cons 0 -1) (cons 0 1)))
(setq normal-direction (if (> (car direction) 0) (cons 0 1) (cons 0 -1))))
(setq radius (cdr (assoc 40 (entget old-ent))))
(setq angle (cdr (assoc 51 (entget old-ent))))
(setq off-angle (/ (* offset-distance 180) (* radius pi)))
(if (> angle 0)
(setq offset-angle (+ angle off-angle))
(setq offset-angle (- angle off-angle)))
(if (> radius 0)
(progn
(setq offset-start-point (polar center (+ angle off-angle) (- radius offset-distance)))
(setq offset-end-point (polar center (+ offset-angle angle) (- radius offset-distance)))
(if (< offset-angle 0)
(setq offset-angle (+ offset-angle 360)))
(command "arc" offset-start-point center offset-end-point)
)
)
)
(progn
(if (> (car direction) 0)
(setq offset-direction (cons 1 0))
(setq offset-direction (cons -1 0)))
(if (> (car direction) 0)
(setq normal-direction (cons 0 -1))
(setq normal-direction (cons 0 1)))
(setq offset-start-point (mapcar '+ start-point (mapcar '* offset-direction offset-distance)))
(setq offset-end-point (mapcar '+ end-point (mapcar '* offset-direction offset-distance)))
(command "line" offset-start-point offset-end-point)
)
)
)
)
(setq old-ents (ssdel old-ent old-ents))
)
)