求高手帮改下这个变色命令
<p>这是我现在的一个变色命令 (defun c:1 (/ gp) (setq gp (ssget)) (command "change" gp "" "p" "co" "1" ""))</p><p>我想在把一个对象变色的同时,还能自动把这个对象定义到一个特定图层里面,比如图层1。如果没有有图层1,就自动新建一个,如果有了的话,则自动就归到图层1里面去了。</p><p>希望热心人帮帮我。</p> (defun c:1 (/ gp) (setq gp (ssget)) (command "change" gp "" "p" "co" "1" "la" "1" "")) 我不知道我有没有表达清楚,其实我是想让这个变色命令和论坛上的哪个图层自动切换程序一样,不过,这个是通过改变一个对象颜色的同时还可以自动定义这个对象的图层。 谢谢版主,我试了下你改的,但是不能自动建立新图层,需要之前先建立好相应的图层才行,而且还要手动定义对象的图层,当前层也跟着变到定义的层去了。这样我还是觉得不怎么方便,不能有效的提高效率。不过还是谢谢你哈。 又试了下,原来是当前层是不会变的,只是有一点点不方便,就是需要事先设置好图层才行。还是有点遗憾。 <p>(defun c:1 (/ gp)<br/> (if (= (tblobjname "layer" "1") nil)<br/> (progn<br/> (command "layer" "n" "1" "C" "50" "1" "")<br/> )<br/> )<br/> (setq gp (ssget))<br/> (command "change" gp "" "p" "c" "1" "la" "1" ""))</p> <p>试过了,可以了,谢谢楼上的。</p><p>再问个问题,,为什么我把图层名改成其他的,图层的随层色就不起作用了呢??如下:</p><p>(defun c:11(/ gp)<br/> (if (= (tblobjname "layer" "a") nil)<br/> (progn<br/> (command "layer" "n" "a" "C" "1" "1" "")<br/> )<br/> )<br/> (setq gp (ssget))<br/> (command "change" gp "" "p" "c" "1" "la" "a" ""))</p><p>另外,我试着定义图层的线形,</p><p>(defun c:11(/ gp)<br/> (if (= (tblobjname "layer" "a") nil)<br/> (progn<br/> (command "layer" "n" "a" "C" "1" "1" "L" "center" "")<br/> )<br/> )<br/> (setq gp (ssget))<br/> (command "change" gp "" "p" "c" "1" "la" "a" "L" "center" ""))</p><p>为什么不行呢?</p> 貌似你只修改命令,下面随着改了才性 <p>(defun c:1 (/ gp)<br/> (if (= (tblobjname "layer" "dote") nil)<br/> (progn<br/> (command "layer" "n" "dote" "C" "1" "dote" "")<br/> )<br/> )<br/> (setq gp (ssget))<br/> (command "change" gp "" "p" "c" "bylayer" "la" "dote" ""))</p><p>已经可以了,但是还不会改线形</p> 顶
页:
[1]