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

Paperspace Size

0 REPLIES 0
Reply
Message 1 of 1
GreenMan415
586 Views, 0 Replies

Paperspace Size

I am trying to get the ability to change the layout size of a given drawing two different ways.

1. If I already know the size of the layout and it is not 8.5 x 11 I want to set it to say 24 x 36.

2. If I do not know the size already I need to calculate it based on the zoom all of the model space or the title block size already in the paperspace.

Here is how I have at least pulled the paperspace size but I am not sure how to change it I have seen posts here and on Autodesk Forums that you can not use the Paperspace table is that correct? I have tried a few more things but at this time I am just spinning my wheels and basicly hacking code. I have looked through the ACAD.NET API docs but it is erroring out on me when I set the plotsettings for the psv.

{Code}

public static void pltSetup()
{
Document acDoc = acApp.DocumentManager.MdiActiveDocument;
Editor acEd = acDoc.Editor;
Database acDB = acDoc.Database;
using (Transaction acTran = acDB.TransactionManager.StartTransaction())
{
LayoutManager objLm = LayoutManager.Current;
ObjectId layID = objLm.GetLayoutId("Layout1");
Layout lay = acTran.GetObject(layID,OpenMode.ForRead) as Layout;

Extents2d lyMargins = lay.PlotPaperMargins;
//Point2d lyPaper = lay.PlotPaperSize;

PlotInfo pi = new PlotInfo();
pi.Layout = lay.ObjectId;


PlotSettings ps = new PlotSettings(lay.ModelType);
ps.CopyFrom(lay);

PlotSettingsValidator psv = PlotSettingsValidator.Current;
psv.SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents);
psv.SetPlotCentered(ps,true);
psv.SetPlotWindowArea(ps,lyMargins);

psv.SetPlotConfigurationName(ps, "None", "ARCH D(24.00 x 36.00)");


lay.UpgradeOpen();
lay.CopyFrom(ps);


acTran.Commit();
acTran.Dispose();
}

}


{/Code}
0 REPLIES 0

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