明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1031|回复: 7

这个表怎么转成字符串呀,各位

[复制链接]
发表于 2008-8-21 14:12 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2008-8-21 14:32 | 显示全部楼层

不考虑实数的精度

(read (vl-string-translate "( )" "\",\"" (vl-princ-to-string '(0.2 -0.02 2.35 -0.025))))

 楼主| 发表于 2008-8-21 15:07 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2008-8-21 17:05 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2008-8-21 17:25 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2008-8-21 18:05 | 显示全部楼层
本帖最后由 作者 于 2008-8-21 18:07:35 编辑

(defun lindataout (filediretory)
  ;;(setvar "cmdecho" 0);;没有用到command可以忽略
  (if (= filediretory t) (setq filediretory (getvar "dwgprefix")) filediretory)
  (setq nm (open (strcat filediretory "线型文件.lin") "w"))
  (princ " " nm)
  (close nm)
  ;;(vl-load-com)没有用到ActiveX可以忽略
  (command "purge" "all" "*" "N")
  (command "purge" "all" "*" "N")
  (if (= filediretory t) (setq filediretory (getvar "dwgprefix")) filediretory)
  (setq nm (open (strcat filediretory "线型文件.lin") "a"))
  (princ "\n" nm)
  (princ "; Linetypes exported by LinOut.lsp  Version 2.0" nm)
  (princ "\n;" nm)
  (princ "\n; by Koyote - 方中集团--工程管理部:李敏" nm)
  (princ "\n;" nm)
  (princ "\n" nm)

  ;;蓝色部分可缩写为

  (princ "\n; Linetypes exported by LinOut.lsp  Version 2.0\n;
         \n; by Koyote - 方中集团--工程管理部:李敏\n;\n" nm)


  (setq txtsty nil txtlst (list))
  (setq txtsty (tblnext "LTYPE" t))
  (setq txtsty (tblnext "LTYPE"));;紫色部分只有最后一个有效啊
  (setq name (cdr(assoc 2 txtsty)))
  (setq name1 nil)
(while (/= name name1)
  (setq name (cdr(assoc 2 txtsty)))
(if (/= name "CONTINUOUS")
 (progn
  (setq ts (cdr(assoc 3 txtsty)))
  (setq ltdata (entget (tblobjname "ltype" name)))
  (setq ltlst (mapcar (function(lambda(x) (cDr x))) (vl-remove-if-not '(lambda(x) (= 49 (car x))) ltdata)))
  (setq ltlst (read (vl-string-translate "( )" "\",\"" (vl-princ-to-string ltlst))))
  (princ "*" nm)
  (princ name nm)
  (princ "," nm)
  (princ ts nm)
  (princ "\nA," nm)
  (princ ltlst nm)
  (princ "\n" nm)
  (setq txtsty (tblnext "LTYPE"))
  (if(/= txtsty nil)
            (setq name1 (cdr(assoc 2 txtsty)))
  );End_if 
 );End_progn
);End_if 
);End_while
(close nm)
 (setvar "cmdecho" 1)
(princ)
)

发表于 2008-8-21 21:20 | 显示全部楼层
哈哈,楼上真细心,学习了!
 楼主| 发表于 2008-8-22 08:26 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-21 03:38 , Processed in 0.335712 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表