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

Copying Layout Tab & Xref New Titleblock

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
RocksterB
1465 Views, 14 Replies

Copying Layout Tab & Xref New Titleblock

I need a routine that will duplicate the current sheet's Layout tab and content to the next tab, set it current, delete the titleblock (by name) on the new tab and reference in a differently named titleblock, 1:1, 0,0 onto the new Layout tab. I'll be running this in a batch script. Is this too much for one routine?

14 REPLIES 14
Message 2 of 15
trevor.bird.au
in reply to: RocksterB

Hi Randy,

 

Please try the attached program; I hope I've understood what you are trying to achieve.

 

At the moment, for testing purposes, it creates a new layout with a name which is generated from the current time in the format of HHMMSS.

 

I've also used dummy title block names of "A1_TB_OLD" and "A1_TB_NEW".

Just change them to suit.

The program also checks if the new title block definition exists in the current drawing, if not, it then checks for the existence of a dwg file.

 

 

Regards,

Trevor

Message 3 of 15
trevor.bird.au
in reply to: RocksterB

Oops...sorry Randy, you wanted to Xref the new title block.

 

I'll update the program as soon as I can to do this.

It's being inserted as a block at the moment.

 

Trevor

Message 4 of 15
pbejse
in reply to: RocksterB


<<I need a routine that will duplicate the current sheet's Layout tab and content to the next tab>>


Next? as an existing tab? 

 

<<titleblock (by name) on the new tab and reference in a differently named titleblock, 1:1, 0,0 >>

 

New? as in create a new tab? and is that an attribute block? {EDIT} if its Xref it doesnt matter then.

 

<< Is this too much for one routine?>>

 

Not at all

 

Message 5 of 15
trevor.bird.au
in reply to: RocksterB

Hi Randy,

 

I've attached an updated version this program.

 

It will now attach the new title block as an xref.

A check is made to see if the new title block already exists in the drawing and whether it is already attached as an xref.

 

pbejse has identified some important functionality points, especially the point about whether the new title block is inserted or is attached as an xref.

If it is attached as an xref then it is assumed that the title block information is a separate attributed block which has to be inserted also.

 

I believe there is an issue with using the AttachExternalReference method in that it ignores the Object that the method is applied to i.e. ModelSpace Collection, PaperSpace Collection, Block.

It seems to always attach the xref to ModelSpace.

I've written a workaround that checks to see if the xref has been attached to the new layout and if not, use the CopyObjects to fix it!

I'm using AutoCAD 2009, I;m not sure if the issue exists in later versions.

If anyone can give me an update on this it would be very much appreciated.

 

Thanks.

 

 

Regards,

Trevor

Message 6 of 15
RocksterB
in reply to: pbejse


@pbejse wrote:

<<I need a routine that will duplicate the current sheet's Layout tab and content to the next tab>>


Next? as an existing tab? 

 

<<titleblock (by name) on the new tab and reference in a differently named titleblock, 1:1, 0,0 >>

 

New? as in create a new tab? and is that an attribute block? {EDIT} if its Xref it doesnt matter then.

 

<< Is this too much for one routine?>>

 

Not at all

 


Pbejse,

Yes, next to the exisiting, original Layout tab.

Yes, the newly created Layout tab. The titleblock is an Xref.

 

Trevor,

I will give your routine a spin and get back to you.

Message 7 of 15
RocksterB
in reply to: RocksterB

That's good stuff man! It even put the new Xref titleblock on the same layer as the one on the original Layout tab. Sweet! Is there any chance the new Layout tab could have the same name as the original Layout tab with the "_2" suffix, such as A1_TB_OLD_2?

Message 8 of 15
trevor.bird.au
in reply to: RocksterB

Hi Randy,

 

Thank you for the feedback.

 

I've attached an updated version for you.

 

The new copied layout is named based on the current layout name and suffixed with "_2".

The new layout tab is located next to the current layout tab even if there are multiple layout tabs in the drawing.

The new title block is inserted using the same insertion point of the old title block.

 

*whew*...have we missed anything lol 🙂

 

 

Thanks.

 

Regards,

Trevor

Message 9 of 15
RocksterB
in reply to: RocksterB

You're a real trooper for hanging in there with me to get this cooked up! Smiley Wink Sound like exactly what I needed. I'll have to try it out in the morning.

Message 10 of 15
trevor.bird.au
in reply to: RocksterB

No worries Randy, you're welcome.

 

It's fun and challenging getting ideas like this up and running.

Message 11 of 15
RocksterB
in reply to: trevor.bird.au

A denist must have this kind of fun too, with a drill in his hands.

Message 12 of 15
RocksterB
in reply to: RocksterB

...Dentist...
Message 13 of 15
RocksterB
in reply to: RocksterB

Thanks Trevor, the routine worked out great!

Message 14 of 15
trevor.bird.au
in reply to: RocksterB

That's good news, thanks for the update Randy.

If there's anything else you think I can help you with just let me know.

Message 15 of 15
sovby
in reply to: trevor.bird.au

Wow! I was looking for something like this too. The only difference is i would like the new tab at the end after it is copied. It could even be a new tab & then the xref added. I suppose i could do this manually but it would be really cool if i could have it done automatically. I have a seperate routine that i have been working on that copies the titleblock into the current directory (still need to test that one to make sure it works).  I would like it to delete the existing xref in that new tab only. I want the other tabs to remain untouched. I dont think i need the suffix part. I would like the new tab to have a brand new xrefed title sheet. It would be either an 8-1/2x11 sheet or an 11x17 sheet versus the 24x36 sheet that is referenced in the rest of the drawing.This looks like a petty intense routine. I was wonering if it was possible to add something like this to my other routine but this looks like it's already a huge routine. This could make it really complicated. It might be better to make this a seperate routine to keep it as simple as possible

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

Post to forums  

Autodesk Design & Make Report

”Boost