Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add areas of multiple hatches

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
Anonymous
27115 Views, 10 Replies

How to add areas of multiple hatches

I have a drawing with many hatches. I need the area of each hatch in the drawing. I used FIELD command, it works but is slow with many hatches. Does AutoCAD have a feature to label more objects with one command?

10 REPLIES 10
Message 2 of 11
Patchy
in reply to: Anonymous

Use Properties Pallette

 

Untitled.png

Message 3 of 11
john.vellek
in reply to: Anonymous

Hi cserszomorce0,

 

As @Patchy indicates, the properties palette is a great way to see this kind of information. Check out the Qselect command to select all the areas at once!

 

The fields can be a useful tool if you need to reuse the information or schedule it in a table but can be tedious for a onetime process.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 4 of 11
Anonymous
in reply to: john.vellek

I use Properties if I need the areas only once but sometimes I need the information many times or permanently. It would be good on the drawing or in a list if I can identify which number goes tohether which hatch.
I attached a picture about it, it is made with Field command but I have sometimes much more hatches than in this drawing.

Message 5 of 11
Patchy
in reply to: Anonymous

You can try this from Lee-Mac.com

 

http://www.lee-mac.com/areastofield.html

Message 6 of 11
wispoxy
in reply to: Anonymous

Hello @Anonymous, you should be able to select objects non stop and it will just keep filling. Or you can box in everything too. Easy process even if you have to fill in one hundred spots in one drawing.

 

wisp_hs24m.png

Message 7 of 11
Anonymous
in reply to: wispoxy


@Anonymous wrote:

Hello @Anonymous, you should be able to select objects non stop and it will just keep filling. Or you can box in everything too. Easy process even if you have to fill in one hundred spots in one drawing.

 

wisp_hs24m.png


Can you please demonstrate how your solution provides what the OP wants to do?  He provided an image in post #4.  

Message 8 of 11
john.vellek
in reply to: Anonymous

Hi @Anonymous,

 

This is always a challenge. @Patchy's link provides a slick LISP routine to do some of this.

 

In the past I have used a combination of techniques to create a schedule. 

 

One way is to make a table and insert a field linked to the object's area. This works well but makes it difficult to know which area is which.

 

So the other way I have done this is to create a block with two attributes: one for the area name and a second to capture the area size

 

I can then create a table to capture both pieces of information. Once in a table you can even export it to Excel to perform calculations. The only draw back is that you have to manually enter the area into the attribute value.

 

Perhaps this will get you started on a solution that best fits your needs.

 

Please hit the Accept as Solution button if my post fully solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 9 of 11
wispoxy
in reply to: Anonymous

@Anonymous Thanks for pointing that out. I was only missing out on 90% Smiley Indifferent 

 

An attribute definition with multiple fields and blocked to be associated with a hatch pattern. Then selecting multiple objects to be filled with the attribute definition shown in the center with a hatch around it within all the objects selected.

 

I understand @john.vellek's method but requires too much time without the MULTIPLE command.

It's a bit complicated (just a too much to share) for someone that's not familiar with attribute definition connections and field connections. I'm trying to find an add-on instead.

Message 10 of 11
ВeekeeCZ
in reply to: Anonymous


@Anonymous wrote:

I have a drawing with many hatches. I need the area of each hatch in the drawing. I used FIELD command, it works but is slow with many hatches. Does AutoCAD have a feature to label more objects with one command?


You can try these routines. The first makes area as a field, the second as a text. 

Text is placed in the middle of shape, but be careful about specific shapes such as "U" shape, where the middle point is NOT laying inside of shape.

 

Spoiler
(vl-load-com)

(defun c:HatchArea2Field  (/ asp adoc ss en ptsum ptlst ID field obj pt)
  
  (setq  asp (vla-get-modelspace (setq adoc (vla-get-activedocument (vlax-get-acad-object)))))
  (vla-startundomark adoc)
  
  (if (setq ss (ssget ":L" '((0 . "HATCH") (410 . "Model"))))
    (repeat (sslength ss)
      (setq en     (ssname ss 0)
	    ptsum   '(0 0)
	    ptlst (cdr (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget en))))
	    novrt  (length ptlst)
	    ID     (itoa (vla-get-objectid (vlax-ename->vla-object en)))
	    field (strcat "%<\\AcObjProp Object(%<\\_ObjId " ID ">%).Area \\f \"%lu2\">%"))
      (foreach x ptlst (setq ptsum (mapcar '+ x ptsum)))
      (vla-put-AttachmentPoint
	(setq obj (vla-addMText asp (setq pt (vlax-3d-point (mapcar '/ ptsum (list novrt novrt)))) 0 field))
	acAttachmentPointMiddleCenter)
      (vla-put-InsertionPoint obj pt)
      (ssdel en ss)
      )
    (princ "\nNo object found."))
  (vla-endundomark adoc)
  (princ)
)


(defun c:HatchArea2Text  (/ asp adoc ss en ptsum ptlst ID area obj pt)
  
  (setq  asp (vla-get-modelspace (setq adoc (vla-get-activedocument (vlax-get-acad-object)))))
  (vla-startundomark adoc)
  
  (if (setq ss (ssget ":L" '((0 . "HATCH") (410 . "Model"))))
    (repeat (sslength ss)
      (setq en     (ssname ss 0)
	    area  (rtos (vla-get-area (vlax-ename->vla-object en)) 2)
	    ptsum   '(0 0)
	    ptlst (cdr (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget en))))
	    novrt (length ptlst))
      (foreach x ptlst (setq ptsum (mapcar '+ x ptsum)))
      (vla-put-AttachmentPoint
	(setq obj (vla-addMText asp (setq pt (vlax-3d-point (mapcar '/ ptsum (list novrt novrt)))) 0 area))
	acAttachmentPointMiddleCenter)
      (vla-put-InsertionPoint obj pt)
      (ssdel en ss)
      )
    (princ "\nNo object found."))
  (vla-endundomark adoc)
  (princ)
)
Message 11 of 11
Anonymous
in reply to: Anonymous

Thank you for all your solutions!

I've never used lisp, I think it's time to learn it 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report