_civilpe Posted September 30, 2024 Posted September 30, 2024 I am writing a lisp routine to explode Civil 3D objects to then copy them to a CAD template. My lisp skips the "explode" command portion and heads straight into the copy objects to .dwt section without exploding the Civil 3D objects. How can I test my DWG to see if it contains Civil 3D objects before the lisp begins to copy objects to the .dwt file? Quote
Steven P Posted October 1, 2024 Posted October 1, 2024 AECC objects? You could do an ssget with filter (ssget (list (cons 0 "*aecc*"))) to select them all (use '_X' for all the drawing) and then if the selection set is created you have what you searched for Quote
BIGAL Posted October 2, 2024 Posted October 2, 2024 (edited) Inside CIV3D is the convert CIV3D objects to Autocad objects. "EXPORTTOAUTOCAD" will this help ? Please explain what objects ? Your request is to vague there is so many background functions in CIV3D. Just look at Toolspace. I have a couple of functions like make description key sets from Excel. Civ3d can export the key sets but not import. We had our CIV3D DWT set up, 250 layers, similar number blocks, linetypes and so on. Need blocks and layers to match description key sets for import field data. Use lee-mac steal to do this. Edited October 2, 2024 by BIGAL Quote
hosneyalaa Posted October 2, 2024 Posted October 2, 2024 Can you support it with an example drawing? Quote
SLW210 Posted October 3, 2024 Posted October 3, 2024 Also, post your LISP efforts as well as a .dwg. Quote
SLW210 Posted October 3, 2024 Posted October 3, 2024 Why not just run a Script on all of the drawings to -EXPORTTOAUTOCAD? What would it matter if it did or did not contain AECC objects? From what I read there could be hidden Civil3D objects/information in the drawing, it could have information and not be detectable without some deeper searching. Quote
SLW210 Posted October 7, 2024 Posted October 7, 2024 I noticed your profile shows you have Civil 3D 2025, maybe try ... How to convert Civil 3D drawings to standard AutoCAD format (autodesk.com) Though to do many drawings probably best to use a Script using EXPORTTOAUTOCAD, as you do not need the dash in front if using Civil 3D, but will using AutoCAD. It seems the OP has disappeared! Quote
BIGAL Posted October 7, 2024 Posted October 7, 2024 Elvis took him by the hand and they have left the building. Quote
SLW210 Posted October 22, 2024 Posted October 22, 2024 OP gone AWOL, but anyhow... Here are some LISPs for others to ponder, as mentioned, some AEC details are hidden, the only solution, from what I read anyway, is to ExporttoAutoCAD or similar function. I use the help file when I work with Architecture and Mechanical to AutoCAD... AutoCAD Architecture 2024 Help | To Export a Drawing to AutoCAD | Autodesk One could use the DGNtoDWG by folder LISP I and others have worked on to run -EXPORTTOAUTOCAD on a folder full of drawings. Drawing Batch Converters - AutoLISP, Visual LISP & DCL - AutoCAD Forums ;;; Aec objects export to AutoCAD ;;; ;;; https://www.cadtutor.net/forum/topic/91715-test-dwg-to-determine-if-it-contains-civil-3d-objects/ ;;; ;;; By SLW210 (Steve Wilson) ;;; ;;; (defun c:ExpAec2Acad () (vl-load-com) ;; Get the current drawing name and append .dwg (setq doc (vla-get-ActiveDocument (vlax-get-Acad-object))) (setq drawingName (vla-get-Name doc)) (setq exportFileName (strcat (vl-filename-directory drawingName) "\\" (vl-filename-base drawingName) "_exported.dwg")) ;; Execute the -EXPORTTOAUTOCAD command (command "-EXPORTTOAUTOCAD" "Y" exportFileName "N" "N" "Y" "Y") ;; Or something like this(command "-EXPORTTOAUTOCAD" "" ""), (command "-EXPORTTOAUTOCAD" "B" "yes" "t" "insert" "F" "2007" "") just check options available (princ (strcat "\nExport complete. Check " exportFileName)) ) (princ) ) (princ "\nType 'ExpAec2Acad' to run the export routine.") This should be the way to detect if any are present, might could be adjusted/modified to do better. I had no drawing to test if actually does detect, but runs, so take it for what it's worth. ;;; Detect Civil 3D objects ;;; ;;; https://www.cadtutor.net/forum/topic/91715-test-dwg-to-determine-if-it-contains-civil-3d-objects/ ;;; ;;; By SLW210 (Steve Wilson) ;;; ;;; (defun c:CheckCivil3D () (vl-load-com) ;; Function to check for Civil 3D objects (defun hasCivil3DObjects () (setq doc (vla-get-ActiveDocument (vlax-get-Acad-object))) (setq civil3dObjects nil) ;; Loop through all objects in the model space (setq modelSpace (vla-get-ModelSpace doc)) (setq objCount (vla-get-count modelSpace)) (setq i 0) (while (< i objCount) (setq obj (vla-item modelSpace i)) (if (and (= (vla-get-ObjectName obj) "Aecc*") ; Check for AECC objects (not (member obj civil3dObjects))) (setq civil3dObjects (cons obj civil3dObjects)) ) (setq i (1+ i)) ) ;; Return the list of Civil 3D objects found civil3dObjects ) ;; Function to convert Civil 3D objects to AutoCAD entities (defun convertCivil3DObjects (objects) (foreach obj objects (if (= (vla-get-ObjectName obj) "Aecc*") (progn ;; Sample conversion logic (setq polyline (vla-AddPolyline (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-object))) (vlax-safearray->list (vla-get-Coordinates obj)))) (vla-put-Color polyline acByLayer) ; Set color to ByLayer ) ) ) ) ;; Main execution block (setq civil3DObjects (hasCivil3DObjects)) (if civil3DObjects (progn (princ (strcat "\nFound " (itoa (length civil3DObjects)) " Civil 3D objects. Converting...")) (convertCivil3DObjects civil3DObjects) (princ "\nConversion complete.") ) (princ "\nNo Civil 3D objects found.") ) (princ) ) (princ "\nType 'CheckCivil3D' to run the check.") Quote
CyberAngel Posted October 22, 2024 Posted October 22, 2024 On 9/30/2024 at 6:39 PM, _civilpe said: I am writing a lisp routine to explode Civil 3D objects to then copy them to a CAD template. My lisp skips the "explode" command portion and heads straight into the copy objects to .dwt section without exploding the Civil 3D objects. How can I test my DWG to see if it contains Civil 3D objects before the lisp begins to copy objects to the .dwt file? I have questions. What is the point of copying exploded civil objects to a template? They're not much use if they don't have Civil 3D functionality. Some of them may be anonymous blocks, and they're not good for anything. Part of the reason for saving off these objects (I guess) is to carry their styles with them, but you'll lose all that information. How do you identify the leftover objects once you've exploded the parent object? Once you explode the objects, you don't have Civil 3D objects any more, so what's the point of checking for them? I feel like I'm reading this post backwards. Quote
BIGAL Posted October 22, 2024 Posted October 22, 2024 Trying to remember "importstyleandsettiings" command in CIV3D. Allows you to import all sorts of stuff from another dwg. Quote
SLW210 Posted October 23, 2024 Posted October 23, 2024 15 hours ago, CyberAngel said: I have questions. What is the point of copying exploded civil objects to a template? They're not much use if they don't have Civil 3D functionality. Some of them may be anonymous blocks, and they're not good for anything. Part of the reason for saving off these objects (I guess) is to carry their styles with them, but you'll lose all that information. How do you identify the leftover objects once you've exploded the parent object? Once you explode the objects, you don't have Civil 3D objects any more, so what's the point of checking for them? I feel like I'm reading this post backwards. I would surmise that being "explode" is in quotes it isn't literal. But we may never know as OP as wandered off to get a jelly donut with Elvis apparently. Quote
SLW210 Posted October 23, 2024 Posted October 23, 2024 Further to the issue, as mentioned about hidden AEC information. Originally done by Civil 3D or some other Civil software, our map I am in charge of keeping up to date with Aerials, new buildings, roads, utilities, etc. (worked on this a lot when I first got here, it was a mess) and previously having ran among other cleaning tools, EXPORTTOAUTOCAD or the equivalent it recently ballooned to 41 MB, I ran the above CheckCivil3D LISP on it and no AEC objects detected, but the -EXPORTTOAUTOCAD LISP reduced the file to 9.5 MB. Should be some method to detect these removed objects and what they are. I haven't come across anything yet, though I have only spent a little bit of my time looking. Quote
CyberAngel Posted October 23, 2024 Posted October 23, 2024 1 hour ago, SLW210 said: ...Originally done by Civil 3D or some other Civil software, our map I am in charge of keeping up to date with Aerials, new buildings, roads, utilities, etc. (worked on this a lot when I first got here, it was a mess) and previously having ran among other cleaning tools, EXPORTTOAUTOCAD or the equivalent it recently ballooned to 41 MB, I ran the above CheckCivil3D LISP on it and no AEC objects detected, but the -EXPORTTOAUTOCAD LISP reduced the file to 9.5 MB. Should be some method to detect these removed objects and what they are. I haven't come across anything yet, though I have only spent a little bit of my time looking. When you get large blocks of data like that in a Civil 3D drawing, it's usually a surface. Exporting the drawing reduces the surface to a batch of contours, and all the other information is lost. Quote
Steven P Posted October 23, 2024 Posted October 23, 2024 Which might not be a problem, if the drawing is going to a client who only has plain AutoCAD they don't want a bloated drawing with entities they can't see or edit, throwing up a warning everytime the drawing is opened. Quote
SLW210 Posted October 23, 2024 Posted October 23, 2024 4 hours ago, CyberAngel said: When you get large blocks of data like that in a Civil 3D drawing, it's usually a surface. Exporting the drawing reduces the surface to a batch of contours, and all the other information is lost. You seem to be misunderstanding the entire subject, the point is to completely remove all of the AEC components so that it's more useable in Plain AutoCAD. In other words, lose all of the information. That is why they have provided -EXPORTTOAUTOCAD and other commands to strip that information out. Quote
BIGAL Posted October 23, 2024 Posted October 23, 2024 We sent CIV3D dwg to others and as hinted by Steven P we would only exporttocad the surface so it became 3DFACES but surface still existed, this left the other person with a choice of how they looked at a surface. CIV3D or faces. Ok the extra steps say 41mb -> ?Mb PURGESTYLEANDSETTINGS does just that purges all the unused CIV3D stuff hidden in the dwg, releases all the blocks that can be used as part of a CIV3D object ie COGO points. A purge if done first will leave them all still there. Purge remove all the other junk. Purge again, normally need like twice. Last comment ZOMBIEKILLER.lsp by Gile but be careful as it removes from dwg. 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.