注册 登录
明经CAD社区 返回首页

xiaomm250的个人空间 http://bbs.mjtd.com/?419266 [收藏] [复制] [分享] [RSS]

日志

DCL2LSP和LSP2DCL(源码)

已有 2275 次阅读2014-4-15 08:51 |系统分类:应用

http://bbs.mjtd.com/thread-92336-1-1.html

(defun c:dcl2lsp ( / fname1 fn1 fname2 fn2 k fn1l fn2l )  (setq fname1 (getfiled "Select DCL file" "" "dcl" 16))  (setq fn1 (open fname1 "r"))  (setq fname2 (getfiled "File to save" "" "lsp" 1))  (setq fn2 (open fname2 "w"))  (while (setq fn1l (read-line fn1))    (setq fn2l fn1l)    (setq k 0)    (while (setq k (vl-string-search "\"" fn2l k))      (setq fn2l (vl-string-subst "\\\"" "\"" fn2l k))       (setq k (+ k 2))    )    (setq fn2l (strcat "(write-line \"" fn2l "\" fn)"))    (write-line fn2l fn2)  )  (close fn1)  (close fn2)  (princ))


(defun c:lsp2dcl ( / fname1 fn1 fname2 fn2 k fn1l fn2l )  (setq fname1 (getfiled "Select LSP file" "" "lsp" 16))  (setq fn1 (open fname1 "r"))  (setq fname2 (getfiled "File to save" "" "dcl" 1))  (setq fn2 (open fname2 "w"))  (while (setq fn1l (read-line fn1))    (setq fn2l fn1l)    (setq fn2l (substr fn2l (+ (vl-string-search "\"" fn2l) 2) (- (vl-string-position (ascii "\"") fn2l nil T) (+ (vl-string-search "\"" fn2l) 1))))     (setq k 0)    (while (setq k (vl-string-search "\\\"" fn2l k))      (setq fn2l (vl-string-subst "\"" "\\\"" fn2l k))       (setq k (+ k 1))    )    (write-line fn2l fn2)  )  (close fn1)  (close fn2)  (princ))



路过

雷人

握手

鲜花

鸡蛋

发表评论 评论 (2 个评论)

回复 xiaomm250 2014-4-15 08:53
http://www.theswamp.org/index.php?topic=40611.0
回复 xiaomm250 2014-4-15 08:54
(defun c:dcl2lsp ( / fname1 fn1 fname2 fn2 k fn1l fn2l )
  (setq fname1 (getfiled "Select DCL file" "" "dcl" 16))
  (setq fn1 (open fname1 "r"))
  (setq fname2 (getfiled "File to save" "" "lsp" 1))
  (setq fn2 (open fname2 "w"))
  (while (setq fn1l (read-line fn1))
    (setq fn2l fn1l)
    (setq k 0)
    (while (setq k (vl-string-search "\"" fn2l k))
      (setq fn2l (vl-string-subst "\\\"" "\"" fn2l k))
      (setq k (+ k 2))
    )
    (setq fn2l (strcat "(write-line \"" fn2l "\" fn)"))
    (write-line fn2l fn2)
  )
  (close fn1)
  (close fn2)
  (princ)
)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

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

GMT+8, 2024-3-29 04:14 , Processed in 0.095759 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部