Jump to content

hatch dxf group


svorgodne

Recommended Posts

hello everyone,

 

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

 

Thanks in advance

Link to comment
Share on other sites

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)
   )
 )
)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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)
 )
)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...