spline要用院长那个,椭圆的里面自定义函数太多,懒得找了
- ;;;=============================================
- ;;; 通用函数 根据线上点重建直线
- ;;;参数: en------直线图元
- ;;; pts-----线上点表(wcs)
- ;;;返回值:line图元名表
- (defun xty-make-line@pt (en pts / ent pt1 pt2)
- (setq pt1 (vlax-curve-getstartpoint en)
- pt2 (vlax-curve-getendpoint en)
- ent (entget en)
- pts (vl-sort
- pts
- (function (lambda (x y)
- (< (vlax-curve-getparamatpoint en x)
- (vlax-curve-getparamatpoint en y))))))
- (if (null (equal pt1 (car pts) 1e-6))
- (setq pts (cons pt1 pts)))
- (if (null (equal pt2 (last pts) 1e-6))
- (setq pts (reverse (cons pt2 (reverse pts)))))
- (mapcar (function
- (lambda (x y)
- (setq ent (subst (cons 10 x) (assoc 10 ent) ent))
- (setq ent (subst (cons 11 y) (assoc 11 ent) ent))
- (entmakex ent)))
- pts
- (cdr pts)))
- ;;;=============================================
- ;;; 通用函数 根据圆弧上点重建圆弧
- ;;;参数: en------圆弧图元
- ;;; pts-----圆弧上点表(wcs)
- ;;;返回值:arc图元名表
- (defun xty-make-arc@pt (en pts / cen ent pt1 pt2)
- (setq cen (xty-get-dxf 10 en)
- ent (entget en)
- pt1 (vlax-curve-getstartpoint en)
- pt2 (vlax-curve-getendpoint en)
- pts (vl-sort
- pts
- (function (lambda (x y)
- (< (vlax-curve-getparamatpoint en x)
- (vlax-curve-getparamatpoint en y))))))
- (if (null (equal pt1 (car pts) 1e-6))
- (setq pts (cons pt1 pts)))
- (if (null (equal pt2 (last pts) 1e-6))
- (setq pts (reverse (cons pt2 (reverse pts)))))
- (mapcar (function
- (lambda (x y)
- (setq ent
- (subst (cons 50
- (angle cen (trans x 0 en)))
- (assoc 50 ent)
- ent))
- (setq ent
- (subst (cons 51 (angle cen (trans y 0 en)))
- (assoc 51 ent)
- ent))
- (entmakex ent)))
- pts
- (cdr pts)))
- ;;;=============================================
- ;;; 通用函数 根据圆上点重建打断圆
- ;;;参数: en------圆图元
- ;;; pts-----圆上点表(wcs)
- ;;;返回值:arc图元名表
- (defun xty-make-circle@pt (en pts / cen)
- (setq cen (xty-get-dxf 10 en)
- pts (vl-sort
- pts
- (function (lambda (x y)
- (< (vlax-curve-getparamatpoint en x)
- (vlax-curve-getparamatpoint en y)))))
- pts (cons (last pts) pts))
- (mapcar
- (function
- (lambda (x y)
- (entmakex
- (cons
- (cons 0 "arc")
- (append
- (xty-get-dxflf (list -1 0 5 100 330)
- en)
- (list
- (cons 50
- (angle cen (trans x 0 en)))
- (cons 51
- (angle cen (trans y 0 en)))))))))
- pts
- (cdr pts)))
|