明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1961|回复: 3

这程序为什么在cad06版运行正常,08版不能提取汉字??

[复制链接]
发表于 2012-3-13 19:54:07 | 显示全部楼层 |阅读模式
这程序为什么在cad06版运行正常,08版不能提取汉字??

紧急求助,这程序为什么在cad06版运行正常,08版不能提取汉字(均在相应的天河版本下)

(defun c:tittle( / )
   (setq aa nil) (setq bb nil)
   (setq aa (ssget "X" '((0 . "INSERT") (2 . "PC_MXB_BLOCK"))))
   (setq bb (ssget "X" '((0 . "INSERT") (2 . "PC_TITLE_BLOCK"))))
   (setvar "filedia" 0)
   (command "-attext" "o" bb "" "" "C:/_taoyu/tylsp/天河转XT/tittle.txt" "d:/cap.txt" );提取标题栏属性
  (command "-attext" "o" aa "" "" "C:/_taoyu/tylsp/天河转XT/mxbtem.txt" "d:/mxbinf.txt");提取明细表属性
   (setvar "filedia" 1)
   (SETQ REPN (- (SSLENGTH BB) 1))   ;当有多个图框时
   
   (setq fcap (open "d:/cap.txt" "r"))

   (setq capline (read-line fcap))
   (setq repn (- repn 1))
   (REPEAT REPN
      (setq secondline (read-line fcap))
      (IF (> secondline capline)
      (SETQ capline SECONDLINE))
   )                    ;取大的值为标题栏信息___填写了总重量的字符串值大
   (close fcap)

            
   (readcapl capline);获取标题栏信息

    (setq filename (strcat (getvar "dwgprefix") (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)) ".MXB"))
    (setq fp (open filename "w"))
    (princ curtuhao fp)
    (princ "|" fp)
    (princ curname fp)
    (princ "|" fp)
    (princ curwt fp)
    (princ "|" fp)
    (princ allwt fp)
    (princ "|" fp)
   (princ zhonghao fp)
    (princ "|" fp)
   (princ daihao fp)
    (princ "|" fp)
   (princ (getvar "dimscale") fp)
    (princ "|" fp)
   (princ (if (= "" totalpage) 0 totalpage) fp)
    (princ "|" fp)
   (princ 0 fp)
      (princ "|" fp)
   (princ 0 fp)
    (princ "|" fp)
   (princ (getvar "extmax") fp)
    (princ "\n" fp)
   
   (setq repn (sslength aa)) (setq fmxb (open "d:/mxbinf.txt" "r"))

   (repeat repn
    (setq line (read-line fmxb)   n 8   strjs 1   word "" character "T")
    (while (/= "" character)
       (setq character (substr line strjs 1) strjs (+ strjs 1))
       (if (and (/= "'" character) (/= "," character))
                 (setq word (strcat word character))
       )
       (if (or (= "," character) (= "" character))
        (if (or (= 3 n) (= 4 n) (= 2 n))
            (if (/= "" word) (princ word fp) (princ 0 fp))
            (if (/= "" word) (princ word fp) (princ "none" fp))
            )
        )
       (if (= "" character)    (princ (strcat "|" curtuhao "\n") fp))
       (if (= "," character) (setq word "" n (- n 1)))
       (if (= "," character) (princ "|" fp))
    );while
   );end rep

   (close fp) (close fmxb)

);end def

(defun readcapl(capline / )
   (setq n 15 ) (setq strjs 1) (setq word "")
   (while (> n 1)
    (setq character (substr capline strjs 1) strjs (+ strjs 1))
    (if (and (/= "'" character) (/= "," character))
                 (setq word (strcat word character))
    )
    (if (= "," character)
        (if (= 15 n)
            (setq curtuhao word)
        (if (= 14 n)
            (setq curname word)
            (if (= 13 n)
            (setq allwt word)
               (if (= 12 n)
                (setq zhonghao word)
                (if (= 11 n)
                (setq daihao word)
                (if (= 2 n)
                    (setq totalpage word)
                )
                )
                    )
            )
        )
        )
    )
    (if (= "," character )
        (setq n (- n 1) word "")
    )
   )

(if (or (= allwt "") (= allwt nil)) (setq allwt 0))  ;没有总重值时,自动赋0,否则排序时会出错

发表于 2012-3-13 20:24:06 | 显示全部楼层
一个不完整的程序,别人怎么测试
发表于 2012-3-13 20:41:30 | 显示全部楼层
既然用了PCCAD2008,为什么不试试:PCCAD——辅助工具——批量数据提取,一个提取标题栏和明细表非常好用的工具。用其它的真是舍近求远啊。
 楼主| 发表于 2012-3-14 19:22:14 | 显示全部楼层
PCCAD——辅助工具——批量数据提取,很不好用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-9-25 03:10 , Processed in 0.183098 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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