明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1858|回复: 2

[求助]這個程序在運行的越長怎麼使另存生成的文件變大了?

[复制链接]
发表于 2004-2-18 09:48:00 | 显示全部楼层 |阅读模式
是這樣的, 我寫的這個程序是用來批處理3500個cad文件, 但是不知是什麼原因, 程序剛開始能把文件清理的很小. 但是繼續處理下去時. 接下來的文件會比前面的文件變大了. 暈呀!還望高手指導指導. (defun c:DGIN(/ dll dwg dnb fdwg texti ss nn tell te1 ted )
(PPPTEST "D:\\shoedwg\\" "dwg")
(setq i 0)
(SETVAR "CMDECHO" 0)
(repeat dll
(setq dwg (nth i dwgname ))
(setq dnb (strlen (substr dwg 1 (- (strlen dwg) 4))))
(if (<= dnb 7)
(setq Fdwg (strcat (substr dwg 1 5) "0" (substr dwg 6 7))))
(IF (= (FINDFILE (strcat"D:\\BDYCADD\\" FDWG)) nil)
(PROGN
(command ".INSERT" (strcat "D:\\shoedwg\\" dwg )"0,0" "" "" "")
(command ".zoom" "e" "")
(explode-all);炸開插入的文件
(get-dun-point)
(command ".erase" "all" "r" unss "" "")
(setq dnb (strlen (substr dwg 1 (- (strlen dwg) 4))))
(if (<= dnb 7)
(setq dwg (strcat (substr dwg 1 5) "0" (substr dwg 6 7))))
(setq texti (substr dwg 1 8))
(setq ss (ssget "x" '((0 . "TEXT"))))
(setq nn 0)
(repeat (sslength ss) ; 循還把七位數的文字改成八位數的文字.
(setq te1 (ssname ss nn ))
(setq ted (entget te1))
(setq tell (cdr (assoc 1 ted)))
(if (> (strlen tell) 2)
(progn
(if (> (strlen tell) 8)
(progn
(setq li (substr tell 8 (strlen tell)))
(setq texti (strcat texti lI))))
(setq newtext (cons 1 texti))
(setq newok (subst newtext (assoc 1 ted) ted))
(entmod newok)))
(setq nn (1+ nn)))
(command ".purge" "a" "" "N" )
(command ".saveas" "" (strcat "D:\\BDYCADD\\" dwg ))
))
(if (ssget "x")
(progn
(command ".erase" "all" "")
(command ".purge" "a" "" "N" )))
(setq i (1+ i))
)
(princ))
(DEFUN PPPTEST (PPP pd1)
(setq ifdiredwg PPP);"C:\\shoe")
(SetQ iflistdwg (Cdr (Cdr (VL-Directory-Files ifdiredwg))))
(setq i 0)
(setq dwgname (list ""))
(setq pd1 (strcat "." pd1))
(setq pd2 (strcase pd1 ));".dwg"); pd2 ".DWG")
(repeat (length iflistdwg)
(setq dwg (nth i iflistdwg))
(if (> (strlen dwg) 3)
(setq hdwg (substr dwg (- (strlen dwg) 3) (strlen dwg))))
(if (or (= hdwg pd1) (= hdwg pd2))
(setq dwgname (append dwgname (list dwg))) )
(setq i (1+ i)))
(setq dwgname(cdr dwgname))
(SETQ DLL (length dwgname ))
(PRINC)
)
;------------------------------------------------------
(defun explode-all(/ all sl n sd);(explode-all)
(setvar "cmdecho" 0)
(repeat 2
(setq all(ssget "x") sl (sslength all) n 0)
(repeat sl
(setq sd (cdr (assoc 0 (entget (ssname all n)))))
(if (= sd "INSERT")
(command ".explode" (ssname all n)))
(setq n (1+ n))))
(setvar "cmdecho" 1)
(princ))
;-------------------------------
(defun get-dun-point(/ a as ac af n qend )
(setq a (ssget "x" '((0 . "LWPOLYLINE") (62 . 6))))
(SETQ AS (SSNAME A 0)
ac (ENTGET AS)
AF (CDR (ASSOC 10 AD)))
(setq n 0)
(repeat (length ac)
(setq qend (nth n ac))
(if (= (car qend) 10)
(setq one (cdr qend))
(setq n (1+ n))))
(setq trhee (cdr (nth (+ n 8) ac)))
(setq unss (ssget "c" one trhee))
)
"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2004-2-18 15:04:00 | 显示全部楼层
本帖最后由 作者 于 2004-2-18 16:49:40 编辑

經一個上午的測試. 得出一個問題就是 PURGE 不能清除得很好的. 如這個圖里面什麼都沒有. 可是還是91KB的. 清不小了. 不知大家有何良策? 請教大家了.


O, 原来是文件里面有很多以被删除了的组占在里面. 请问龙龙仔如何清除呀?





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2004-2-18 18:34:00 | 显示全部楼层
这个小了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 16:25 , Processed in 0.193415 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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