(defun C:bb (/ OS OE SS VSS N I D LEN E OBJ E)(princ "\n等分打断线段")
(defun *ERROR* (MSG)(setvar "osmode" OS)(vl-cmdf ".undo" "e")(setq *ERROR* OE))(vl-cmdf ".undo" "be")
(princ "\n选择要等分的物件:")(setq OE *ERROR* OS (getvar "osmode")SS (ssget '((0 . "LINE,*POLYLINE,SPLINE,ARC"))))(setvar "osmode" 0)
(or (setq N (getint "\n定数等分<需定距等分/直接回车>:"))(setq D (getdist "\n指定线段长度:")))(setq I 0)
(if SS (repeat (sslength SS)(setq E (ssname SS I))(setq LEN (vlax-curve-getdistatparam E (vlax-curve-getendparam E)))
(if N (setq D (/ LEN N) M N )(setq M (1+ (fix (/ LEN D)))))(repeat (1- M)
(if (setq PT (vlax-curve-getpointatdist E D))(vl-cmdf ".break" (list E PT) PT))(setq E (entlast)))(setq I (1+ I))))(setvar "osmode" OS)(vl-cmdf ".undo" "e")(princ))