各位大神看一下把这些编号按不同图层按数字顺序连线起来Y1-Y2-Y3-Y4
各位大神看一下把这些编号按不同图层按数字顺序连线起来Y1-Y2-Y3-Y4 以此类推 W1-W2-W3-W4以此类推(DEFUN C:TT(/ S lst portext e en l1 a p lst)
(defun portext(en / p)(if(equal(setq p(cdr(assoc 10 en)))'(0 0 0))(cdr(assoc 11 en))p))
(and(SETQ S(SSGET'((0 . "TEXT"))))
(while(setq e(ssname s 0))
(setq en(entget e)a(cdr(assoc 1 en))p(list(substr a 1 1)(cons(read(substr a 2))(portext en))))
(ssdel e s)
(if(setq l1(assoc(car p)lst))
(setq lst(subst(vl-list*(car p)(cadr p)(cdr l1))l1 lst))
(setq lst(cons p lst))))
(vl-every(function(lambda(x)
(entmakex(append(mapcar'cons'(0 100 100 62 90)(list"lwPolyline""AcDbEntity""AcDbPolyline"(1+(vl-position x lst))(length(cdr x))))
(mapcar'(lambda(x)(cons 10(cdr x)))(vl-sort(cdr x)'(lambda(x y)(<(car x)(car y)))))))))lst))) guosheyang 发表于 2022-8-6 22:46
你这不就是从所有文字中 依次找到内容为y1的点提取基点坐标y2的点提取坐标一直到y49 的基点提出 ...
应该是这样的大神 (defun c:tt (/ ss lst n fu en obj wz pt lst1);根据文字内容连线
(vl-load-com)
(if (setq ss (ssget '((0 . "*TEXT"))))
(progn
(setq lst nil
n -1
fu (lambda (str)
(if (wcmatch str "#*")
(atoi str)
(fu (substr str 2))
)
)
)
(while (setq en (ssname ss (setq n (1+ n))))
(setq obj (vlax-ename->vla-object en)
wz(vla-get-TextString obj)
pt(vlax-safearray->list
(vlax-variant-value (vla-get-InsertionPoint obj))
)
)
(if (setq lst1 (car (vl-remove-if-not
'(lambda (x) (wcmatch wz (car x)))
lst
)
)
)
(setq lst
(subst (append lst1 (list (list (fu wz) pt))) lst1 lst)
)
(setq lst
(cons
(list
(strcat (vl-string-trim (itoa (setq x (fu wz))) wz)
"#*"
)
(list x pt)
)
lst
)
)
)
)
(setq n 0)
(mapcar
'(lambda (x)
(entmake
(append
(list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(cons 62 (setq n (1+ n)))
(cons 90 (length x))
)
(mapcar '(lambda (pt) (cons 10 pt)) x)
)
)
)
(mapcar
'(lambda (x)
(mapcar 'cadr
(vl-sort x '(lambda (a b) (> (car a) (car b))))
)
)
(mapcar 'cdr lst)
)
)
)
)
)
你这不就是从所有文字中 依次找到内容为y1的点提取基点坐标y2的点提取坐标一直到y49 的基点提出来然后连成多段线即可 w1 到w57的也一样
uualice2020 发表于 2022-8-6 21:56
大神可以上下代码吗 kkq0305 发表于 2022-8-6 22:45
(defun c:tt (/ ss lst n fu en obj wz pt lst1);根据文字内容连线
(vl-load-com)
(if (setq ss (ssg ...
谢谢大神非常感谢 uualice2020 发表于 2022-8-6 21:56
大佬牛叉叉~ llsheng_73 发表于 2022-8-7 15:54
浓缩的代码,大佬666
页:
[1]
2