乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 31|回复: 11

[编程交流] 你会救我很多命

[复制链接]

2

主题

7

帖子

5

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 17:45:20 | 显示全部楼层 |阅读模式
大家好,
 
我有一块1200块的土地,类似于附件中所示。多边形线未连接。我需要一种方法来找到每个地块的封闭区域,该区域需要在图纸上显示为文本…任何建议写一个脚本或lisp来解决这个问题…
 
你救了我很多命
 
干杯
地区图纸
回复

使用道具 举报

17

主题

193

帖子

179

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
84
发表于 2022-7-5 17:55:54 | 显示全部楼层
 
 
创建单独的图案填充并在单独的层上重新创建边界可能吗?
 
 
编辑:
 
 
在5分钟内按照我的建议完成
 
 
由于它已经是闭合多段线。。。
你可以很容易地得到每一个的面积
区域_01。图纸
回复

使用道具 举报

2

主题

7

帖子

5

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 17:58:24 | 显示全部楼层
“创建单独的图案填充,并在单独的层上重新创建边界,可能吗?”
 
谢谢你…但那需要很长时间…我认为是有用的
 
 
“Boundary”命令,选择封闭区域,检查创建的多段线,添加区域文本。。(但这些事情应该在脚本中进行,而不是手动进行,因为这需要很长时间)。。不知道怎么写
回复

使用道具 举报

5

主题

1074

帖子

1088

银币

初来乍到

Rank: 1

铜币
9
发表于 2022-7-5 18:02:16 | 显示全部楼层
看看李的lisp,如果你需要生成一个表的话,在他的网站上还有其他的。
 
多个地块的总面积是本LISP和他的另一个区域LISP中的一个选项,具有表格功能。
 
http://www.lee-mac.com/areastofield.html
 
谢谢李!
回复

使用道具 举报

2

主题

7

帖子

5

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 18:08:32 | 显示全部楼层
你总是在那里帮助爸爸。。。我会查一下然后再给你回复。。。
回复

使用道具 举报

5

主题

1074

帖子

1088

银币

初来乍到

Rank: 1

铜币
9
发表于 2022-7-5 18:14:14 | 显示全部楼层
李-麦克太棒了!
 
不需要使用边界命令,只需启动Lee Mac编写的以下lisp。。。
 
http://www.lee-mac.com/arealabel.html
 
...首先,你需要将它下载到你的电脑上,然后加载,当然,然后直接跳入,AT在命令行。
注意命令行提示!
 
请记住,如果这不是您想要的,那么在Lee的网站上还有其他可用选项,以及其他特定于区域的Lisp。
 
李统治!
184527apb9xxpz5a695bk9.jpg
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 18:21:51 | 显示全部楼层
希望李不介意你可以添加一个边界的代码为一个单一的地区选择。唯一的缺点是未创建表格。
 
  1. ;;------------------------=={ Areas to Field }==------------------------;;
  2. ;;                                                                      ;;
  3. ;;  This program allows a user to create an MText object containing a   ;;
  4. ;;  Field Expression referencing the area, or sum of areas, of one or   ;;
  5. ;;  more selected objects.                                              ;;
  6. ;;                                                                      ;;
  7. ;;  Upon issuing the command syntax 'A2F' at the AutoCAD command-line,  ;;
  8. ;;  the user is prompted to make a selection of objects for which to    ;;
  9. ;;  retrieve the area; if more than one object is selected, the         ;;
  10. ;;  cumulative area for all objects will be displayed by the resultant  ;;
  11. ;;  MText Field.                                                        ;;
  12. ;;                                                                      ;;
  13. ;;  Following object selection, the user is prompted to pick a point    ;;
  14. ;;  at which to create the MText Field. If the specified point resides  ;;
  15. ;;  within an AutoCAD table cell, the program will populate the table   ;;
  16. ;;  cell with the appropriate Field Expression.                         ;;
  17. ;;                                                                      ;;
  18. ;;  The Field will display the sum of the areas of the selected         ;;
  19. ;;  objects, formatted using the Field formatting code specified at     ;;
  20. ;;  the top of the program - this formatting code may be altered to     ;;
  21. ;;  suit the user's requirements.                                       ;;
  22. ;;                                                                      ;;
  23. ;;----------------------------------------------------------------------;;
  24. ;;  Author:  Lee Mac, Copyright © 2014  -  [url="http://www.lee-mac.com"]www.lee-mac.com[/url]              ;;
  25. ;;----------------------------------------------------------------------;;
  26. ;;  Version 1.3    -    2014-07-17                                      ;;
  27. ;;----------------------------------------------------------------------;;
  28. ; Boundary poly added by BIGAL 28-04-2016
  29. (defun c:a2fbp ( / *error* fmt inc ins lst sel str pt )
  30.    (setq fmt "%lu6%qf1") ;; Field Formatting
  31.    (defun *error* ( msg )
  32.        (LM:endundo (LM:acdoc))
  33.        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
  34.            (princ (strcat "\nError: " msg))
  35.        )
  36.        (princ)
  37.    )
  38. [color=red](setq ins (getpoint "Pick inside pt of new boundary"))[/color]
  39. [color=red](command "-boundary" ins "") [/color]
  40.   ; (if (and (setq sel (ssget '((0 . "ARC,CIRCLE,ELLIPSE,HATCH,*POLYLINE,REGION,SPLINE"))))
  41.     [color=red](if (and (setq sel (ssget "L"))[/color]
  42. ;             (setq ins (getpoint "\nPick point or cell for field: "))
  43.        )
  44.        (progn
  45.            (if (setq tmp
  46.                    (ssget "_X"
  47.                        (list '(0 . "ACAD_TABLE")
  48.                            (if (= 1 (getvar 'cvport))
  49.                                (cons 410 (getvar 'ctab))
  50.                               '(410 . "Model")
  51.                            )
  52.                        )
  53.                    )
  54.                )
  55.                (repeat (setq idx (sslength tmp))
  56.                    (setq tab (cons (vlax-ename->vla-object (ssname tmp (setq idx (1- idx)))) tab))
  57.                )
  58.            )
  59.            (if (= 1 (sslength sel))
  60.                (setq str
  61.                    (strcat
  62.                        "%<[url="file://\\AcObjProp"]\\AcObjProp[/url] Object(%<[url="file://\\_ObjId"]\\_ObjId[/url] "
  63.                        (LM:ObjectID (vlax-ename->vla-object (ssname sel 0)))
  64.                        ">%).Area [url="file://\\f"]\\f[/url] "" fmt "">%"
  65.                    )
  66.                )
  67.                (progn
  68.                    (repeat (setq idx (sslength sel))
  69.                        (setq lst
  70.                            (vl-list*
  71.                                "%<[url="file://\\AcObjProp"]\\AcObjProp[/url] Object(%<[url="file://\\_ObjId"]\\_ObjId[/url] "
  72.                                (LM:ObjectID (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
  73.                                ">%).Area>%" " + "
  74.                                lst
  75.                            )
  76.                        )
  77.                    )
  78.                    (setq str
  79.                        (strcat
  80.                            "%<[url="file://\\AcExpr"]\\AcExpr[/url] "
  81.                            (apply 'strcat (reverse (cdr (reverse lst))))
  82.                            " [url="file://\\f"]\\f[/url] "" fmt "">%"
  83.                        )
  84.                    )
  85.                )
  86.            )
  87.            (LM:startundo (LM:acdoc))
  88.            (if (setq tmp (LM:getcell tab (trans ins 1 0)))
  89.                (apply 'vla-settext (append tmp (list str)))
  90.                (vla-addmtext
  91.                    (vlax-get-property (LM:acdoc) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
  92.                    (vlax-3D-point (trans ins 1 0))
  93.                    0.0
  94.                    str
  95.                )
  96.            )
  97.            (LM:endundo (LM:acdoc))
  98.        )
  99.    )
  100.    (princ)
  101. )
  102. ;; ObjectID  -  Lee Mac
  103. ;; Returns a string containing the ObjectID of a supplied VLA-Object
  104. ;; Compatible with 32-bit & 64-bit systems
  105. (defun LM:ObjectID ( obj )
  106.    (eval
  107.        (list 'defun 'LM:ObjectID '( obj )
  108.            (if
  109.                (and
  110.                    (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE"))
  111.                    (vlax-method-applicable-p (vla-get-utility (LM:acdoc)) 'getobjectidstring)
  112.                )
  113.                (list 'vla-getobjectidstring (vla-get-utility (LM:acdoc)) 'obj ':vlax-false)
  114.               '(itoa (vla-get-objectid obj))
  115.            )
  116.        )
  117.    )
  118.    (LM:ObjectID obj)
  119. )
  120. ;; Get Cell  -  Lee Mac
  121. ;; If the supplied point lies within a cell boundary,
  122. ;; returns a list of: (<VLA Table Object> <Row> <Col>)
  123. (defun LM:getcell ( lst pnt / dir )
  124.    (setq dir (vlax-3D-point (trans (getvar 'viewdir) 1 0))
  125.          pnt (vlax-3D-point pnt)
  126.    )
  127.    (vl-some
  128.       '(lambda ( tab / row col )
  129.            (if (= :vlax-true (vla-hittest tab pnt dir 'row 'col))
  130.                (list tab row col)
  131.            )
  132.        )
  133.        lst
  134.    )
  135. )
  136. ;; Start Undo  -  Lee Mac
  137. ;; Opens an Undo Group.
  138. (defun LM:startundo ( doc )
  139.    (LM:endundo doc)
  140.    (vla-startundomark doc)
  141. )
  142. ;; End Undo  -  Lee Mac
  143. ;; Closes an Undo Group.
  144. (defun LM:endundo ( doc )
  145.    (while (= 8 (logand 8 (getvar 'undoctl)))
  146.        (vla-endundomark doc)
  147.    )
  148. )
  149. ;; Active Document  -  Lee Mac
  150. ;; Returns the VLA Active Document Object
  151. (defun LM:acdoc nil
  152.    (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
  153.    (LM:acdoc)
  154. )
  155. (vl-load-com) (princ)
  156. ;;----------------------------------------------------------------------;;
  157. ;;                             End of File                              ;;
  158. ;;----------------------------------------------------------------------;;
回复

使用道具 举报

17

主题

193

帖子

179

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
84
发表于 2022-7-5 18:25:13 | 显示全部楼层
请参阅我的附件。我已经通过图案填充和重新创建边界关闭了您图形中未关闭的区域。
然后你可以使用李的Lisp程序快速得到每个地段的面积。
回复

使用道具 举报

2

主题

7

帖子

5

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 18:32:09 | 显示全部楼层
不幸的是,Lisp在修改时出现了一些问题。。。不过,我现在很高兴使用边界,因为这本身节省了很多时间。。。感谢所有帮助和李
回复

使用道具 举报

2

主题

7

帖子

5

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 18:35:41 | 显示全部楼层
这就是我用的Dadgag。。。但是在Lisp程序的时候。。。那看起来不错,我在哪里可以找到。。。?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 00:13 , Processed in 0.585890 second(s), 74 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表