谢谢你的帮助!谢谢你给我这么详细的支持! ̄<BR> 我先理解后试着优化,然后再帖出来吧~ 有问题.点"确定"后老是在CAD命令行中出现命令: _Txtdm<BR>LAYER<BR>当前图层: 0<BR>输入选项 <BR>[?/生成(M)/设置(S)/新建(N)/开(ON)/关(OFF)/颜色(C)/线型(L)/线宽(LW)/打印(P)/冻结(<BR>F)/解冻(T)/锁定(LO)/解锁(U)/状态(A)]: s<BR>输入要置为当前的图层名或 <选择对象>: ZJ<BR>找不到图层“ZJ”。<BR>; 错误: 函数被取消<BR> 对不起!我说了,这是我在以前编写的,当时的前提是已经定义了"ZJ" 层,不要紧,好在<BR>我提供了源码,下面一句(程序的第一句):<BR>(COMMAND "LAYER" "s" "ZJ" "")<BR>是在已有"ZJ"层的情况下写的,打包时忽略了,还有就是findfile函数的使用上也是假<BR>定在ACAD环境设定为可搜索路径的情况......实在抱歉!现将源码略加修改后附上.
;写地区名<BR>(defun C:Txtdm(/ ff f0 f1 f2 zx zt zdx ztdx wzmc blxs n dqm0 dqm kdbl qxj zdx0 i n0 p0)<BR> (command "_LAYER" "m" "ZJ" "")<BR> (setq ff "" qxj "" kdbl "")<BR> (setq qxj0 0.0 kdbl0 0.0 blc0 0.0)<BR> (setq f1 "c:\\windows\\system\\Textlib.dat")<BR> (setq f2 (open f1 "r"))<BR> (setq zt (read-line f2)<BR> zdx (read-line f2)<BR> wzmc (read-line f2)<BR> fsxz (read-line f2)<BR> qxj (read-line f2)<BR> kdbl (read-line f2)<BR> blc (read-line f2))<BR> (close f2)<BR> (setq blc0 (atof blc))<BR> (setq blxs (/ blc0 1000.0))<BR> (setq ff "c:\\windows\\system\\wzmcwj.cfg")<BR> (setq f0 (open ff "r"))<BR> (setq n 0 dqm0 "")<BR> (while (setq dqm (read-line f0))<BR> (setq dqm0 (strcat dqm0 dqm)<BR> n (+ n 1))<BR> )<BR> (close f0)<BR> (cond ((= zdx "1")(setq zdx0 (* blxs 6.0)))<BR> ((= zdx "2")(setq zdx0 (* blxs 5.0)))<BR> ((= zdx "3")(setq zdx0 (* blxs 3.5)))<BR> ((= zdx "4")(setq zdx0 (* blxs 2.5)))<BR> ((= zdx "5")(setq zdx0 (* blxs 1.5)))<BR> )<BR> (setq zx (cond ((= zt "黑体") "ht")<BR> ((= zt "宋体") "st")<BR> ((= zt "楷体") "kt")<BR> ((= zt "仿宋") "fs")<BR> ((= zt "中等线") "zd")<BR> ((= zt "细等线") "xd"))<BR> )<BR> (setq zt (cond ((= zx "ht") "黑体")<BR> ((= zx "st") "宋体")<BR> ((= zx "kt") "楷体_GB2312")<BR> ((= zx "fs") "仿宋_GB2312")<BR> ((= zx "zd") "方正中等线简体")<BR> ((= zx "xd") "方正细等线简体"))<BR> ) <BR> (setq kdbl0 (atof kdbl))(setq qxj0 (atof qxj))<BR> (command "style" zx zt "" kdbl0 qxj0 "N" "N")<BR> (setq i 1 n0 -1 ztdx (rtos zdx0 2 1))<BR> (if (= fsxz "f")(progn<BR> (while (<= i n)<BR> (setq n0 (+ n0 2))<BR> (setq dqm (substr dqm0 n0 2))<BR> (setq p0 (getpoint "\n插入点:"))<BR> (command "text" "m" p0 ztdx "0" dqm)<BR> (setq i (+ i 1))<BR> )<BR> )<BR> )<BR> (if (= fsxz "z")(progn<BR> (setq p0 (getpoint "\n插入点:"))<BR> (command "text" "m" p0 ztdx "0" dqm0)<BR> )<BR> ) <BR>)<BR> 看到来了,总之很不错的.
页:
1
[2]