I've got the first 1/2 done which is the easy part. I don't know if the rest of this routine is possible. What I need help with is:
1) open the temp dwg file that was just created (wblocked out).
2) have the lisp routine redefine all block names and change all layer names/colors, H will now be (E)H. (the layer list is going to be massive, I know)
3) then bring that wblock back into the drawing with all the layers renamed and new color.
If anyone can supply me with any part of code that would help, I would appreciate it. As it is now, we explode EVERYTHING and change the layer names and colors manually. It takes forever and it not a clean way of doing cad. Obviously I want to avoid exploding nice looking blocks. Below is what I have so far, it's not much but it's a start.
Here is the thought process behind all this...
Everything gets turned on
User selects all objects in model space they want to change to existing (will be everything minus the background in MS)
All items selected are set to bylayer
All items selected are blocked out to a temp cad file
The new cad file is opened from lisp and runs thru all the layers and renames them to put an (E) in front or it and all colors are changed too (blocks are redefined too so they don't conflict with new blocks inserted later)
The new temp cad file is then re-inserted into the original drawing.
Code:
(defun c:EXISTING ( / oldlay )
(setq oldlay (getvar "clayer"))
(setq filed(getvar "FILEDIA"))
(COMMAND "-LAYER" "ON" "*" "" "")
(COMMAND "-LAYER" "THAW" "*" "" "")
(COMMAND "SETBYLAYERMODE" "5")
(setq
i 0
ss (ssget
)
)
(progn
(while (< i (sslength ss))
(setq X (ssname ss i))
(COMMAND "SETBYLAYER" X "" "YES" "YES")
(setq i (+ 1 i))
)
)
(command "FILEDIA" "0")
(COMMAND "-WBLOCK" "H:/CAD/TEMP.DWG" "Y" "" "0,0" ss "")
(setvar "clayer" oldlay)
(setvar "FILEDIA" filed)
(princ)
)