Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - AlexF

Pages: [1]
Layouts and printing / Re: Create a Layout and Set PlotConfiguration
« on: December 10, 2010, 12:27:01 PM »
Here's my code:

Code: [Select]
//assumes we already created a layout with the ObjectId ltid
ObjectId ltid = lman.CreateLayout(layoutname);
Layout lt = (Layout)tr.GetObject(ltid, OpenMode.ForWrite);
//change to the one we need.
LayoutManager lytmgr = LayoutManager.Current;
lytmgr.CurrentLayout = layoutname;
//begin configuring plot settings
PlotInfo plotinf = new PlotInfo();
plotinf.Layout = lt.ObjectId;
PlotSettings plotset = new PlotSettings(lt.ModelType);
PlotSettingsValidator plotsetvdr = PlotSettingsValidator.Current;
PlotInfoValidator plotvdr = new PlotInfoValidator();
Plotterused = "MyPrinter.pc3"; //for test purposes only
Papersize = "A3"; //for test purposes only
plotsetvdr.SetPlotConfigurationName(plotset, Plotterused, Papersize);
plotsetvdr.SetPlotType(plotset, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents);
plotsetvdr.SetUseStandardScale(plotset, true);
plotsetvdr.SetPlotRotation(plotset, PlotRotation.Degrees090);
plotsetvdr.SetPlotPaperUnits(plotset, PlotPaperUnit.Millimeters);
//if we centre the plot here,  even without then changing the origin, the resultant layout still isn't centred correctly.
plotsetvdr.SetPlotCentered(plotset, true);
//commented these lines out for now as they have no overall effect on the centring of the subsequent layout.
//Point2d offset = new Point2d(0, 0);
//plotsetvdr.SetPlotOrigin(plotset, offset);
//override the current settings?
plotinf.OverrideSettings = plotset;
//validate the new settings
//sets the layout plot settings
lt.TabOrder = 1;

I think my issue lies in the ordering of operations, unless I've overlooked a setting?

Layouts and printing / Re: Create a Layout and Set PlotConfiguration
« on: December 09, 2010, 03:33:06 PM »

I've borrowed heavily from this (and other sources) to create my own implementation, and, even though I can successfully create a layout, and set plot settings, I can't figure out why after my routine has finished the layout is offset from the drawing border I insert.

If I subsequently go into the plot settings dialogue, and select "center* plot" and click apply to layout, the layout then centres itself correctly.

Any ideas?

*stupid US Spelling!

Pages: [1]