Author Topic: Add layout from existing template  (Read 5826 times)

0 Members and 1 Guest are viewing this topic.

ArgV

  • Guest
Add layout from existing template
« on: September 06, 2009, 12:35:22 PM »
Hey all.

I just want to add a layout to the layouts collection in my program that will be from a specific .DWT file that resides in the normal autocad path.

In other words, press a button, and *POOF!* a new layout appears from a specific template.

thanks!

-ArgV

P.s. I don't need the code, just the method that would be used, and any relevant information such as how to specify the .DWT file, since the vla-add for the documents collection doesn't seem to allow an argument specifying a file name.


New Shooz

  • Guest
Re: Add layout from existing template
« Reply #1 on: September 06, 2009, 04:21:25 PM »
I opened up the template file, and simply dragged each layout over to a tool palette. This negates the need for any programming whatsoever - easy as chips. It also makes it (the tool palette, that is) easily shareable across a network.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Add layout from existing template
« Reply #2 on: September 06, 2009, 09:20:11 PM »
I opened up the template file, and simply dragged each layout over to a tool palette. This negates the need for any programming whatsoever - easy as chips. It also makes it (the tool palette, that is) easily shareable across a network.
you can drag the layout tab into tool palettes !?!?!?!?!??!?!?!?!!
why didn't i ever think of this, what a brilliant idea!
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Add layout from existing template
« Reply #3 on: September 07, 2009, 12:38:33 AM »
Use ObjectDBX to get the layout from the DWT file.
Hint >>--->  http://www.theswamp.org/index.php?topic=29933.msg354958#msg354958
 
Insert it into the working DWG
Hint >>--->   http://www.theswamp.org/index.php?topic=29111.0


Oops that was not the one I was thinking of. After midnight, I'm done. :-(
« Last Edit: September 07, 2009, 12:43:13 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ArgV

  • Guest
Re: Add layout from existing template
« Reply #4 on: September 07, 2009, 10:50:47 AM »
Use ObjectDBX to get the layout from the DWT file.
Hint >>--->  http://www.theswamp.org/index.php?topic=29933.msg354958#msg354958
 
Insert it into the working DWG
Hint >>--->   http://www.theswamp.org/index.php?topic=29111.0


Oops that was not the one I was thinking of. After midnight, I'm done. :-(

Somehow I knew that was going to come up as a solution.. ;) (ObjectDBX) I know very little about this method, but have used it a few times from other routines. If it's not a bother, can I ask how objectDBX works? I know it opens autocad (or other) documents, but from what I've seen, I think it usually opens them "in the background" and not fully open or "visible". Can it do that (open as visible), or how is it set up? I have some things coming up that I think objectDBX would be useful for. Can I iterate through each open drawing that is opened by objectDBX like you would through the documents collection?

If so, that would be great! :)

thanks,

-ArgV

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Add layout from existing template
« Reply #5 on: September 07, 2009, 10:55:24 AM »
I opened up the template file, and simply dragged each layout over to a tool palette. This negates the need for any programming whatsoever - easy as chips. It also makes it (the tool palette, that is) easily shareable across a network.
you can drag the layout tab into tool palettes !?!?!?!?!??!?!?!?!!
why didn't i ever think of this, what a brilliant idea!
i tried this, it didn't work.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Add layout from existing template
« Reply #6 on: September 07, 2009, 12:20:02 PM »
Tim's routine in the link will do the DBX access & you have a general idea of how it works.              
The DWG is not opened for viewing but the DBX can modify or copy from the file.                          
You can not use COMMANDS.                                                                                
                                                                                                        
So feed Tim's routine the file name in a list and the lisp code you want to preform                      
and it will return the data object you need. See his example:                                            
Code: [Select]
(MapDbxDocs '(lambda (doc) (print (vla-get-Count (vla-get-Blocks doc)))) (list (getfiled "" "" "dwg" 4)))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Add layout from existing template
« Reply #7 on: September 07, 2009, 03:43:45 PM »

ArgV

  • Guest
Re: Add layout from existing template
« Reply #8 on: September 07, 2009, 04:22:23 PM »
ArgV, have a look
http://www.theswamp.org/index.php?topic=22932.0

I took a look. It looks like the solution is pretty simple .. (vl-cmdf "._-LAYOUT" "_TEMPLATE" DwgName LayoutName), except that it doesn't seem to copy over things like dimstyles, textstyles, etc etc..

I'm not quite sure what the other code does that is in that thread, but it *looks* like it basically does just that. I'm tired of screwing with it though, I'm going to just watch movies and do nothing for the rest of the day. :)

thanks!

-ArgV

New Shooz

  • Guest
Re: Add layout from existing template
« Reply #9 on: September 07, 2009, 06:42:24 PM »
I opened up the template file, and simply dragged each layout over to a tool palette. This negates the need for any programming whatsoever - easy as chips. It also makes it (the tool palette, that is) easily shareable across a network.
you can drag the layout tab into tool palettes !?!?!?!?!??!?!?!?!!
why didn't i ever think of this, what a brilliant idea!
i tried this, it didn't work.

Ahar, I've just gone and checked what I did. I made a recording with the Action Recorder for each layout tab, then made a short macro and put that on the toolpallete.

Please forgive my previous mis-information.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Add layout from existing template
« Reply #10 on: September 07, 2009, 08:54:30 PM »
I opened up the template file, and simply dragged each layout over to a tool palette. This negates the need for any programming whatsoever - easy as chips. It also makes it (the tool palette, that is) easily shareable across a network.
you can drag the layout tab into tool palettes !?!?!?!?!??!?!?!?!!
why didn't i ever think of this, what a brilliant idea!
i tried this, it didn't work.

Ahar, I've just gone and checked what I did. I made a recording with the Action Recorder for each layout tab, then made a short macro and put that on the toolpallete.

Please forgive my previous mis-information.

no sweat. i was a little too over-excited though, lol.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Add layout from existing template
« Reply #11 on: September 08, 2009, 09:15:24 AM »
I'm sure you know that method works with the Design Center.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

New Shooz

  • Guest
Re: Add layout from existing template
« Reply #12 on: September 08, 2009, 03:46:17 PM »
I'm sure you know that method works with the Design Center.

Very true indeed; however you can't really beat a one-stop click for the novice CAD users (of which we have plenty) and it's done. We have a lot of stuff on our palettes; I figure the more I can get on there, the more people will use it. If I said to someone to use the Design Center they would look at me in a weird way (i'm used to that, but can't be doing with it every day of the week)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Add layout from existing template
« Reply #13 on: September 08, 2009, 04:07:22 PM »
Quote
In other words, press a button, and *POOF!* a new layout appears from a specific template.

So this is the requirement?  :-)

What if the donor file has more than one layout?
Do you retain the layout NAME?

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Add layout from existing template
« Reply #14 on: September 08, 2009, 04:18:21 PM »
Quote
In other words, press a button, and *POOF!* a new layout appears from a specific template.


[queen]

it's a kind of magic ....

[/queen]
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.