明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3598|回复: 24

求助---------宗地图批量另存(已解决)请看22楼

  [复制链接]
发表于 2012-8-14 21:57 | 显示全部楼层 |阅读模式
本帖最后由 dalin1985 于 2012-9-29 21:51 编辑

要求:1.图名为宗地号
          2.混合总宗为图名加权利人


该贴已经同步到 dalin1985的微博

本帖子中包含更多资源

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

x
"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2012-8-20 18:52 | 显示全部楼层
本帖最后由 dalin1985 于 2020-8-7 08:51 编辑
461045462 发表于 2012-8-19 15:58
dalin1985 您好:
轻轻地请问一句,您的成果能否分享
谢谢!

本帖子中包含更多资源

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

x
 楼主| 发表于 2012-8-15 10:04 | 显示全部楼层
谁知道在那里加悬赏?
发表于 2012-8-15 13:55 | 显示全部楼层
本帖最后由 Andyhon 于 2012-8-15 15:35 编辑


  1. ;;; [url=http://www.afralisp.net/archive/lisp/dclatt2.htm]http://www.afralisp.net/archive/lisp/dclatt2.htm[/url]


  2. ;;; (defun getatt (enam)
  3. (defun getatt (enam / taglist txtlist)
  4.    ;retrieve the attributes
  5.    (setq thelist (vlax-safearray->list
  6.                  (variant-value
  7.                         (vla-getattributes enam))))
  8.          ;process each attribute
  9.          (foreach n thelist
  10.            ;get the tag attribute data
  11.            (setq taglist (cons (vla-get-tagString n) taglist)
  12.            ;get the text attribute data
  13.                     txtlist (cons (vla-get-textString n) txtlist)
  14.                  ;how many attributes?
  15.                  lg (length taglist)
  16.            );setq
  17.          );foreach
  18.          ;reverse the lists
  19.          (setq taglist (reverse taglist)
  20.                txtlist (reverse txtlist))
  21. )
  22. ;;; 图形必需可见
  23. (defun W-dwg (blk / strs)
  24.   (setq pt   (cdr (assoc 10 (entget blk)))
  25.         p1   (mapcar '- pt '(5 12))
  26.         p3   (mapcar '+ pt '(93 126))
  27.         ss   (ssget "C" p1 p3)
  28.         txts (getAtt (vlax-ename->vla-object blk))
  29.   )
  30.   (foreach txt txts
  31.     (if (wcmatch txt "#########*")
  32.       (setq strs (cons txt strs))
  33.     )
  34.   )
  35.   (vl-cmdf "wblock" (car strs) "" pt ss "")
  36. )
  37. ;;; for test only
  38. (vl-load-com)
  39. (defun c:test ()
  40.    (mapcar 'W-dwg (sslist (ssget '((2 . "tk_a4")))))
  41. )



;;; sslist 函数 站内有


发表于 2012-8-15 15:43 | 显示全部楼层
又一苦逼测量同行.顶
 楼主| 发表于 2012-8-15 16:27 | 显示全部楼层
Andyhon 发表于 2012-8-15 13:55
;;; sslist 函数 站内有

出错了
<选择集: 52>
发表于 2012-8-15 16:45 | 显示全部楼层
本帖最后由 Andyhon 于 2012-8-15 16:47 编辑

另图吗?

原测试图 ===>
Command: test
Select objects: All 605 found
599 were filtered out.
Select objects:
wblock Enter name of output file: 5106030050060002006
Enter name of existing block or
[= (block=output file)/* (whole drawing)] <define new drawing>: Specify
insertion base point:
Select objects:   124 found
Select objects:
Command: wblock Enter name of output file: 5106030050060002006
Enter name of existing block or
[= (block=output file)/* (whole drawing)] <define new drawing>: Specify
insertion base point:
Select objects:   124 found
Select objects:
Command: wblock Enter name of output file: 5106030050060002005
Enter name of existing block or
[= (block=output file)/* (whole drawing)] <define new drawing>: Specify
insertion base point:
Select objects:   107 found
Select objects:
Command: wblock Enter name of output file: 5106030050060002004
Enter name of existing block or
[= (block=output file)/* (whole drawing)] <define new drawing>: Specify
insertion base point:
Select objects:   89 found
Select objects:
Command: wblock Enter name of output file: 5106030050060002003
Enter name of existing block or
[= (block=output file)/* (whole drawing)] <define new drawing>: Specify
insertion base point:
Select objects:   116 found
Select objects:
Command: wblock Enter name of output file: 5106030050060002002
Enter name of existing block or
[= (block=output file)/* (whole drawing)] <define new drawing>: Specify
insertion base point:
Select objects:   45 found
Select objects:
Command: (T T T T T T)
 楼主| 发表于 2012-8-15 19:39 | 显示全部楼层
Andyhon 发表于 2012-8-15 16:45
另图吗?

原测试图 ===>

是原图,错误好像是不能判断单宗和混宗。
发表于 2012-8-16 09:07 | 显示全部楼层
重新调试 单宗和混宗 的情况
===========================

在我的机子上卡壳了
----------------------
混合总宗为图名加权利人

图名 ==> "5106030050060002006" ==> ok

权利人 ==>
系统的回应值 ==> "\\M+5CAE6\\M+5F6C7\\M+5CBC9"

在cad内写入为字串时 OK
作为文件名时则会被打回票而过不了关 ...

不知是否有插件可套用!?

所以转了个弯,采用过渡后缀方案,聊胜于无...


  1. ;;; http://www.afralisp.net/archive/lisp/dclatt2.htm

  2. ;;; (defun getatt (enam)
  3. (defun getatt (enam / taglist txtlist)

  4.    ;retrieve the attributes
  5.    (setq thelist (vlax-safearray->list
  6.                     (variant-value
  7.                         (vla-getattributes enam))))

  8.          ;process each attribute
  9.          (foreach n thelist

  10.            ;get the tag attribute data
  11.            (setq taglist (cons (vla-get-tagString n) taglist)

  12.            ;get the text attribute data
  13.                  txtlist (cons (vla-get-textString n) txtlist)

  14.                  ;how many attributes?
  15.                  lg (length taglist)

  16.            );setq
  17.          );foreach

  18.          ;reverse the lists
  19.          (setq taglist (reverse taglist)
  20.                txtlist (reverse txtlist))

  21. )


  22. ;;; 宗地图批量另存

  23. ;;; 手动添加后缀
  24. (defun W-dwg_Aux (DwgName)
  25.   (cond
  26.    ((findfile (strcat DwgName ".Dwg"))
  27.     (prompt "\n已有同名文件 ==> ") (princ Dwgname)
  28.     (setq -str (getstring "\n添加临时后缀: "))
  29.     (W-dwg_Aux (strCat DwgName -str))
  30.    )
  31.    (T (vl-cmdf "wblock" DwgName "" pt ss ""))
  32.   )
  33. )

  34. ;;; 自动添加 "A" 后缀
  35. (defun W-dwg_Aux (DwgName)
  36.   (cond
  37.    ((findfile (strcat DwgName ".Dwg"))
  38.     (W-dwg_Aux (strCat DwgName "A"))
  39.    )
  40.    (T (vl-cmdf "wblock" DwgName "" pt ss ""))
  41.   )
  42. )

  43. ;;; 图形必需可见
  44. (defun W-dwg (blk / strs)
  45.   (setq pt   (cdr (assoc 10 (entget blk)))
  46.         p1   (mapcar '- pt '(5 12))
  47.         p3   (mapcar '+ pt '(93 126))
  48.         ss   (ssget "C" p1 p3)
  49.         txts (getAtt (vlax-ename->vla-object blk))
  50.   )

  51.   (foreach txt txts
  52.     (if (wcmatch txt "#########*")
  53.       (setq strs (cons txt strs))
  54.     )
  55.   )

  56.   (W-dwg_Aux (car strs))
  57. )

  58. ;;; for test only
  59. (vl-load-com)
  60. (defun c:test ()
  61.    (mapcar 'W-dwg (sslist (ssget '((2 . "tk_a4")))))
  62. )

 楼主| 发表于 2012-8-16 21:07 | 显示全部楼层
Andyhon 发表于 2012-8-16 09:07
重新调试 单宗和混宗 的情况
===========================

程序完美运行了,就是不知道图存哪里了
发表于 2012-8-16 22:04 | 显示全部楼层
本帖最后由 Andyhon 于 2012-8-16 22:05 编辑

;;; 自动添加 "A" 后缀
(defun W-dwg_Aux (DwgName)
  (cond
   ((findfile (strcat Path DwgName ".Dwg"))
    (W-dwg_Aux (strCat DwgName "A"))
   )
   (T (vl-cmdf "wblock" (strcat Path DwgName) "" pt ss ""))
  )
)
...
(defun c:test ()
   (setq Path (getVar "DwgPrefix"))
   (mapcar 'W-dwg (sslist (ssget '((2 . "tk_a4")))))
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-4 08:31 , Processed in 0.440012 second(s), 33 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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