dxh-627 发表于 2009-3-13 19:23:00

关于修改标注样式的问题

<p>问题是这样的,Solidworks出图后,然后要转成DWG的,。转图后,由于是软件之间的转换,转成CAD之后,如果后面一修改的话,所有尺寸的位置就跑到尺寸线的下面了,所以现在我想写一个小程序,只要输入一个命令,就把所有的标注样式里面要改的内容一次性全部修改过来。但是写出来后,执行命令,只能对最后一个表达式有用,也就是说,前面的改过来后,因为并不是修改了样式本身,而是增加了一个替换样式,执行到下面一个,置为当前后,前面一个样式就还原了,所以想请教大家,用什么函数可以得到我想要的结果,谢谢了!</p><p>下面是代码:</p><p><font color="#ff0000">(defun c:tt(/ oldecho )<br/>&nbsp;&nbsp; (setq oldecho (getvar "cmdecho"))<br/>&nbsp;&nbsp; (setvar "cmdecho" 0)<br/>&nbsp;&nbsp; (setq dim1 (tblsearch "dimstyle" "SLDDIMSTYLE0"))  ;搜索样式<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if ( = dim1&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (command "-dimstyle" "r" "SLDDIMSTYLE0" ) ;置为当前<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (command "-dimstyle" "r" "slddimstyle0" "dimtad" 1)  ;要修改的变量<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (setq dim2 (tblsearch "dimstyle" "SLDDIMSTYLE1"))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if ( = dim2&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (progn<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq dim3 (getvar "diamtad"));</font>&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp; ;(setvar "cmdecho" oldecho)<br/>&nbsp;&nbsp; (princ)<br/>)</font></p>

ycsos001 发表于 2020-8-21 14:28:27

sdfasdfasdfdasfasdfasddvtgwqreeqrqwer

ycsos001 发表于 2020-8-21 14:23:05

dsfsdfsdfdsfdsfsdfsdfdsfsdfdsf

ivyco2557 发表于 2019-12-21 21:32:21

发帖2发帖2发帖2发帖2发帖2

userzhl 发表于 2009-3-13 21:56:00

ZZXXQQ 发表于 2009-3-14 10:07:00


(defun c:tt(/ oldecho )
(setq oldecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
;搜索样式
(if (tblsearch "dimstyle" "SLDDIMSTYLE0") (progn
(command "-dimstyle" "r" "SLDDIMSTYLE0") ;置为当前
(setvar "DIMTAD" 1)                     ;要修改的变量
(command "-dimstyle" "s" (getvar "DIMSTYLE") "Y") ;保存修改到当前样式
))
(if (tblsearch "dimstyle" "SLDDIMSTYLE1")
(setq dim3 (getvar "dimtad"))
)
(setvar "cmdecho" oldecho)
(princ)
)

dxh-627 发表于 2009-3-17 20:16:00

谢谢版主,问题已经搞定了。谢谢了!

lskang001 发表于 2009-4-29 11:24:00

fdsdfsdfsa

lskang001 发表于 2009-4-29 11:27:00

还不到?

chen2002 发表于 2010-12-26 14:51:32

我想看一看.得要5个发贴数

chen2002 发表于 2010-12-26 14:53:36

发贴1发贴1发贴1发贴1发贴1

chen2002 发表于 2010-12-26 14:53:59

发贴2发贴2发贴2发贴2发贴2

chen2002 发表于 2010-12-26 14:54:26

发贴3发贴3发贴3发贴3发贴3
页: [1] 2 3 4 5 6 7 8
查看完整版本: 关于修改标注样式的问题