andyb57J Posted March 28 Author Posted March 28 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 Quote
BIGAL Posted March 28 Posted March 28 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 Quote
SLW210 Posted March 29 Posted March 29 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? Quote
andyb57J Posted March 29 Author Posted March 29 (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 March 30 by andyb57J Quote
andyb57J Posted March 29 Author Posted March 29 (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 March 30 by andyb57J Quote
andyb57J Posted March 30 Author Posted March 30 On 29/03/2025 at 06:08, GLAVCVS said: What properties exactly do you need to export? 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. Quote
andyb57J Posted March 30 Author Posted March 30 (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 March 30 by andyb57J Quote
andyb57J Posted March 30 Author Posted March 30 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 Quote
SLW210 Posted March 30 Posted March 30 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. Quote
SLW210 Posted March 30 Posted March 30 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. Quote
SLW210 Posted March 30 Posted March 30 I moved your thread to the Civil 3D & LDD Forum since this is a Civil 3D issue, specifically. Quote
andyb57J Posted March 30 Author Posted March 30 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. Quote
BIGAL Posted March 30 Posted March 30 (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 March 30 by BIGAL Quote
andyb57J Posted March 30 Author Posted March 30 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. Quote
SLW210 Posted March 31 Posted March 31 Why wouldn't you just run MAPCLEAN on them and fix them? Quote
andyb57J Posted April 13 Author Posted April 13 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) ) Quote
Recommended Posts
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.