PlotSettingsValidator.SetPlotPaperUnits

PlotSettingsValidator.SetPlotPaperUnits

mordend
Enthusiast Enthusiast
665 Views
1 Reply
Message 1 of 2

PlotSettingsValidator.SetPlotPaperUnits

mordend
Enthusiast
Enthusiast

I am having issues with the PlotSettingsValidator

 

my end goal is really to just change the SetCurrentStyleSheet but when I do this it seems to change the PaperUnits to inches and not converting the listed scale, messing with the resulting plot.

 

I cannot seem to change the SetPlotPaperUnits either, the changes dont take effect in the dwg.

 

 using (Transaction tr = db.TransactionManager.StartTransaction())
                        {
                            Layout openLay = (Layout)tr.GetObject(lay.ObjectId, OpenMode.ForWrite);

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

                            PlotSettingsValidator psv = PlotSettingsValidator.Current;
                            psv.RefreshLists(openLay);
                            psv.SetPlotPaperUnits(ps, PlotPaperUnit.Millimeters);                            

                            psv.SetCurrentStyleSheet(ps, "Color.ctb");

                            tr.Commit();
                        }

Anybody have any ideas?

 

0 Likes
Accepted solutions (1)
666 Views
1 Reply
Reply (1)
Message 2 of 2

mordend
Enthusiast
Enthusiast
Accepted solution

Never ceases to fail, as soon as I post I figure it out.

 

Take the original layout and copy the plotsettings back in.

 

using (Transaction tr = db.TransactionManager.StartTransaction())
                        {
                            Layout openLay = (Layout)tr.GetObject(lay.ObjectId, OpenMode.ForWrite);

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

                            PlotSettingsValidator psv = PlotSettingsValidator.Current;
                            psv.RefreshLists(openLay);
                            psv.SetPlotPaperUnits(ps, PlotPaperUnit.Millimeters);
                          
                            psv.SetCurrentStyleSheet(ps, "Color.ctb");

                            openLay.CopyFrom(ps);

                            tr.Commit();
                        }
0 Likes