Author Topic: How to get hatch object area in AutoCAD 2004 version?  (Read 4892 times)

0 Members and 1 Guest are viewing this topic.

Faster

  • Guest
How to get hatch object area in AutoCAD 2004 version?
« on: June 13, 2012, 08:36:46 PM »
Dear ALL:

How to get hatch object area in 2004 version? I know heigher than version 2004 can use property area,but cad 2004 do not support property area!

Thanks!

hmspe

  • Bull Frog
  • Posts: 362
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #1 on: June 13, 2012, 09:46:58 PM »
Get hatchb.lsp at   http://www.jtbworld.com/lisp/hatchb.htm

hatchb.lsp will draw a boundary around a hatch.  You can use the list command on the boundary to get the area.
"Science is the belief in the ignorance of experts." - Richard Feynman

Faster

  • Guest
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #2 on: June 14, 2012, 02:50:21 AM »
Get hatchb.lsp at   http://www.jtbworld.com/lisp/hatchb.htm

hatchb.lsp will draw a boundary around a hatch.  You can use the list command on the boundary to get the area.

Thanks!
I know that  routine! When  pattern including Spline and ellipse entityes,That routine sometimes  can't get the right result!
Is there any other better way?


irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #3 on: June 14, 2012, 05:05:57 AM »
I wonder if there's a routine to change the boundaries of a hatch into a region instead. Perhaps this: http://www.jtbworld.com/lisp/hatchb.htm
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

hmspe

  • Bull Frog
  • Posts: 362
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #4 on: June 14, 2012, 09:16:26 AM »
How much error have you seen using hatchb.lsp?  How do you know that there is an error?  Any errors I've seen have been so small that they are insignificant.

Segments of splines and ellipses do not exactly match the shape of the original entity so there will always be some error in an area calculation if there are splines or ellipses in the boundary of the area.
"Science is the belief in the ignorance of experts." - Richard Feynman

Faster

  • Guest
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #5 on: June 14, 2012, 10:03:55 AM »
How much error have you seen using hatchb.lsp?  How do you know that there is an error?  Any errors I've seen have been so small that they are insignificant.

Segments of splines and ellipses do not exactly match the shape of the original entity so there will always be some error in an area calculation if there are splines or ellipses in the boundary of the area.
Using the routine hatchb.lsp,The following DWG can not get the right result!

I have fixed the routine!
« Last Edit: June 14, 2012, 10:47:53 AM by Faster »

Faster

  • Guest
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #6 on: June 14, 2012, 11:51:28 AM »
I wonder if there's a routine to change the boundaries of a hatch into a region instead. Perhaps this: http://www.jtbworld.com/lisp/hatchb.htm

Change the boundaries of a hatch into a region is a good solution! Thanks !

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #7 on: June 14, 2012, 12:11:07 PM »
Yep, though I can't find any lisp which does this. I thought trying to simply change that one to create regions instead of PL's, just haven't had time today.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Faster

  • Guest
Re: How to get hatch object area in AutoCAD 2004 version?
« Reply #8 on: June 15, 2012, 12:39:15 AM »
I have successfully solved the problem.
Code - Auto/Visual Lisp: [Select]
  1.  
  2. ;;; HATCHB.LSP ver 2.5
  3. ;;; Recreates hatch boundary by selecting a hatch
  4. ;;; Known problem with some elipses and splines
  5. ;;; By Jimmy Bergmark
  6. ;;; Copyright (C) 1997-2008 JTB World, All Rights Reserved
  7. ;;; Website: www.jtbworld.com
  8. ;;; E-mail: info@jtbworld.com
  9. ;;; 2000-02-12 - First release
  10. ;;; 2000-03-27 - Counterclockwise arcs and ellipses fixed
  11. ;;;              Objects created joined to lwpolyline if possible
  12. ;;;              Error-handling, undo of command
  13. ;;;              Can handle PLINETYPE = 0,1,2
  14. ;;; 2000-03-30 - Integrating hatchb and hatchb14
  15. ;;;              Selection of many hatches
  16. ;;;              Splines supported if closed.
  17. ;;; 2001-04-02 - Fixed bug with entmake of line with no Z for r14
  18. ;;; 2001-07-31 - Removed an irritating semicolon to enable polylines to be created.
  19. ;;; 2001-10-04 - Changed mail and homepage so it's easy to find when new versions comes up.
  20. ;;; 2003-02-06 - Minor fix
  21. ;;; 2003-02-17 - Area returned if no islands is found since it's not consistant
  22. ;;; 2003-05-19 - Fix to take PEDITACCEPT variable used in AutoCAD 2004 into account
  23. ;;; 2004-11-05 - Minor bugs fixed
  24. ;;; 2006-03-18 - Nothing changed from 2.1 other that it's been confirmed to work with AutoCAD 2007
  25. ;;; 2006-05-13 - Create the boundary on the same layer as the hatch using the hbl command and
  26. ;;;              on current layer/color/linetype using the hb or hatchb command
  27. ;;; 2007-02-08 - Fixed a bug with the hbl command
  28. ;;; 2008-02-29 - Support for hatches in non WCS thanks to xiaocai
  29. ;;; Tested on AutoCAD r14, 2000, 2000i, 2002, 2004, 2005, 2006, 2007, 2008, 2009
  30. ;;; should be working on older versions too.
  31.  
  32. (defun c:hbb () (hatchb nil)) ; this line can be commented out if there is an existing command called hb
  33. (defun c:hbbl () (hatchb T)) ; this line can be commented out if there is an existing command called hbl
  34. (defun c:hatchb () (hatchb1 nil))
  35. (defun hatchb (hl  /     es    blay  ed1   ed2   loops1      bptf  part
  36.              et    noe   plist ic    bul   nr    ang1  ang2  obj *ModelSpace* *PaperSpace*
  37.              space cw errexit undox olderr oldcmdecho ss1 lastent en1 en2 ss lwp
  38.              list->variantArray 3dPoint->2dPoint A2k ent i ss2
  39.              knot-list controlpoint-list kn cn pos xv bot area hst noarea
  40.             )
  41.  (setq A2k (>= (substr (getvar "ACADVER") 1 2) "15"))
  42.  (if A2k
  43.    (progn
  44.      (defun list->variantArray (ptsList / arraySpace sArray)
  45.        (setq arraySpace
  46.               (vlax-make-safearray
  47.                 vlax-vbdouble
  48.                 (cons 0 (- (length ptsList) 1))
  49.               )
  50.        )
  51.        (setq sArray (vlax-safearray-fill arraySpace ptsList))
  52.        (vlax-make-variant sArray)
  53.      )
  54.      (defun areaOfObject (en / curve area)
  55.        (if en
  56.          (if A2k
  57.            (progn
  58.              (setq curve (vlax-ename->vla-object en))
  59.              (if
  60.                (vl-catch-all-error-p
  61.                  (setq
  62.                    area
  63.                     (vl-catch-all-apply 'vlax-curve-getArea (list curve))
  64.                  )
  65.                )
  66.                 nil
  67.                 area
  68.              )
  69.            )
  70.            (progn
  71.              (command "._area" "_O" en)
  72.              (getvar "area")
  73.            )
  74.          )
  75.        )
  76.      )
  77.    )
  78.  )
  79.  (if A2k
  80.   (defun 3dPoint->2dPoint (3dpt)
  81.     (list (float (car 3dpt)) (float (cadr 3dpt)))
  82.   )
  83.  )
  84.  
  85.   (defun errexit (s)
  86.     (princ "\nError:  ")
  87.     (princ s)
  88.     (restore)
  89.   )
  90.  
  91.   (defun undox ()
  92.     (command "._ucs" "_p")
  93.     (command "._undo" "_E")
  94.     (setvar "cmdecho" oldcmdecho)
  95.     (setq *error* olderr)
  96.     (princ)
  97.   )
  98.  
  99.   (setq olderr  *error*
  100.         restore undox
  101.         *error* errexit
  102.   )
  103.   (setq oldcmdecho (getvar "cmdecho"))
  104.   (setvar "cmdecho" 0)
  105.   (command "._UNDO" "_BE")
  106.   (if A2k (progn
  107.     (vl-load-com)
  108.     (setq *ModelSpace* (vla-get-ModelSpace
  109.                          (vla-get-ActiveDocument (vlax-get-acad-object))
  110.                        )
  111.           *PaperSpace* (vla-get-PaperSpace
  112.                          (vla-get-ActiveDocument (vlax-get-acad-object))
  113.                        )
  114.     ))
  115.   )
  116.  
  117.  
  118. ; Remove for testing purpose
  119. ; (setq A2k nil)
  120.  
  121.   (if (/= (setq ss2 (ssget '((0 . "HATCH")))) nil)
  122.    (progn
  123.     (setq i 0)
  124.     (setq area 0)
  125.     (setq bMoreLoops nil)
  126.     (while (setq ent (ssname ss2 i))
  127.       (setq noarea nil)
  128.       (setq ed1 (entget ent))
  129.       (setq layer (cdr (assoc 8 ed1)))
  130.       ; (if (not (equal (assoc 210 ed1) '(210 0.0 0.0 1.0))) (princ "\nHatch not in WCS!"))  ;modified by xiaocai
  131.       ; (setq xv (cdr (assoc 210 ed1)))                                                      ;modified by xiaocai
  132.       (command "._ucs" "_w")
  133.       (setq loops1 (cdr (assoc 91 ed1))) ; number of boundary paths (loops)
  134.       (if (and A2k (= (strcase (cdr (assoc 410 ed1))) "MODEL"))
  135.         (setq space *ModelSpace*)
  136.         (setq space *PaperSpace*)
  137.       )
  138.       (repeat loops1
  139.         (setq ed1 (member (assoc 92 ed1) ed1))
  140.         (setq bptf (cdr (car ed1))) ; boundary path type flag
  141.         (setq ic (cdr (assoc 73 ed1))) ; is closed
  142.         (setq noe (cdr (assoc 93 ed1))) ; number of edges
  143.         (setq bot (cdr (assoc 92 ed1))) ; boundary type
  144.         (setq hst (cdr (assoc 75 ed1))) ; hatch style
  145.         (setq ed1 (member (assoc 72 ed1) ed1))
  146.         (setq bul (cdr (car ed1))) ; bulge
  147.         (setq plist nil)
  148.         (setq blist nil)
  149.         (cond
  150.           ((> (boole 1 bptf 2) 0) ; polyline
  151.            (repeat noe
  152.              (setq ed1 (member (assoc 10 (cdr ed1)) ed1))
  153.              (setq plist (append plist (list    (trans (cdr (assoc 10 ed1)) ent 0)     ))) ;;add trans by xiaocai
  154.              (setq blist (append blist
  155.                                  (if (> bul 0)
  156.                                    (list (cdr (assoc 42 ed1)))
  157.                                    nil
  158.                                  )
  159.                          )
  160.              )
  161.            )
  162.            (if A2k (progn
  163.              (setq polypoints
  164.                     (apply 'append
  165.                            (mapcar '3dPoint->2dPoint plist)
  166.                     )
  167.              )
  168.              (setq VLADataPts (list->variantArray polypoints))
  169.              (setq obj (vla-addLightweightPolyline space VLADataPts))
  170.              (setq nr 0)
  171.              (repeat (length blist)
  172.                (if (/= (nth nr blist) 0)
  173.                  (vla-setBulge obj nr (nth nr blist))
  174.                )
  175.                (setq nr (1+ nr))
  176.              )
  177.              (if (= ic 1)
  178.                (vla-put-closed obj T)
  179.              )
  180.              (if hl (vla-put-layer obj layer))
  181.             )
  182.             (progn
  183.               (setq ne (append (list '(0 . "POLYLINE")) (list (cons 66 1))))
  184.               (if (= ic 1) (setq ne (append ne (list (cons 70 1)))))
  185.               (if hl (setq ne (append ne (list (cons 8 layer)))))
  186.               (entmake ne)
  187.               (setq nr 0)
  188.               (repeat (length plist)
  189.                 (if (= bul 0)
  190.                   (entmake (list (cons 0 "VERTEX")
  191.                                  (cons 10 (trans (nth nr plist) ent 0) );;add trans by xiaocai
  192.                            )
  193.                   )
  194.                   (entmake (list (cons 0 "VERTEX")
  195.                                  (cons 10 (trans (nth nr plist) ent 0) );;add trans by xiaocai
  196.                                  (cons 42 (nth nr blist))
  197.                            )
  198.                   )
  199.                 )
  200.                 (setq nr (1+ nr))
  201.               )
  202.               (entmake '((0 . "SEQEND")))
  203.             )
  204.            )
  205.           )
  206.           (t ; not polyline
  207.            (setq lastent (entlast))
  208.            (setq lwp T)
  209.            (repeat noe
  210.              (setq et (cdr (assoc 72 ed1)))
  211.              (cond
  212.                ((= et 1) ; line
  213.                 ;(setq ed1 (member (assoc 10 (cdr ed1)) ed1))
  214.                 (setq ed1 (cdr (member (assoc 72 ed1) ed1))) ;_  Modified by By Faster 2012.06.14
  215.                 (if A2k
  216.                   (progn
  217.                     (setq obj (vla-AddLine
  218.                       space
  219.                       (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)   ) ;;add trans by xiaocai
  220.                       (vlax-3d-point (trans (cdr (assoc 11 ed1)) ent 0)   ) ;;add trans by xiaocai
  221.                     ))
  222.                     (if hl (vla-put-layer obj layer))
  223.                   )
  224.                   (progn
  225.                     (setq ne (append (list (cons 0 "LINE"))
  226.                         (list (list 10 (car (trans (cdr (assoc 10 ed1)) ent 0) ) (cadr (trans (cdr (assoc 10 ed1)) ent 0)) 0)) ;;add trans by xiaocai
  227.                         (list (list 11 (car (trans (cdr (assoc 11 ed1)) ent 0) ) (cadr (trans (cdr (assoc 11 ed1)) ent 0)) 0)) ;;add trans by xiaocai
  228.                         ;(cons 210 xv)
  229.                       )
  230.                     )
  231.                     (if hl (setq ne (append ne (list (cons 8 layer)))))
  232.                     (entmake ne)
  233.                   )
  234.                 )
  235.                 (setq ed1 (cddr ed1))
  236.                )
  237.                ((= et 2) ; circular arc
  238.                  ;(setq ed1 (member (assoc 10 (cdr ed1)) ed1))
  239.                 (setq ed1 (cdr (member (assoc 72 ed1) ed1))) ;_  Modified by By Faster 2012.06.14
  240.                  (setq ang1 (cdr (assoc 50 ed1)))
  241.                  (setq ang2 (cdr (assoc 51 ed1)))
  242.                  (setq cw (cdr (assoc 73 ed1)))
  243.                  (if (and (equal ang1 0 0.00001) (equal ang2 6.28319 0.00001))
  244.                    (progn
  245.                      (if A2k
  246.                        (progn
  247.                          (setq obj (vla-AddCircle
  248.                            space
  249.                            (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)  )
  250.                            (cdr (assoc 40 ed1))
  251.                          ))
  252.                          (if hl (vla-put-layer obj layer))
  253.                        )
  254.                        (progn
  255.                          (setq ne (append
  256.                                       (list (cons 0 "CIRCLE"))
  257.                                       (list (cons 8 layer))
  258.                                       (list (cons 10 (trans (cdr (assoc 10 ed1)) ent 0)));;;add trans by xiaocai
  259.                                       (list (assoc 40 ed1))
  260.                                 )
  261.                          )
  262.                          (if hl (setq ne (append ne (list (cons 8 layer)))))
  263.                          (entmake ne)
  264.                        )
  265.                      )
  266.                      (setq lwp nil)
  267.                    )
  268.                    (if A2k
  269.                      (progn
  270.                        (setq obj (vla-AddArc
  271.                          space
  272.                          (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0) );;;add trans by xiaocai
  273.                          (cdr (assoc 40 ed1))
  274.                          (if (= cw 0)
  275.                            (- 0 ang2)
  276.                            ang1
  277.                          )
  278.                          (if (= cw 0)
  279.                            (- 0 ang1)
  280.                            ang2
  281.                          )
  282.                        ))
  283.                        (if hl (vla-put-layer obj layer))
  284.                      )
  285.                      (progn
  286.                        (setq ne (append (list (cons 0 "ARC"))
  287.                                     (list (cons 10 (trans (cdr (assoc 10 ed1)) ent 0) ));;add trans by xiaocai
  288.                                     (list (assoc 40 ed1))
  289.                                     (list (cons 50
  290.                                           (if (= cw 0)
  291.                                             (- 0 ang2)
  292.                                             ang1
  293.                                           )
  294.                                     ))
  295.                                     (list (cons 51
  296.                                           (if (= cw 0)
  297.                                             (- 0 ang1)
  298.                                             ang2
  299.                                           )
  300.                                     ))
  301.                               )
  302.                        )
  303.                        (if hl (setq ne (append ne (list (cons 8 layer)))))
  304.                        (entmake ne)
  305.                      )
  306.                    )
  307.                  )
  308.                  (setq ed1 (cddddr ed1))
  309.                )
  310.                ((= et 3) ; elliptic arc
  311.                 ;(setq ed1 (member (assoc 10 (cdr ed1)) ed1))
  312.                 (setq ed1 (cdr (member (assoc 72 ed1) ed1))) ;_  Modified by By Faster 2012.06.14
  313.                 (setq ang1 (cdr (assoc 50 ed1)))
  314.                 (setq ang2 (cdr (assoc 51 ed1)))
  315.                 (setq cw (cdr (assoc 73 ed1)))
  316.                 (if A2k (progn
  317.                   (setq obj (vla-AddEllipse
  318.                               space
  319.                               (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)   )
  320.                               (vlax-3d-point (trans (cdr (assoc 11 ed1)) ent 0) );;add trans by xiaocai
  321.                               (cdr (assoc 40 ed1))
  322.                             )
  323.                   )
  324.                   (vla-put-startangle obj (if (= cw 0) (- 0 ang2) ang1))
  325.                   (vla-put-endangle obj (if (= cw 0) (- 0 ang1) ang2))
  326.                   (if hl (vla-put-layer obj layer))
  327.                  )
  328.                  (progn
  329.                    (princ "\nElliptic arc not supported!")
  330.                    (setq noarea T)
  331.                  )
  332.                 )
  333.                 (setq lwp nil)
  334.                )
  335.                ((= et 4) ; spline
  336.                 ;(setq ed1 (member (assoc 94 (cdr ed1)) ed1))
  337.                 (setq ed1 (cdr (member (assoc 72 ed1) ed1))) ;_  Modified by By Faster 2012.06.14
  338.                 (setq knot-list nil)
  339.                 (setq controlpoint-list nil)
  340.                 (setq kn (cdr (assoc 95 ed1)))
  341.                 (setq cn (cdr (assoc 96 ed1)))
  342.                 (setq pos (vl-position (assoc 40 ed1) ed1))
  343.                 (repeat kn
  344.                   (setq knot-list (cons (cons 40 (cdr (nth pos ed1))) knot-list))
  345.                   (setq pos (1+ pos))
  346.                 )
  347.                 (setq pos (vl-position (assoc 10 ed1) ed1))
  348.                 (repeat cn
  349.                   (setq controlpoint-list (cons (cons 10 (trans (cdr (nth pos ed1)) ent 0)   ) controlpoint-list));;add trans by xiaocai
  350.                   (setq pos (1+ pos))
  351.                 )
  352.                 (setq knot-list (reverse knot-list))
  353.                 (setq controlpoint-list (reverse controlpoint-list))
  354.                 (setq ne (append
  355.                                (list '(0 . "SPLINE"))
  356.                                (list (cons 100 "AcDbEntity"))
  357.                                (list (cons 100 "AcDbSpline"))
  358.                                ;(list (cons 70 (+ 1 8 (* 2 (cdr (assoc 74 ed1))) (* 4 (cdr (assoc 73 ed1))))))
  359.                                (list (cons 70 (+  8 (* 2 (cdr (assoc 74 ed1))) (* 4 (cdr (assoc 73 ed1)))))) ;_  Modified by By Faster 2012.06.14
  360.                                (list (cons 71 (cdr (assoc 94 ed1))))
  361.                                (list (cons 72 kn))
  362.                                (list (cons 73 cn))
  363.                                knot-list
  364.                                controlpoint-list
  365.                       )
  366.                 )
  367.                 (if hl (setq ne (append ne (list (cons 8 layer)))))
  368.                 (entmake ne)
  369.                 (setq ed1 (member (assoc 10 ed1) ed1))
  370.                 (setq lwp nil)
  371.                )
  372.              ) ; end cond
  373.            ) ; end repeat noe
  374.            (if lwp (progn
  375.              (setq en1 (entnext lastent))
  376.              (setq ss (ssadd))
  377.              (ssadd en1 ss)
  378.              (while (setq en2 (entnext en1))
  379.                (ssadd en2 ss)
  380.                (setq en1 en2)
  381.              )
  382.              (if (= (getvar "peditaccept") 1)
  383.                (command "_.pedit" (entlast) "_J" ss "" "")
  384.                (command "_.pedit" (entlast) "_Y" "_J" ss "" "")
  385.              )
  386.           ))
  387.  
  388.           ) ; end t
  389.         ) ; end cond
  390. ;       Tries to get the area on islands but it's not clear how to know if an island is filled or not
  391. ;       and if it should be substracted or added to the total area.
  392. ;       (if (or (= bot 0) (= (boole 1 bot 1) 1)) (setq area (+ area (areaOfObject (entlast)))))
  393. ;       (if (and (/= hst 1) (/= bot 0) (= (boole 1 bot 1) 0)) (setq area (- area (areaOfObject (entlast)))))
  394. ;       (princ "\n") (princ bot) (princ "\n") (princ hst) (princ "\n")
  395. ;       (princ (areaOfObject (entlast)))
  396.       ) ; end repeat loops1
  397.       (if (and (= noarea nil) (= loops1 1)) (setq area (+ area (areaOfObject (entlast)))) (setq bMoreLoops T))
  398.       (setq i (1+ i))
  399.     )
  400.    )
  401.   )
  402.   (if (and area (not bMoreLoops)) (progn
  403.     (princ "\nTotal Area = ")
  404.     (princ area)
  405.   ))
  406.   (restore)
  407.   (princ)
  408. )
  409.  
  410.  
  411. ;;//////////////////////////////////////////////////////////////////////////////////
  412. ;;Create regions to get hatch area.
  413. ;;Get hatch area function
  414. ;;Written by  Faster
  415. (defun c:hatcharea
  416.        (/ ENDENT SS N REGIONS REG1 REGIONS1 REG01 REG02 RTN AREA)
  417.   (setq EndEnt (entlast))
  418.   (hatchb nil)
  419.   (setq ss (ssadd))
  420.   (while (setq EndEnt (entnext EndEnt))
  421.     (ssadd EndEnt ss)
  422.     )
  423.   (if (> (sslength ss) 0)
  424.     (progn
  425.       (setq endent (entlast))
  426.       (command "_region" ss "")
  427.       (setq ss (ssadd))
  428.       (while (setq EndEnt (entnext EndEnt))
  429.         (ssadd EndEnt ss)
  430.         )
  431.       (repeat (setq n (sslength ss))
  432.         (setq regions (cons (vlax-ename->vla-object
  433.                               (ssname ss (setq n (1- n))))
  434.                             regions))
  435.         )
  436.       (setq regions
  437.              (vl-sort regions
  438.                       '(lambda (a b)
  439.                          (> (vla-get-area a) (vla-get-area b)))))
  440.       (while regions
  441.         (setq reg1     (car regions)
  442.               regions  (cdr regions)
  443.               regions1 regions
  444.               )
  445.         (foreach reg2  regions1
  446.           (setq reg01 (vla-copy reg1))
  447.           (setq reg02 (vla-copy reg2))
  448.           (vla-Boolean reg01 acUnion reg02)
  449.           (if
  450.             (equal (vla-get-area reg01) (vla-get-area reg1) 1e-6)
  451.              (progn
  452.                (setq regions (vl-remove reg2 regions))
  453.                (vla-Boolean reg1 acSubtraction reg2)
  454.                )
  455.              )
  456.           (vla-delete reg01)
  457.           )
  458.         (setq rtn (cons reg1 rtn))
  459.         )
  460.       (setq area (apply '+ (mapcar 'vla-GET-AREA rtn)))
  461.       (mapcar 'vla-delete rtn)
  462.       (princ (strcat "\nTotal hatch area = " (rtos area 2 3) " ."))
  463.       (princ)
  464.       )
  465.     )
  466.   )
  467. ;;//////////////////////////////////////////////////////////////////////////////////
  468.