MOORADAN 发表于 2022-7-5 17:45:20

你会救我很多命

大家好,
 
我有一块1200块的土地,类似于附件中所示。多边形线未连接。我需要一种方法来找到每个地块的封闭区域,该区域需要在图纸上显示为文本…任何建议写一个脚本或lisp来解决这个问题…
 
你救了我很多命
 
干杯
地区图纸

nod684 发表于 2022-7-5 17:55:54

 
 
创建单独的图案填充并在单独的层上重新创建边界可能吗?
 
 
编辑:
 
 
在5分钟内按照我的建议完成
 
 
由于它已经是闭合多段线。。。
你可以很容易地得到每一个的面积
区域_01。图纸

MOORADAN 发表于 2022-7-5 17:58:24

“创建单独的图案填充,并在单独的层上重新创建边界,可能吗?”
 
谢谢你…但那需要很长时间…我认为是有用的
 
 
“Boundary”命令,选择封闭区域,检查创建的多段线,添加区域文本。。(但这些事情应该在脚本中进行,而不是手动进行,因为这需要很长时间)。。不知道怎么写

Dadgad 发表于 2022-7-5 18:02:16

看看李的lisp,如果你需要生成一个表的话,在他的网站上还有其他的。
 
多个地块的总面积是本LISP和他的另一个区域LISP中的一个选项,具有表格功能。
 
http://www.lee-mac.com/areastofield.html
 
谢谢李!

MOORADAN 发表于 2022-7-5 18:08:32

你总是在那里帮助爸爸。。。我会查一下然后再给你回复。。。

Dadgad 发表于 2022-7-5 18:14:14

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

BIGAL 发表于 2022-7-5 18:21:51

希望李不介意你可以添加一个边界的代码为一个单一的地区选择。唯一的缺点是未创建表格。
 

;;------------------------=={ Areas to Field }==------------------------;;
;;                                                                      ;;
;;This program allows a user to create an MText object containing a   ;;
;;Field Expression referencing the area, or sum of areas, of one or   ;;
;;more selected objects.                                              ;;
;;                                                                      ;;
;;Upon issuing the command syntax 'A2F' at the AutoCAD command-line,;;
;;the user is prompted to make a selection of objects for which to    ;;
;;retrieve the area; if more than one object is selected, the         ;;
;;cumulative area for all objects will be displayed by the resultant;;
;;MText Field.                                                      ;;
;;                                                                      ;;
;;Following object selection, the user is prompted to pick a point    ;;
;;at which to create the MText Field. If the specified point resides;;
;;within an AutoCAD table cell, the program will populate the table   ;;
;;cell with the appropriate Field Expression.                         ;;
;;                                                                      ;;
;;The Field will display the sum of the areas of the selected         ;;
;;objects, formatted using the Field formatting code specified at   ;;
;;the top of the program - this formatting code may be altered to   ;;
;;suit the user's requirements.                                       ;;
;;                                                                      ;;
;;----------------------------------------------------------------------;;
;;Author:Lee Mac, Copyright © 2014-www.lee-mac.com            ;;
;;----------------------------------------------------------------------;;
;;Version 1.3    -    2014-07-17                                    ;;
;;----------------------------------------------------------------------;;

; Boundary poly added by BIGAL 28-04-2016

(defun c:a2fbp ( / *error* fmt inc ins lst sel str pt )
   (setq fmt "%lu6%qf1") ;; Field Formatting
   (defun *error* ( msg )
       (LM:endundo (LM:acdoc))
       (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
         (princ (strcat "\nError: " msg))
       )
       (princ)
   )
(setq ins (getpoint "Pick inside pt of new boundary"))
(command "-boundary" ins "")

; (if (and (setq sel (ssget '((0 . "ARC,CIRCLE,ELLIPSE,HATCH,*POLYLINE,REGION,SPLINE"))))
    (if (and (setq sel (ssget "L"))
;             (setq ins (getpoint "\nPick point or cell for field: "))
       )
       (progn
         (if (setq tmp
                   (ssget "_X"
                     (list '(0 . "ACAD_TABLE")
                           (if (= 1 (getvar 'cvport))
                               (cons 410 (getvar 'ctab))
                              '(410 . "Model")
                           )
                     )
                   )
               )
               (repeat (setq idx (sslength tmp))
                   (setq tab (cons (vlax-ename->vla-object (ssname tmp (setq idx (1- idx)))) tab))
               )
         )
         (if (= 1 (sslength sel))
               (setq str
                   (strcat
                     "%<\\AcObjProp Object(%<\\_ObjId "
                     (LM:ObjectID (vlax-ename->vla-object (ssname sel 0)))
                     ">%).Area \\f \"" fmt "\">%"
                   )
               )
               (progn
                   (repeat (setq idx (sslength sel))
                     (setq lst
                           (vl-list*
                               "%<\\AcObjProp Object(%<\\_ObjId "
                               (LM:ObjectID (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
                               ">%).Area>%" " + "
                               lst
                           )
                     )
                   )
                   (setq str
                     (strcat
                           "%<\\AcExpr "
                           (apply 'strcat (reverse (cdr (reverse lst))))
                           " \\f \"" fmt "\">%"
                     )
                   )
               )
         )
         (LM:startundo (LM:acdoc))
         (if (setq tmp (LM:getcell tab (trans ins 1 0)))
               (apply 'vla-settext (append tmp (list str)))
               (vla-addmtext
                   (vlax-get-property (LM:acdoc) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
                   (vlax-3D-point (trans ins 1 0))
                   0.0
                   str
               )
         )
         (LM:endundo (LM:acdoc))
       )
   )
   (princ)
)
;; ObjectID-Lee Mac
;; Returns a string containing the ObjectID of a supplied VLA-Object
;; Compatible with 32-bit & 64-bit systems

(defun LM:ObjectID ( obj )
   (eval
       (list 'defun 'LM:ObjectID '( obj )
         (if
               (and
                   (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE"))
                   (vlax-method-applicable-p (vla-get-utility (LM:acdoc)) 'getobjectidstring)
               )
               (list 'vla-getobjectidstring (vla-get-utility (LM:acdoc)) 'obj ':vlax-false)
            '(itoa (vla-get-objectid obj))
         )
       )
   )
   (LM:ObjectID obj)
)
;; Get Cell-Lee Mac
;; If the supplied point lies within a cell boundary,
;; returns a list of: (<VLA Table Object> <Row> <Col>)
(defun LM:getcell ( lst pnt / dir )
   (setq dir (vlax-3D-point (trans (getvar 'viewdir) 1 0))
         pnt (vlax-3D-point pnt)
   )
   (vl-some
      '(lambda ( tab / row col )
         (if (= :vlax-true (vla-hittest tab pnt dir 'row 'col))
               (list tab row col)
         )
       )
       lst
   )
)

;; Start Undo-Lee Mac
;; Opens an Undo Group.

(defun LM:startundo ( doc )
   (LM:endundo doc)
   (vla-startundomark doc)
)

;; End Undo-Lee Mac
;; Closes an Undo Group.

(defun LM:endundo ( doc )
   (while (= 8 (logand 8 (getvar 'undoctl)))
       (vla-endundomark doc)
   )
)

;; Active Document-Lee Mac
;; Returns the VLA Active Document Object

(defun LM:acdoc nil
   (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
   (LM:acdoc)
)

(vl-load-com) (princ)

;;----------------------------------------------------------------------;;
;;                           End of File                              ;;
;;----------------------------------------------------------------------;;

nod684 发表于 2022-7-5 18:25:13

请参阅我的附件。我已经通过图案填充和重新创建边界关闭了您图形中未关闭的区域。
然后你可以使用李的Lisp程序快速得到每个地段的面积。

MOORADAN 发表于 2022-7-5 18:32:09

不幸的是,Lisp在修改时出现了一些问题。。。不过,我现在很高兴使用边界,因为这本身节省了很多时间。。。感谢所有帮助和李

MOORADAN 发表于 2022-7-5 18:35:41

这就是我用的Dadgag。。。但是在Lisp程序的时候。。。那看起来不错,我在哪里可以找到。。。?
页: [1] 2
查看完整版本: 你会救我很多命