admin 发表于 2024-10-6 19:52:04

椭圆转SPLINE.lsp

;椭圆转SPLINE 明经 ZZXXQQ 2008.2.1
(defun c:tt ()
(setvar "CMDECHO" 0)
(setq oldos (getvar "OSMODE"))
(if (and (setq s1 (entsel "\nSelect a Ellipse 选择椭圆 :"))
          (setq ent (entget(car s1)))
          (= (cdr(assoc 0 ent)) "ELLIPSE")
) (progn
(command ".undo" "BE")
(command "divide" s1 16)
(setq p1 (cdr(assoc 10 ent))
      p2 (cdr(assoc 11 ent))
      p2 (polar p1 (angle '(0 0) p2) (distance '(0 0) p2))
      p3 (polar p2 (+ (angle p1 p2) (/ pi -2)) 5))
(setq ss (ssget "P"))
(setq pt (cdr(assoc 10 (entget(ssname ss 0)))))
(setq i 0)
(setvar "OSMODE" 0)
(command ".spline" pt)
(repeat (1- (sslength ss))
   (setq pt (cdr(assoc 10 (entget(ssname ss (setq i (1+ i)))))))
   (command pt)
)
(command "c" p3)
(setvar "OSMODE" oldos)
(command ".erase" ss (car s1) "")
(command ".undo" "E")
))
(setvar "CMDECHO" 1)
(princ)
)
页: [1]
查看完整版本: 椭圆转SPLINE.lsp