Jump to content

Civil3d exporting unbounded hatch to either dwg or dfx


Recommended Posts

Posted
On 26/03/2025 at 15:20, GLAVCVS said:

I don't have Civil3D at the moment, so I can't verify this.
But it seems that the "AECC_PARCEL" object must be a container object for other objects, the main one of which should be a hatch.
Perhaps someone with Civil3D can confirm this.

You are exactly right

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • andyb57J

    18

  • BIGAL

    6

  • SLW210

    6

  • GLAVCVS

    6

Top Posters In This Topic

Posted Images

Posted

Have you found any solution?

Posted

What properties exactly do you need to export?

Posted

The acad...10 dwg says its a hatch so what about generating a hatch boundary can then get the area.

 

(load "hatchb")
(c:hb)
(setq area (vlax-get (vlax-ename->vla-object (entlast)) 'area))
(command "erase" (entlast) "")

 

HatchB.lsp

Posted
13 hours ago, andyb57J said:

It is the hatch that I require to show the area geometry, not the polyline.  

 

Did you even bother to click the link I posted that explains the issue?

 

 

Posted (edited)
11 hours ago, SLW210 said:

 

Did you even bother to click the link I posted that explains the issue?

 

 

Thankyou and I did but unfortunately that site just continually refreshes.  Doesn't give me a chance to read it'.  Will keep trying

Edited by andyb57J
Posted (edited)
On 29/03/2025 at 06:11, BIGAL said:

The acad...10 dwg says its a hatch so what about generating a hatch boundary can then get the area.

 

(load "hatchb")
(c:hb)
(setq area (vlax-get (vlax-ename->vla-object (entlast)) 'area))
(command "erase" (entlast) "")

 

HatchB.lsp 13.15 kB · 78 downloads

 Thankyou

Edited by andyb57J
Posted
On 29/03/2025 at 06:08, GLAVCVS said:

What properties exactly do you need to export?

image.png.82a604c181be3159544993185eeecd9c.png    image.png.e563cb6eb76c2b500042a37b0c00f1db.png

 

The left is the hatched area as exported from Civil3d using using the EXPORTC3DDRAWING command.  As you can see although AutoCAD shows the hatch as "HATCH" there is no geometry (ie. Area or Accumulated Area).

 

The right is the hatched area after I use the GENERATEHATCHBOUNDRY command and rehatch the area.  It gives the two geometry fields I require.  Purpose is to allow the user without Civil3d to select the hatched areas, (given there could be hundreds of them) and obtain the accumulated area from the drawing without having to manually calculate or use excel spreadsheets.

 

 

Posted (edited)
On 29/03/2025 at 06:11, BIGAL said:

The acad...10 dwg says its a hatch so what about generating a hatch boundary can then get the area.

 

(load "hatchb")
(c:hb)
(setq area (vlax-get (vlax-ename->vla-object (entlast)) 'area))
(command "erase" (entlast) "")

 

HatchB.lsp 13.15 kB · 79 downloads

 

 

Thankyou.  This gives what I needed even though area is shown in the command line.  

Edited by andyb57J
Posted
7 hours ago, andyb57J said:

 Thankyou

Thankyou so much.  This is generally what I wanted although it still doesnt show the area etc in the properties manager after it recreates the hatch.  but I get the information I need from the command line.  Again thankyou

Posted

The link works fine for me.

 

Basically it states the reason the information is missing is due to errors in the creation of the geometry.

 

Quote

your hatch was created using a polyline that had overlapping nodes and segments

 

You should have stated you were having trouble accessing the Autodesk Forums.

Posted

The solution is to recreate the hatch boundary has has been suggested several times.

 

You might can fix them using MAPCLEAN.

 

As I stated the polylines are there, you just need to join and close.

Posted
23 minutes ago, SLW210 said:

I moved your thread to the Civil 3D & LDD Forum since this is a Civil 3D issue, specifically.

 

 

 

30 minutes ago, SLW210 said:

The solution is to recreate the hatch boundary has has been suggested several times.

 

You might can fix them using MAPCLEAN.

 

As I stated the polylines are there, you just need to join and close.

 I fully understand what you were saying but joining the polylines for each piece of hatch (where there maybe over 1000 individual hatch areas is just not practical.  As I said previously my current process was to use the HATCHGENERATEBOUNDRY command to regenerate the boundaries and then re-hatch them globally.  This provided me with the two missing fields in the property manager being the area and accumulated area of all selected hatch which was the information I was try to obtain.  What I was hoping to achieve was being able to use the hatch already within the drawing once it has been exported from Civil3d to AutoCAD without having to regenerate the boundaries and hatches which would be on multiple layers.

 

The post by BIGAL yesterday and the lisp he provided supplies the missing data within the command line which is suitable as this data is only required to complete spreadsheets within the drawing o convey information to the user etc.

 

Again I thank you for your input.

Posted (edited)

It may be your lucky day, like others I have write to Excel direct, so if we convert 1000 hatches we can get area and write to excel. Can you post a sample dwg with say a few hatches not a 1000, and an Excel showing header details, what is required to go where in Excel.

Edited by BIGAL
Posted
17 minutes ago, BIGAL said:

It may be your lucky day, like others I have write to Excel direct, so if we convert 1000 hatches we can get area and write to excel. Can you post a sample dwg with say a few hatches not a 1000, and an Excel showing header details, what is required to go where in Excel.

Thankyou but you have already given what I need.  If I need to output to excel I have tools that allow that but it is not necessary in this instance.

 

Thankyou.  

Posted

Why wouldn't you just run MAPCLEAN on them and fix them?

 

  • 2 weeks later...
Posted

Have solved my problem.  The attached lisp generates a boundary around the hatch exported from Civil3d to Autocad and then deletes the exiting hatch before creating new hatch on the same layer.  The missing geometry data is added to the hatch properties giving both area and accumulated area as per my original request.   

 

If anyone can improve the routine please feel free but it performs the task I was looking for.

 

Rehatchall.lsp

 

(defun c:Rehatchall ( / doc ms ss i ent vlaEnt lay lastEnt lastObj ptList newHatch sa loopList)
  (vl-load-com)
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq ms (vla-get-ModelSpace doc))

  (setq ss (ssget '((0 . "HATCH"))))
  (if ss
    (progn
      (setq i 0)
      (while (< i (sslength ss))
        (setq ent (ssname ss i))
        (setq vlaEnt (vlax-ename->vla-object ent))
        (setq lay (vla-get-layer vlaEnt))

        ;; Generate boundary
        (command "_HATCHGENERATEBOUNDARY" ent "")
        (command "") ;; Finalize command

        ;; Get last entity created as boundary
        (setq lastEnt (entlast))
        (setq lastObj (vlax-ename->vla-object lastEnt))
        (vla-put-layer lastObj lay)

        ;; Delete original hatch
        (vla-delete vlaEnt)

        ;; Prepare loop list
        (setq loopList (vlax-make-safearray vlax-vbObject '(0 . 0)))
        (vlax-safearray-put-element loopList 0 lastObj)

        ;; Create new solid hatch
        (setq newHatch (vla-AddHatch ms acHatchPatternTypePreDefined "SOLID" :vlax-true))
        (vla-put-layer newHatch lay)
        (vla-AppendOuterLoop newHatch loopList)
        (vla-Evaluate newHatch)

        (setq i (1+ i))
      )
      (princ "\nRehatching complete.")
    )
    (prompt "\nNo hatch objects found.")
  )
  (princ)
)

 

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