Explode AEC objects and LT prep

Explode AEC objects and LT prep

Derrick_devtec
Participant Participant
378 Views
4 Replies
Message 1 of 5

Explode AEC objects and LT prep

Derrick_devtec
Participant
Participant

working on quick little prep for LT routine that explodes all aec objects and sets a couple color and layer items.

If I run each item one by one it works, but it will not run all together.

Please help. And I know.. simply buying autocad architecture would make my life so great. We are leaving the ACA world and going to LT. It is what it is.

Thank you in advance for your assistance.

0 Likes
Accepted solutions (1)
379 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant

Here is the rewritten AEC-explode

 

(defun AEC-explode ( / s)
  (and (setq s (ssget "X" '((0 . "lw*"))))
       (initcommandversion)
       (command "_.explode" s "")))

 

BUT. Not sure how AEC objects, but in the case of C3D objects, the order matters. Some kinds of objects (possibly "outer") must be exploded before others (say "inner"). Edit: Maybe reversing the selection set could help if that is an issue.

Good luck. 

 

0 Likes
Message 3 of 5

pendean
Community Legend
Community Legend

>>....We are leaving the ACA world and going to LT...<<<
Why not just use DWGCONVERT / AECTOACAD command for the conversion from inside LT2023-2024 (and any ACA version from the last 10-ish years)? that's why it exists, works great to AEC content translation to core autocad objects that LT can edit all day long.

0 Likes
Message 4 of 5

Derrick_devtec
Participant
Participant
Accepted solution

DWGCONVERT does not do what I need at all?

AECTOACAD or EXPORTTOAUTOCAD does part of what need. I ended up using it and some script file trickery to get it done.

0 Likes
Message 5 of 5

Derrick_devtec
Participant
Participant

Here is what I ended up doing. It's wacky, but works well for our systems. You real programs will most likely cringe. 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;LTdwg.lsp
;;;;Create simple cad drawing from original AEC drawing.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:LTdwg ( / OGdwgname OGdwgnamebak scripfilename)
(setvar 'cmdecho 0)
(setq OGdwgname (strcat (getvar 'dwgprefix)(getvar 'dwgname)))
(setq OGdwgnamebak (strcat (getvar 'dwgprefix)(vl-filename-base (getvar 'dwgname)) "-AECBAK.dwg"))
(setq scripfilename (strcat (getvar 'dwgprefix) "LTIT.scr"))

;;;check for aecbak file, deletes if found
(if OGdwgnamebak (vl-file-delete OGdwgnamebak))
;;;create new -AECBAK file
(princ "\nNow creating -AECBAK file...")
(command ".saveas" "" OGdwgnamebak)
;;;check for orginal file, if exists deletes
(if OGdwgname (vl-file-delete OGdwgname))
;;;create new Dummy cad file with original name
(command "-ExportToAutocad" "B" "yes" "t" "insert" "F" "2007" "" OGdwgname)
;;;check for script, delete if found
(if scripfilename (vl-file-delete scripfilename))
;;;write and run script file
(setq scrFile (open scripfilename "w"))
(write-line ".Open" scrFile)
(write-line OGdwgname scrFile)
(write-line "setbylayer all y n" scrFile)
(write-line "-layer c 6 A-WALL " scrfile)
(write-line "-layer c 3 A-GLAZ " scrfile)
(write-line "-layer c 3 A-DOOR " scrfile)
(write-line "-purge all * n" scrFile)
(write-line ".Qsave" scrFile)
(write-line (strcat "(alert \"Drawing now converted to AutoCAD LT simple file with no AEC objects. A back up file of the original AEC file has been created.\" )" ) scrFile)
(write-line (strcat "(c:LTdwg-closeAECBAK)" ) scrFile)
(close scrFile)
(command ".script" scripfilename)
(setvar 'cmdecho 1)
(princ "\nNow starting dumb-down process...")
(princ)
);;end defun


;;;;function used to delete -AECBAK drawing tab after all is done
(defun c:LTdwg-closeAECBAK (/ dwg)
(vl-load-com)
(or (vl-catch-all-error-p (setq dwg (vl-catch-all-apply 'vla-item (list (vla-get-documents (vlax-get-acad-object)) (strcat (vl-filename-base (getvar 'dwgname)) "-AECBAK.dwg")))))
(equal (vla-get-activedocument (vlax-get-acad-object)) dwg)
(vlax-invoke dwg 'close :vlax-false)
)
(princ)
);;end defun

0 Likes