Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

export parts of drawing to another dwg....

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
vladimir.ninic
9174 Views, 9 Replies

export parts of drawing to another dwg....

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?

 

thnx!

9 REPLIES 9
Message 2 of 10
hgasty1001
in reply to: vladimir.ninic

Hi,

 

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.

 

Gaston Nunez

Message 3 of 10
pbejse
in reply to: vladimir.ninic


vladimir.ninic wrote:..

 ...

is there a way to copy elements to another drawing and save and then return to original drawing and execute another set of commands?...

 

thnx!


(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)
  )

 

USAGE

(wblayer '("v500" "v250" "v100") "C:\\Users\\path\\sample\\")

 

HTH

 

Message 4 of 10
mattok
in reply to: vladimir.ninic

I'd probably just use the FILTER command and copy / paste to original coordinates into a new drawing

Message 5 of 10
M_Hensley
in reply to: vladimir.ninic

Why not just use the WBLOCK command to send objects out to their own drawing while leaving you in the current drawing?

Message 6 of 10
pendean
in reply to: vladimir.ninic

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.

Message 7 of 10
vladimir.ninic
in reply to: pendean

sorry for asking for advice. noone said that i know that much lisp... thnx for advice...

Message 8 of 10
pendean
in reply to: vladimir.ninic

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?"

 

You don't need lisp to do things already avaiable in AutoCAD, Lisp is to speed the process up. LAYISO and WBLOCK in your file would have been all you needed to do inside AutoCAD, without lisp.

Message 9 of 10
vladimir.ninic
in reply to: pendean

ok. let's stop. i've asked for advice, so i can understand concept so i can write my lisp file... next time i'll explain better...

 

thnx!

Message 10 of 10
pbejse
in reply to: M_Hensley

For what its worth,I did use  Wblock 😉

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost