Author Topic: Separate layouts to individual dwg files.  (Read 26989 times)

0 Members and 1 Guest are viewing this topic.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Separate layouts to individual dwg files.
« Reply #15 on: November 01, 2007, 01:01:50 PM »
You guys are just mean. 
Why don't you just explode the Mtext to Dtext while you are at it? Or just explode the Leaders?
Not that I would do a thing like that.  :roll: :roll:
« Last Edit: November 01, 2007, 01:03:07 PM by Krushert »
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

alisafei

  • Guest
Re: Separate layouts to individual dwg files.
« Reply #16 on: January 28, 2009, 06:30:40 PM »
not working for me.
there are nothing changes with original one, just made many layouts separate drawings.
but all the drawings are same, nothing changed at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Separate layouts to individual dwg files.
« Reply #17 on: January 28, 2009, 07:09:44 PM »
not working for me.
there are nothing changes with original one, just made many layouts separate drawings.
but all the drawings are same, nothing changed at all.

That is the purpose of the code.  To create separate drawings for each layout.  Do nothing to the original drawing.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Separate layouts to individual dwg files.
« Reply #18 on: January 28, 2009, 08:38:41 PM »
In regards to why you might want to do this I'll offer up an example.
Here our client uses a document management system that HAS to store each drg created as a seperate document so we generally just create seperate drgs as required. It has litereally hundreds of thousands of doc's stored that we need to search on a regular basis, usually by drg number or title.
This tool may be worth a look for us too, thanks.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

alisafei

  • Guest
Re: Separate layouts to individual dwg files.
« Reply #19 on: January 29, 2009, 07:31:57 AM »
not working for me.
there are nothing changes with original one, just made many layouts separate drawings.
but all the drawings are same, nothing changed at all.

That is the purpose of the code.  To create separate drawings for each layout.  Do nothing to the original drawing.

yes, i know its purpose.
i think it need this type of code because the original file is big one and contains a lot of layouts, so it is time resuming.
i thought the code will make as many drawing as layouts, and the drawing only contains part of drawing (which is shown in layout itself) and put it modelspace.

i am not sure i explained it clear. so let me write a example..
i have an alignment with 10km in  model space with contour drawing, which contains 20 layouts, each one is 500m of alignment.
after using the code, the layout1 drawing only contains 0-500m alignment portion of drawing (not the whole 10km contour drawing), if i do so, i think the layout is useless now, do just those drawing in model space, no more layout needed, and the file size is reduced greately.

bcz, when i use the existing code, the original file size is 2mb, it contains 5 layouts. after saving the 5 layouts separately, each layout file size it still about 1.8mb and it is 1.8*5 = 9mb ..so it will be a problem if your file size is very big.

anyway, thanks for your code.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Separate layouts to individual dwg files.
« Reply #20 on: January 29, 2009, 11:05:26 AM »
One way to make the code help make smaller files, is to have the original file be an xref ( if not already ) of the new sheet files.  That way the new sheet files only have the minimum within them.  This wouldn't be hard to do, I don't think.

To do what you want is kind of hard, not impossible, but hard.  You would have to get the viewport of each layout, and translate that into modelspace.  Then erase all that is outside of it, and then trim all that crosses it, all without user interaction.  There are codes that do those things here, but not all in one code.  You might have to do it yourself, and then others can/will help when you need it; unless someone wants to take on the challenge.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alisafei

  • Guest
Re: Separate layouts to individual dwg files.
« Reply #21 on: January 29, 2009, 12:17:28 PM »
One way to make the code help make smaller files, is to have the original file be an xref ( if not already ) of the new sheet files.  That way the new sheet files only have the minimum within them.  This wouldn't be hard to do, I don't think.

To do what you want is kind of hard, not impossible, but hard.  You would have to get the viewport of each layout, and translate that into modelspace.  Then erase all that is outside of it, and then trim all that crosses it, all without user interaction.  There are codes that do those things here, but not all in one code.  You might have to do it yourself, and then others can/will help when you need it; unless someone wants to take on the challenge.
yes, i agree with your view.make the original one X-ref then save as layouts, this way the drawing will be smaller size.

the things which i wanted is a little bit diffucult, if it is time taking, just leave it ..
i think it is good for people working with big file always, like me, highway drawings a quite big and sometime diffucult to handle everything in one drawing.
thanks.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Separate layouts to individual dwg files.
« Reply #22 on: January 29, 2009, 12:28:15 PM »
I did one that would copy the xclip.  Maybe it could be changed to set the xclip boundary per the viewport of each new sheet.  I don't know if that will save for occupy space though.  The xref idea might not be too hard to code, and I think it would be a better way to go, that way all the information can still related to each other in a logical way.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Separate layouts to individual dwg files.
« Reply #23 on: May 08, 2013, 12:36:41 AM »
Here is my entry.  With some slight modifications it could be used with ObjectDBX.
Code: [Select]
(defun c:Tabs->Drawings (/ ActDoc MsObjList PsObjList dbxApp oVer FirstPass)

(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vlax-for obj (vla-get-ModelSpace ActDoc)
(setq MsObjList (cons obj MsObjList))
)
(vlax-for lo (vla-get-Layouts ActDoc)
(if (/= (vla-get-Name lo) "Model")
(progn
(setq FirstPass T)
(vlax-for obj (vla-get-Block lo)
(if (not FirstPass)
(setq PsObjList (cons obj PsObjList))
(setq FirstPass nil)
)
)
(setq dbxApp
(if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
(vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
(vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
)
)
(vlax-invoke ActDoc 'CopyObjects MsObjList (vla-get-ModelSpace dbxApp))
(vlax-invoke ActDoc 'CopyObjects PsObjList (vla-get-PaperSpace dbxApp))
(vla-SaveAs dbxApp (strcat (vla-get-Path ActDoc) "\\" (vla-get-Name lo)))
(vlax-release-object dbxApp)
(setq dbxApp nil)
(setq PsObjList nil)
)
)
)
(princ)
)

Thanks for this..

however, i noticed that the LTSCALE settings were changed when exported.
« Last Edit: May 08, 2013, 12:51:59 AM by NOD684 »
"memories fade but the scars still linger"

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Separate layouts to individual dwg files.
« Reply #24 on: May 08, 2013, 06:51:12 PM »
You're welcome.

If the LTSCALE is a big then, then I can look into when I get some time, but I do not work in AutoCAD  that much anymore, so I'm not sure when I would have time to look into this.  Let me know though, or maybe someone else knows of a quick fix for it, because off the top of my head I don't know of one.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

miquan

  • Guest
Re: Separate layouts to individual dwg files.
« Reply #25 on: October 28, 2013, 01:34:30 AM »
Dear ronjonp,

I try to using your lisp.
But I get this error" ; error: no function definition: VLAX-GET-ACAD-OBJECT"

Please help me solve this matter.
Thanks,
Miquan

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Separate layouts to individual dwg files.
« Reply #26 on: October 28, 2013, 07:21:53 AM »
See the relevant entry in my Error Message Troubleshooter.

miquan

  • Guest
Re: Separate layouts to individual dwg files.
« Reply #27 on: October 28, 2013, 09:42:04 AM »
Thanks Lee so much for your quick reply.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Separate layouts to individual dwg files.
« Reply #28 on: October 28, 2013, 10:10:27 AM »
See the relevant entry in my Error Message Troubleshooter.

That list IS AWESOME!!!

Thanks LEE.  :lol: :lol: :lol:

Have to remember that the next time I have something to code.

Did that get linked to Problems and Solutions Links (don't reinvent the wheel ...) Thread? 
If not Could it? 
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Separate layouts to individual dwg files.
« Reply #29 on: October 28, 2013, 10:42:41 AM »
Thanks Lee so much for your quick reply.

You're most welcome miquan -
I figured the link would be more helpful in the long term than simply providing the straight answer  :-)

See the relevant entry in my Error Message Troubleshooter.

That list IS AWESOME!!!

Thanks LEE.  :lol: :lol: :lol:

Have to remember that the next time I have something to code.

Thank you Krushert! - I'm glad you like it  8-)

Quite a lot of information can be gleaned from those short error messages returned by the interpreter, so the troubleshooter helps to point you in the right direction.

Did that get linked to Problems and Solutions Links (don't reinvent the wheel ...) Thread? 
If not Could it?

I don't think it is, but I'm sure CAB could add it to his list, or I could post a link separately in that thread.
(not sure how best to keep the thread organised?)