Jump to content

Recommended Posts

Posted

Hello everyone,

I'm very, very new to scripting in AutoCAD and was wondering if anyone has ever wrote a VB or LISP macro for batch exporting layouts to DWG's. I have a client who wants each layout in a seperate DWG and I have about 5500 layouts...so using exportlayout that many times would be really tedious and time consuming :cry:, which is why I'm coming to you folks for a little help!

 

I am currently running AutoCAD 2011 if it helps!

 

Thanks!

Posted

Manually you coluld use chspace then wblock to create a new dwg. Only difficult bit would be if you have multiple viewports.

 

I think I have seen this request before though searching can be time consuming but 5000 dwgs ! just keep trying key words.

Posted

I am moving your thread to the .NET, ObjectARX & VBA forum.

 

Like stated, a search might return something. You said 5500 layouts, but how many actual drawings are they in?

 

Hopefully you are charging enough to make this worth your time.

Posted
I am moving your thread to the .NET, ObjectARX & VBA forum.

 

Like stated, a search might return something. You said 5500 layouts, but how many actual drawings are they in?

 

Hopefully you are charging enough to make this worth your time.

 

 

Thanks for moving the thread. I have approximately 550 drawings with 10 layouts per drawing, it's worth my time, I'm just looking for a way to save some as that would make it worth even more. I've searched a lot and will continue searching; so far i have only found other threads that have really no replies, I'm sure I'll dig up something though.

Posted
this lisp it will help

 

That just created a new drawing model space and paper space.

Posted
That just created a new drawing model space and paper space.

 

Yes, not really what I was looking to do, but I'm continuing to search and will play around with that script to see if I can modify it somehow to delete everything in model space that is not in paper space.

 

Very neat script btw

Posted

Are you used my lisp or not

this lisp convert each layouts to separate drawing

Posted
Are you used my lisp or not

this lisp convert each layouts to separate drawing

 

I tested it and only got an exact copy of my drawing, model space and paper space.

Posted
I tested it and only got an exact copy of my drawing, model space and paper space.

 

 

I tested it as well and I got the same exact thing. This would work if it was able to delete everything in model space that was not visible in the paper space layout that it created.

Posted (edited)

I figured it out:

 

 

; LayoutsToDwgs
(defun C:ltd (/ lo loList)
 (setvar "FILEDIA" 0)
 (foreach lo (layoutlist)
   (progn
     (setvar "CTAB" lo)
     (command "exportlayout" "")
   )
 )
 (setvar "FILEDIA" 1)
)

 

 

 

 

Thanks for everyone's input!

Edited by SLW210
Posted

Do you know how to create a script to process the drawings

 

open dwg1 (load "layoutstodwgs")(ltd) close "N"

open dwg2 (load "layoutstodwgs")(ltd) close "N"

 

I would take the defun out just run it

 

also start cmd cd to directory dir *.dwg >dirlist /b creates a txt file of dwg names put in word etc and add open etc

Posted
Do you know how to create a script to process the drawings

 

open dwg1 (load "layoutstodwgs")(ltd) close "N"

open dwg2 (load "layoutstodwgs")(ltd) close "N"

 

I would take the defun out just run it

 

also start cmd cd to directory dir *.dwg >dirlist /b creates a txt file of dwg names put in word etc and add open etc

 

 

 

This may be a silly question; but what do you mean by "process the drawings"?

 

On a side note, I'm not sure how to do this but does anyone know if it would be possible to have the script open the drawing, delete the layer the view port was on and move the drawing in model space so that the lower left border is aligned with the origin?

 

I appreciate all the help!

  • 1 year later...
Posted

Well guys thx a lot

 

i found this thread very very usefull.

But can this last script be modified to:

 

1) export all the files open in cad???

2) instead of separate the file name and layout name with an "_" can this be changed to "."

 

thx regards

Posted

Wow, old thread!

 

Are you looking to have multiple drawings open with layouts in each drawing and a script that will export all the layouts simultaneously?

 

Why not just run the command in each drawing?

 

If you are, you should look into Script pro or something that can batch run the routine I wrote above.

 

Edit:

 

I just noticed you edited your post.

 

1) See my response above

2) Why not use a batch rename program outside AutoCAD to change the underscore to a dot? The extra dot may also cause conflicts with other programs, underscores are preferred IMHO.

Posted

Hello Ats1211

 

well i try to optimize and not using external coding so i discover for the name that i could

get the file name by:

 

(setq fielprefix (getvar 'dwgname))

 

but i still cant join it with layout name meanwhile i tryied this (without success):

 

(setq fielprefix (strcat ((getvar 'dwgname)) "." lo)

 

also triyed:

 

(setq fielprefix (strcat ((getvar 'dwgname)) "." CTAB)

 

Meanwhile i think there is a way to do this with all the open drawings but didnt figured it out.

 

Someone can help???

 

regards

 

 

 

Wow, old thread!

 

Are you looking to have multiple drawings open with layouts in each drawing and a script that will export all the layouts simultaneously?

 

Why not just run the command in each drawing?

 

If you are, you should look into Script pro or something that can batch run the routine I wrote above.

 

Edit:

 

I just noticed you edited your post.

 

1) See my response above

2) Why not use a batch rename program outside AutoCAD to change the underscore to a dot? The extra dot may also cause conflicts with other programs, underscores are preferred IMHO.

Posted

well i made it run by using :

 

; LayoutsToDwgs
(defun C:ltd (/ lo loList filename layname fielprefix)
 (setvar "FILEDIA" 0)
 (foreach lo (layoutlist)
   (progn
     (setvar "CTAB" lo)
(setq filename (cadr (fnsplitl (getvar "dwgname"))))
(setq layname (GETVAR "CTAB"))
(setq fielprefix (strcat filename "." layname))
     (command "exportlayout" fielprefix)
   )
 )
 (setvar "FILEDIA" 1)
)

 

still misses batch file.

meanwhile i am doing it file by file

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...