+ Reply to Thread
Results 1 to 8 of 8

Thread: hatch dxf group

  1. #1
    Senior Member
    Discipline
    Architectural
    svorgodne's Discipline Details
    Occupation
    Architect. Lisp developer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    May 2007
    Location
    Vienna, Austria
    Posts
    155

    Default hatch dxf group

    Registered forum members do not see this ad.

    hello everyone,

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

    Thanks in advance

  2. #2
    Senior Member
    Discipline
    Architectural
    svorgodne's Discipline Details
    Occupation
    Architect. Lisp developer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    May 2007
    Location
    Vienna, Austria
    Posts
    155

    Default

    Found it... thanks anyways

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

    This might be helpful

    Code:
    (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)
        )
      )
    )

  3. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,559

    Default

    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.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  4. #4
    Senior Member
    Discipline
    Architectural
    svorgodne's Discipline Details
    Occupation
    Architect. Lisp developer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    May 2007
    Location
    Vienna, Austria
    Posts
    155

    Default

    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

  5. #5
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    997

    Default

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


    Code:
    (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...

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,559

    Default

    Quote Originally Posted by svorgodne View Post
    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.

    Quote Originally Posted by rlx View Post
    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.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  7. #7
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    997

    Default

    Quote Originally Posted by Lee Mac View Post
    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


    one way of finding the bad ones :


    Code:
    ; http://www.theswamp.org/index.php?topic=44532.0
    (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
    Last edited by rlx; 16th May 2018 at 01:51 pm.

  8. #8
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    673

    Default

    Registered forum members do not see this ad.

    If the hatch is associative you can check the boundary loop:
    Code:
    (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)
      )
    )
    BricsCAD 18

Similar Threads

  1. Changing a hatch pattern scale, from a solid hatch
    By CesarA in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 14th Jan 2016, 04:25 pm
  2. Replies: 14
    Last Post: 21st Jan 2015, 06:23 am
  3. Acts like a group but NOT a group
    By Florida John in forum 3D Modelling
    Replies: 1
    Last Post: 8th Jul 2012, 06:07 pm
  4. Lisp or codes to explode group of entities (gathered by GROUP command)
    By Sweety in forum AutoLISP, Visual LISP & DCL
    Replies: 23
    Last Post: 29th Dec 2010, 03:19 pm
  5. Printing PDFs / JPGs - hatch / super hatch errors
    By busseynova in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 20th Mar 2010, 02:12 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts