二维多段线或多段线批量按从左到右从上到下连3dpoly三维多段线时z值为空,如何修改?
[*];XDDX等高线之间批量连线竖直按从左到右从上到下连3dpoly三维多段线波总指导
[*](DEFUN C:XDDX()(princ"XDDX块之间批量连线H竖直按从上到下从左到右连线波总QWQ")(XDDX2023)(princ))
[*](defun XDDX2023(/ e i p s ss)
[*](princ "XDDD图元之间批量竖直按从左到右从上到下连三维多段线波总")
[*](setvar "CMDECHO" 0)
[*](if (and (setq s (ssget))
[*] ;(if (and (setq s (ssget '((0 . "INSERT"))));兼容POINT点、圆circle、块INSERT等
[*] (< 1 (sslength s))
[*] (setq i -1)
[*] )
[*] (progn
[*] (while (setq e (ssname s (setq i (1+ i))))
[*] (setq RQW202405202324(cdr (assoc 10 (entget e))))
[*] ;(SETQ laynamA10(cdr (assoc 10 (entget (car laynamA00)))));获取所选图元A的端点10坐标xyz
[*] (SETQ STRXA10 (rtos (car RQW202405202324) 2 16)) ;_内容X
[*] (SETQ STRYA10 (rtos (cadr RQW202405202324) 2 16)) ;_内容Y
[*] ;(SETQ STRzA10 (rtos (caddr RQW202405202324) 2 16)) ;_内容z
[*] (SETQplineZ38 (cdr (assoc 38 (entget e)))) ;获取所选图元的标高值=高线高程Z值
[*] (setq plineZ388(rtos plineZ38 2 16));标高值=等高线高程Z值
[*] (SETQ plineZ38pt (strcat "("STRXA10" "STRYA10" "plineZ388")"));外观交点值XY坐标值与等高线高程值重新组合为XYZ值
[*] ;(princ RQW202405202324)
[*] ;(terpri);回行显示下一项屏显
[*] ;(princ plineZ38pt)
[*] ;(terpri);回行显示下一项屏显
[*] ;(cdr (assoc 10 (entget e)))
[*] ;(setq ss (cons plineZ38pt ss))
[*] (setq ss (cons (cons STRXA10 (cons STRYA10 (cons plineZ388 NIL))) ss))
[*] ;(setq ss (cons (cons STRXA10 (cons STRYA10 (cons plineZ388 ))) ss))
[*] ;(setf ss (cons STRXA10(cons STRYA10 (cons plineZ388 (cons ss nil)))))
[*] (princ ss)
[*] (terpri);回行显示下一项屏显
[*] ;(setq ss (cons (cdr (assoc 10 (entget e))) ss))
[*]
[*] )
[*] (setq ss ;
[*] (vl-sort ss
[*] '(lambda(a b)
[*] (cond
[*] ((and (equal (cadr a) (cadr b) 1e-5) (< (car a) (car b))) T);按H竖向顺序排序关键语句
[*] ((> (cadr a) (cadr b)))
[*] )
[*] )
[*] );Get-Att-ributes
[*] )
[*] (command "3dpoly" )
[*] (foreach x ss (command "non" x))
[*] (command "")
[*] )
[*])
[*](setvar "CMDECHO" 1)
[*](princ)
[*])本来:
[*](progn
[*] (while (setq e (ssname s (setq i (1+ i))))
[*] (setq ss (cons (cdr (assoc 10 (entget e))) ss))
[*] )就能顺利实施连线功能,而且还是图块直线文字等都能批量连线,就是面对多段线(等高线)有点遗憾!
看了半天 没明白是啥是啥问题还没解决吗分享的代码用于哪方面 至少要搞个动图图片或者dwg文件等的 guosheyang 发表于 2024-5-30 06:37
看了半天 没明白是啥是啥问题还没解决吗分享的代码用于哪方面 至少要搞个动图图片或者dwg文件等 ...
guosheyang大侠好!感谢指导!我本来有一个代码:
;XSSX块之间批量连线水平按从左到右从上到下连3dpoly三维多段线波总
(DEFUN C:XSSX()(princ"XSSS块之间批量连线水平V按从左到右从上到下连线波总QWQ")(XSSX2023)(princ))
(defun XSSX2023(/ e i p s ss)
(princ "XSSS块之间批量连线水平按从左到右从上到下连线波总")
(setvar "CMDECHO" 0)
(if (and (setq s (ssget))
;(if (and (setq s (ssget '((0 . "INSERT"))));兼容POINT点、圆circle、块INSERT等
(< 1 (sslength s))
(setq i -1)
)
(progn
(while (setq e (ssname s (setq i (1+ i))))
(setq ss (cons (cdr (assoc 10 (entget e))) ss));
)
(setq ss
(vl-sort ss
'(lambda(a b)
(cond
((and (equal (car a) (car b) 1e-5) (< (cadr a) (cadr b))) T);按V水平顺序排序关键语句
((> (car a) (car b)))
)
)
);GetAttributes
)
(command "3dpoly" )
(foreach x ss (command "non" x))
(command "")
)
)
(setvar "CMDECHO" 1)
(princ)
)
能把图元能获取特征值10的端点坐标(xyz)都能连3DPoly线(带xyz),二多段线只有xy值,没有z值,我们就想提取38属性→标高值→糅合到xy值→形成xyz值→就能顺利画出连3DPoly线了!现在是这个“糅合”xyz的关键语句搞不好,辛苦大侠指导……一下
页:
[1]