Jump to content
svorgodne

hatch dxf group

Recommended Posts

svorgodne

hello everyone,

 

what is the dxf group for a hatch that was generated from an opened polyline?

 

Thanks in advance

Share this post


Link to post
Share on other sites
svorgodne

Found it... thanks anyways

 

(93 . 4) --> generated from a closed polyline

(93 . 6) --> generated from a opened polyline

 

This might be helpful

 

(setq cmdecho (getvar 'CMDECHO))
(setvar 'CMDECHO 0)
(setq SYM_SelectionSet (car (entsel)))
(setq LST_DataEntity (entget SYM_SelectionSet))
(initget 1 "One All")
(setq SYM_Methode
 (getkword
   "\nDo you want to...? [One/All]: "
 )
)
(cond
 (
   (= SYM_Methode "One")
   (setq SYM_DXFGroup
     (getstring
       "\nEnter DXF Group Number: "
     )
   )
   (princ
     (assoc (atoi SYM_DXFGroup) LST_DataEntity)
   )
   (mapcar
     '(lambda (SYM_Member)
       (print (assoc SYM_Member LST_DataEntity))
     )
     LST_DataEntity
   )
 )
 (
   (= SYM_Methode "All")
   (foreach miembro LST_DataEntity
     (print miembro)
   )
 )
)

Share this post


Link to post
Share on other sites
Lee Mac

I think you are mistaken: DXF group 93 stores the number of edges in the hatch boundary or number of vertices in a polyline hatch boundary.

Share this post


Link to post
Share on other sites
svorgodne

Thanks as always dear Lee.

 

What would be then the DXF group that identifies if a hatch was generated from an open polyline?

 

Thanks in advance

Share this post


Link to post
Share on other sites
rlx

Not really my area of expertise but did a little test and noticed that a hatch from a closed polyline has an area and the open one has not... so....

 

 

(defun c:t1 ( / e )
 (if (and (setq e (car (entsel))) (= (cdr (assoc 0 (entget e))) "HATCH"))
   (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-get-Area  (list (vlax-ename->vla-object e))))
     (princ "\nHatch created by open poly")
     (princ "\nHatch created by closed poly")
   )
   (princ "\nNothing selected or object was not a Hatch")
 )
 (princ)
)

maybe it works , maybe not...

Share this post


Link to post
Share on other sites
Lee Mac
What would be then the DXF group that identifies if a hatch was generated from an open polyline?

 

I don't believe there is a specific DXF group which will provide this information.

 

Not really my area of expertise but did a little test and noticed that a hatch from a closed polyline has an area and the open one has not... so....

 

A good suggestion, however, the area property will also return an error if the hatch has a self-intersecting boundary, therefore this may return false-positives.

Share this post


Link to post
Share on other sites
rlx
Posted (edited)

I don't believe there is a specific DXF group which will provide this information.

A good suggestion, however, the area property will also return an error if the hatch has a self-intersecting boundary, therefore this may return false-positives.

 

 

Looking on the bright side of things : learned something new this day :-) thanx for the info :beer:

 

 

one way of finding the bad ones :

 

 

; [url]http://www.theswamp.org/index.php?topic=44532.0[/url]
(defun c:HatchAreas (/ AREA CNT OBJ OBJVL ORC SSET )
 (defun NLayer (Nme)
   (if (not (tblsearch "LAYER" Nme))
     (progn (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord")
      (cons 100 "AcDbLayerTableRecord") (cons 2  Nme) (cons 70 0) (cons 62 1))))))
 (nlayer "HatchHasNoArea")
 (if (>= (atof (substr (getvar "acadver") 1 4)) 16.2)
   (progn
     (prompt "\nSelect hatches: ")
     (if (and (setq sset (ssget '((0 . "hatch"))) cnt 0 area 0))
(progn
  (repeat (sslength sset)
    (setq obj   (ssname sset cnt))
    (setq objvl (vlax-ename->vla-object obj))
    (if (vl-catch-all-error-p
   (vl-catch-all-apply 'vla-get-area (list objvl)))
      (progn (vla-put-color objvl 256)(vla-put-layer objvl "HatchHasNoArea")) ;prgn
      (setq area (+ area (vla-get-area objvl)))
      ) ;if
    (setq cnt (1+ cnt))
  ) ; repeat
)
     ) ;if
   )
 ) ; if
 (alert
   (strcat
     "\nTotal area = "
     (if (or (= (getvar "lunits") 3) (= (getvar "lunits") 4))
(strcat (rtos area 2) " sq. in. (" (rtos (/ area 144) 2) " sq. ft.)"
 "\nHatchs with RED color DID NOT calculated")
(strcat (rtos area) "\nHatchs with RED color DID NOT calculated"))
   ) ; strcat
 ) ;alert
) ; defun

Edited by rlx

Share this post


Link to post
Share on other sites
Roy_043

If the hatch is associative you can check the boundary loop:

(defun c:HatchLwPolyBoundaryClosed_P ( / elst enm)
 (and
   (setq enm (car (entsel "\nSelect hatch: ")))
   (setq elst (entget enm))
   (vl-position '(0 . "HATCH") elst)
   (or
     (setq elst (member '(97 . 1) elst)) ; Remove first gc 330 items and check for single boundary loop.
     (prompt "\nError: more than one boundary entity ")
   )
   (setq enm (cdr (assoc 330 elst))) ; Ename of loop.
   (setq elst (entget enm))
   (or
     (vl-position '(0 . "LWPOLYLINE") elst)
     (prompt "\nError: not an LWPOLYLINE ")
   )
   (= (logand (cdr (assoc 70 elst)) 1) 1)
 )
)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×