i've searche but didn't find answer...
i have one big pipeline drawing and need to "split" it into smaller drawings...
there are layers, v500, v250, v100 that represent size of pipeline.
i'd like to extract all elements from layer v500 to drawing v500.dwg, after that v250... etc.
problem is that i would select only elements from v500, erase all other and than save it as v500.dwg... and then what? undo all and repeat everything with another layer?
is there a way to copy elements to another drawing and save and then return to original drawing and execute another set of commands?
Solved! Go to Solution.
Solved! by M_Hensley. See the answer in context.
Why not just use the WBLOCK command to send objects out to their own drawing while leaving you in the current drawing?
I'm not sure about your work flow, but there are several ways to copy entities from one dwg to another, Ctrl+C/Ctrl+V, wblock/insert, export using some intermediate format, etc . As for the layers issue and selection, you can use qselect to filter the entities, or make some layer filter in the layer manager and activate it before selection, or use the filter command to make a selection set, also a lisp using ssget with a filter, etc.
is there a way to copy elements to another drawing and save and then return to original drawing and execute another set of commands?...
(defun wblayer (lst path / aDoc) (vl-load-com) (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (foreach lyr lst (if (ssget "_x" (list (cons 8 lyr))) (progn (vla-wblock aDoc (strcat path lyr ".dwg") (setq objts (vla-get-ActiveSelectionSet aDoc)) ) (vla-delete objts) ) ) ) (princ) )
(wblayer '("v500" "v250" "v100") "C:\\Users\\path\\sample\\")
Select, ERASE, SAVEAS and UNDO and repeat? What are you using, AutoCAD version1? Forgive my surprise at your post, no offense meant or directed at you.
If the objects are on seaprate layers, why do you need to erase the other objects on all the other layers first? Do you not know you can make active the one layer and freeze all the others?
In addition to the comments about using WBLOCK command noted above.
While the code provided above is great and a quick method, you appear to be missing some key built-in AutoCAD features IMHO and might benefit from a good basic overview tutorial/lesson or a **** good book.
No, I was not questioning why you posted, I was asking why you did not try the correct built-in feautres of AutOCAD that require no lisp to do what you want.
You posted this, which is very much the wrong way to do what you want:
"problem is that i would select only elements from v500, erase all other and than save it as v500.dwg... and then what? undo all and repeat everything with another layer?"
And then you asked:
"is there a way to copy elements to another drawing and save and then return to original drawing and execute another set of commands?"
Access a broad range of knowledge to help get the most out of your products and services.