选择块,获取“标记”值t
你好我正在尝试“创建”一个lisp,它可以执行以下操作:
1º选择标记为“DD”的块并获取值
2º检查“表”中的值:
“DD”“半径”
8 1
10 2
12 3
16 4
20 8
25 10
32 13
3º选择多段线,并使用在点“2º”中获得的“半径”进行圆角。
我已经为我在这个论坛中找到的“3º”点编写了一些代码:
(defun c:MPL_Fillet (/ ss en rad n)
(setq rad (getvar "FILLETRAD"))
(initget (+ 1 4 8 64 128))
(if (/= ""
(setq rad
(getdist (strcat "Enter fillet radius <" (rtos rad) ">: "))
) ;_ end of setq
) ;_ end of =
(setvar "FILLETRAD" rad)
) ;_ end of if
(prompt "\nSelect the polylines you'd whish to fillet: ")
(setq ss (ssget '((0 . "LWPOLYLINE,POLYLINE")))
n0
) ;_ end of setq
(while (< n (sslength ss))
(setq en (ssname ss n))
(command "_FILLET" "P" en)
(setq n (1+ n))
) ;_ end of while
(princ)
) ;_ end of
但是,不是输入半径,而是“表”中对应的半径。
谢谢 试试这个
(setq obj (vlax-ename->vla-object(car (entsel "pick block")))
(foreach att (vlax-invoke obj 'getattributes)
(if (= "DD" (vla-get-tagstring att))
(setq dd (vla-get-textstring att))
)
)
(if (= dd nil)
(progn
(alert "Block has no DD att will exit")
(exit)
)
)
(cond
((= dd "8")(setvar "filletrad" 1))
((= dd "10")(setvar "filletrad" 2))
((= dd "12")(setvar "filletrad" 3))
)
(c:mpl_fillet)
谢谢BIGAL,但我发现了这个错误:
“错误:输入列表格式不正确”
添加此括号
在您的代码中,这部分应该不是必需的,因为“filletrad”是由BIGAL的cond语句设置的:
(initget (+ 1 4 8 64 128))
(if (/= ""
(setq rad (getdist (strcat "Enter fillet radius <" (rtos rad) ">: "))) ;_ end of setq )
;_ end of =(setvar "FILLETRAD" rad) ) ;_ end of ifHTH
沃尔夫冈 谢谢大家,
它正在工作 谢谢你的计划,复制和粘贴有时只是一个括号。
页:
[1]