.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing Current Layout and Plot Page Setup Programatically

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
dynamicscope
3393 Views, 3 Replies

Changing Current Layout and Plot Page Setup Programatically

Hi,

 

After I failed to implement auto-batch-plotting(printing), I decided to do it semi-automatically.

I am going to open each drawing and change the current layout to paperspace1 and set the plot page settings, and then close and save the document.

So now, my problem is chainging current layout of the opened document and manipulating plot page settings.

 

Even a little hint or sample code snippet would be very appreciated. 😃

 

FYI, I am currently using Object ARX 2007 with C#.

 

Best regards,

 

Jake

3 REPLIES 3
Message 2 of 4
fieldguy
in reply to: dynamicscope

There is plenty of code here for changing layouts.  Try keyword search "layoutname".

 

There is some vb code here http://forums.autodesk.com/t5/NET/Layouts-and-Viewports/td-p/3128748 

Message 3 of 4
dynamicscope
in reply to: fieldguy

Awesome~!!

 

Document doc = Application.DocumentManager.Add("acad");
DocumentLock docLock = doc.LockDocument();
Database db = doc.Database;

using (Transaction tr = db.TransactionManager.StartTransaction())
{
	LayoutManager lm = LayoutManager.Current;
	Layout layoutObj;
	DBDictionary layoutDict;

	using (layoutDict = tr.GetObject(db.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary)
	{
		foreach (System.Collections.DictionaryEntry de in layoutDict)
		{
			using (layoutObj = tr.GetObject((ObjectId)(de.Value), OpenMode.ForRead) as Layout)
			{
				lm.CurrentLayout = layoutObj.LayoutName;
			}
		}
	}

	tr.Commit();
}

 

One down!!

 

Now, I need to figure out how to change the page setup programmatically, so I can batch print multiple drawings at once!!!

 

Message 4 of 4
fieldguy
in reply to: dynamicscope

Glad you found it.  IMO Kean Walmsley has the best examples for plotting - this is 1 of them

http://through-the-interface.typepad.com/through_the_interface/2007/10/previewing-an-1.html

 

Search plotting at that site for others - they are c# for the most part.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost