Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting individual layer to dwg file 1

Status
Not open for further replies.

jimad

Mechanical
Nov 13, 2002
5
SG
Hi does anyone know how to convert all layers
into a individual drawing files automatically ??


Thanks :)
 
Replies continue below

Recommended for you

I'm not sure I follow your question.
But...
If you have the express tools in ACAD2000, you can type "LMAN" for the layer manager. This should allow you to export the layers into a "LAY" file, not "DWG".

And if that suits your needs, you may want to write a script to do multiple files.

hope that helps.
R
 
Thanks for your good explanaion to my question.

Frankly, I am trying to learn AutoCad 2D & 3D from now on.

Could you please recommend me how I can learn AutoCad effectively?

I am really interested in piping design for refinery plant using PDS but I am just wondering if this PDS shold be operated based on Microstation not AutoCad 3D or AutoCad Solid Works.

Thanks
 
FILE: EXPORT allows you to choose, by way of selection, any objects you want to make a seperate file.
 
What I ment is how to wblock out each individual layer as I have many layers. How to write a script file to do that ?
 
I apologize, but I find it a little hard to follow your question. If you are looking to create a file with the current layers you are using into another file, you can save your drawing as a dwt (template) and use it to begin a new drawing and have your layers already setup. If you want to export a list of the layers you have into a text file, you can use the following LISP routine.

(defun WRITELYRS ()
(setq TXTFILE (open "C:\\LAYERS.txt" "W")
TDATA NIL
CNT 0
)
(while (setq TDATA (tblnext "LAYER" (not TDATA)))
(setq CNT (1+ CNT))
(write-line (cdr (assoc 2 TDATA)) TXTFILE)
)

(close TXTFILE)
)
 

I am using Acad 2002LT
If I have layer :
0
AA
BB
CC

After running the Scrip file ,
I should get
AA.dwg
BB.dwg
CC.dwg


 
Dear Jimad,
Loading the following autolisp code, will add a command SBL to your drawing session. The SBL command does your mentioned job.
All DWGs will save in the root of drive C: .
If some drawings with the same name there exist in the root of drive c:, the program will not work properly. So before running the SBL command, be sure there is no DWG with the name similar to layer names in c:\ .

(defun c:SBL(/ llist lname)
(setvar "cmdecho" 0)
(setq llist (tblnext "layer" t))
(while (not (null llist))
(setq lname (cdr (assoc 2 llist)))
(setq lss (ssget "x" (list (cons 8 lname))))
(command "wblock" (strcat "c:\\" lname) "" '(0 0) lss "")
(command "oops")
(setq llist (tblnext "layer"))
)
(prompt "\n All objects extracted by layer.\n")
(princ)
)

:)
Farzad
 
Do you want something like this, but in a cycling macro for each layer.

(command "_.saveas" "2000" (getvar "clayer"))
 
hi,
The SBL code above is just what I required, but I would be much better if I could specifiy where the dwg's are saved, such as a dialog box where I can then select the required path.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top