chenbh2 发表于 2015-3-22 12:00:08

文字条件赋值

一、(setq sss (ssget'((0 . "TEXT"))))或 (setq ss (ssget (list '(0 . "TEXT") )))框选后得到sss.
请教如何将sss分解成
1、在sss中将包含“箱,路”的值选中赋值给wentj
2、在sss中将使用“0”层的文字选中赋值给tco,下步还可以在sss中将使用“a”层的文字选中赋值给tca,------

ZZXXQQ 发表于 2015-3-22 12:00:09

(setq sss (ssget'((0 . "TEXT"))))
(setq wentj (ssget "P" '((1 . "*箱*, *路*"))))
(command "select" sss "")
(setq tc0 (ssget "P" '((8 . "0"))))
(command "select" sss "")
(setq tca (ssget "P" '((8 . "a"))))
...

chenbh2 发表于 2015-3-22 21:31:18

ZZXXQQ 发表于 2015-3-22 19:45 static/image/common/back.gif
(setq sss (ssget'((0 . "TEXT"))))
(setq wentj (ssget "P" '((1 . "*箱*, *路*"))))
(command "select" ...

太好了,谢谢版主!,我对lisp不是很懂,自己有想法,可是不知道怎么写代码!感谢超级版主!

chenbh2 发表于 2015-3-24 18:05:36

ZZXXQQ 发表于 2015-3-22 12:00 static/image/common/back.gif
(setq sss (ssget'((0 . "TEXT"))))
(setq wentj (ssget "P" '((1 . "*箱*, *路*"))))
(command "select" ...

再次请教版主,当
(command "select" sss "")
(setq tca (ssget "P" '((8 . "a"))))
没有该图层,如何赋值tca为 0

ZZXXQQ 发表于 2015-3-24 19:12:25

chenbh2 发表于 2015-3-24 18:05 static/image/common/back.gif
再次请教版主,当
(command "select" sss "")
(setq tca (ssget "P" '((8 . "a"))))


没有该层时tca为nil。
直接判断tca为nil就行。
如果非要为0可以(if (= tca nil) (setq tca 0))

chenbh2 发表于 2015-3-24 23:15:22

ZZXXQQ 发表于 2015-3-24 19:12 static/image/common/back.gif
没有该层时tca为nil。
直接判断tca为nil就行。
如果非要为0可以(if (= tca nil) (setq tca 0))

谢谢!很好用!
页: [1]
查看完整版本: 文字条件赋值