返回二次三次拟合线控制点坐标
返回二次三次拟合线控制点坐标(defun vxs ( ent / PLTYPE obj vtx vtxlst n ptlst);提取多段线顶点坐标
(vl-load-com)
; (setq ent (entsel "\n选取多线:\n"))
(if ent
(progn
(setq PLTYPE (cdr (assoc 0 (entget (car ent)))))
(if (or (= "POLYLINE" PLTYPE) (= "LWPOLYLINE" PLTYPE))
(progn
(setq obj (vlax-ename->vla-object (car ent)))
(setq vtx (vla-get-Coordinates obj))
(setq vtxlst (vlax-safearray->list (vlax-variant-value vtx)))
(setq n 0)
(setq ptlst nil)
(repeat (/ (length vtxlst) 3)
(setq ptlst (append ptlst (list (list (nth n vtxlst) (nth (1+ n) vtxlst)(nth (+ n 2) vtxlst) ))))
(setq n (+ n 3))
)
(if ptlst ptlst nil)
)
(prompt "\n选取实体不是多义线!")
);if
)
)
;if
ptlst
);;;;;;;-------------------
(setq e (entsel "\n选择多段线:"))
(entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length (vxs e))))
(mapcar '(lambda (pt)(cons 10 pt)) (vxs e) ))
)
;;;(vlax-safearray->list (vlax-variant-value (vla-get-Coordinates (vlax-ename->vla-object (car (entsel))))))
命令: (VL-LOAD-COM)
命令: (vlax-safearray->list (vlax-variant-value (vlax-get-property
(vlax-ename->vla-object(car(entsel)) ) 'Coordinates) ))
选择对象: (1258.43 660.372 0.0 1719.35 558.429 0.0 2087.03 1041.78 0.0)
树櫴希德 发表于 2023-6-22 19:34
(setq en1 (car(entsel "\n please select lwpoliline")) )
(setq en (entget en1 '("*") ))
(setqen (vl-remove-if '(LAMBDA (x) (= (car x) 10))en ))
(setq en (subst '(0 . "POLYLINE") '(0 . "LWPOLYLINE") en))
(setq en (subst '(100 . "AcDb2dPolyline") '(100 . "AcDbPolyline") en))
(setq en (append en (list '(66 . 1))))(setq en (append en (list '(10 0.0 0.0 0.0))))
(setq en (append en (list '(71 . 0))))
(setq en (append en (list '(72 . 0))))
(setq en (append en (list '(73 . 0))))
(setq en (append en (list '(74 . 0))))
(setq en (append en (list '(75 . 0))))
(entmod en )
(vlax-ename->vla-object(car(entsel)) )
(entget(car(entsel))'("*"))
不错的帖子 顶一下 标记 备用 会用到 树櫴希德 发表于 2023-6-22 19:34
(vl-load-com)
;(vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object(car(entsel)) ) 'Coordinates) ))
(defun vxs (e / )
(vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-objecte ) 'Coordinates) ))
;;;;;;;;;;;;;;;
)
(defun c:tt11 ( / lst ent pts pt demj zmj ffn ff i) ;生成CASS三角网文件SJW
(setq lst (ssget '( (0 . "*polyline,3dface") (8 . "SW-自然地表模型")) ) )
(setq i 0)
(setq ffn (getfiled "选取/建立数据导出文件" "" "sjw" 1))
(setq ff (open ffn "w"))
(while(< i (sslength lst))
(setq ent (ssname lst i))
(setq pts (vxs ent)); 3DFACE本来应该去除第四点,但本程序未去除
(foreach x pts
(princ(strcat (rtos x 2 3) "\n" ) ff)
)
(setq i (+ i 1))
)
(close ff)
(princ)
)
朴大侠的“二次三次拟合线控制点坐标”经过优化→辛苦把优化后的文件文件发上来好吧?
页:
[1]