- 积分
- 656
- 明经币
- 个
- 注册时间
- 2010-8-23
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2013-6-21 19:50:12
|
显示全部楼层
本帖最后由 lamntree 于 2013-6-21 19:54 编辑
现在已经能不打开图形创建新页面设置了,但是名为*model*初始默认页面设置无法访问编辑,我用同名plotsettings覆盖没用,想设置创建的新页面设置设置为当前,又不知道怎么弄
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db1 = new Database(false, true);
db1.ReadDwgFile("c:\\Awork\\1.dwg", System.IO.FileShare.ReadWrite, true, "");
using (Transaction trans1 = db1.TransactionManager.StartTransaction())
{
PlotSettings acPlSet = new PlotSettings(true);
DBDictionary GroDic = (DBDictionary)trans1.GetObject(db1.PlotSettingsDictionaryId , OpenMode.ForWrite);
acPlSet.PlotSettingsName = "111";//名为*model*初始默认页面设置无法访问编辑,我用同名plotsettings覆盖没用
// Update the PlotSettings object
PlotSettingsValidator acPlSetVdr = PlotSettingsValidator.Current;
// Set the plot type
acPlSetVdr.SetPlotType(acPlSet,Autodesk.AutoCAD.DatabaseServices.PlotType.Extents);
// Set the plot scale
acPlSetVdr.SetUseStandardScale(acPlSet, true);
acPlSetVdr.SetStdScaleType(acPlSet, StdScaleType.ScaleToFit);
// Center the plot
acPlSetVdr.SetPlotCentered(acPlSet, true);
// Set the plot device to use
acPlSetVdr.SetPlotConfigurationName(acPlSet, "Microsoft XPS Document Writer","A3");
acPlSetVdr.SetCurrentStyleSheet(acPlSet, "monochrome.ctb");
GroDic.SetAt("111", acPlSet);
trans1.AddNewlyCreatedDBObject(acPlSet, true);
acPlSetVdr.SetDefaultPlotConfig(acPlSet);//这句我以为是设置为当前页面设置,不过试下来没用,怎么才能设置为当前页面设置啊
try
{
db1.SaveAs("c:\\Awork\\1.dwg", true, DwgVersion.Current, doc.Database.SecurityParameters);//指定c盘根目录保存
}
catch
{
return;
}
trans1.Commit();
} |
|