chenjian2159 发表于 2010-8-11 10:37:00

[讨论] 关于图层的隔离!!!

<p><strong><font color="#ff0000">关于图层的隔离,即选择图元后,被选择图元所在的层保持开的状态,别的图层关闭。现在下面的&nbsp;&nbsp;&nbsp; lisp有个问题,不管选择一个层上的图元还是多个层上的图元,结果都只能隔离一个图层,不能隔离多个图层,希望高手能帮着改一下!!!谢谢!!!</font></strong></p>
<p><strong><font color="#ff0000"></font></strong>&nbsp;</p>
<p><strong><font face="Verdana" color="#000000">(defun c:ee (/ ent entlist lname selent m)<br/>&nbsp; (setq selent(ssget) m -1)<br/>&nbsp; (while (&lt; (setq m(1+ m)) (sslength selent))<br/>&nbsp;&nbsp;&nbsp; (setq entlist (entget (ssname selent m)))<br/>&nbsp;&nbsp;&nbsp; (setq lname (cdr(assoc 8 entlist)))<br/>&nbsp;&nbsp;&nbsp; (command "layer" "off" "*" "y" "on" lname "")<br/>&nbsp; )&nbsp; <br/>) </font></strong></p>

chenjian2159 发表于 2010-8-11 10:41:00

<p><strong><font color="#ff0000">另外感觉这个lisp不是很完美,希望高手能写一个完美的。感激不尽!!!</font></strong></p>

masterlong 发表于 2010-8-11 20:44:00

<p><font face="Verdana">(defun c:lo()<br/>&nbsp;(setvar "cmdecho" 0)<br/>&nbsp;(setq sels (ssget) )<br/>&nbsp;(if sels (lomain) )<br/>(princ)<br/>)</font></p>
<p><font face="Verdana">(defun lomain()<br/>&nbsp;(setq n (sslength sels) )<br/>&nbsp;(setq llist '() )<br/>&nbsp;(repeat n<br/>&nbsp;&nbsp;(setq a (ssname sels (setq n (1- n))) )<br/>&nbsp;&nbsp;(setq b (cdr (assoc 8 (entget a))) )<br/>&nbsp;&nbsp;(if (member b llist)<br/>&nbsp;&nbsp;&nbsp;()<br/>&nbsp;&nbsp;&nbsp;&nbsp;(setq llist (cons b llist) )<br/>&nbsp;&nbsp;&nbsp;)<br/>&nbsp;&nbsp;)<br/>&nbsp;)<br/>&nbsp;&nbsp; (if (member (getvar "clayer") llist)<br/>&nbsp;&nbsp;&nbsp;&nbsp; ()<br/>&nbsp;&nbsp;&nbsp;&nbsp; (setvar "clayer" (setq lay (last llist)))<br/>&nbsp;&nbsp; )</font></p>
<p><font face="Verdana">&nbsp;&nbsp; (command "layer" "off" "*" "y")<br/>&nbsp;&nbsp; (foreach x llist (command "on" x))<br/>&nbsp;&nbsp; (command "")<br/>)</font></p>

AMTONNY 发表于 2010-8-11 20:48:00

这个好简单哦

atone 发表于 2024-4-13 19:03:36

留个记号,好贴

叁點壹肆 发表于 2024-8-12 14:18:01

插【实用的
页: [1]
查看完整版本: [讨论] 关于图层的隔离!!!