本文主要是介绍创建新的标注样式并设为当前标注样式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
原文:Creating a new dimension style and make it as current
[CommandMethod("NewDimStyle")]public void NewDimStyle(){Database db =Application.DocumentManager.MdiActiveDocument.Database;using (Transaction trans =db.TransactionManager.StartTransaction()){DimStyleTable DimTabb =(DimStyleTable)trans.GetObject(db.DimStyleTableId,OpenMode.ForRead);ObjectId dimId = ObjectId.Null;if (!DimTabb.Has("Test")){DimTabb.UpgradeOpen();DimStyleTableRecord newRecord =new DimStyleTableRecord();newRecord.Name = "Test";dimId = DimTabb.Add(newRecord);trans.AddNewlyCreatedDBObject(newRecord, true);}else{dimId = DimTabb["Test"];}DimStyleTableRecord DimTabbRecaord =(DimStyleTableRecord)trans.GetObject(dimId,OpenMode.ForRead);if (DimTabbRecaord.ObjectId != db.Dimstyle){db.Dimstyle = DimTabbRecaord.ObjectId;db.SetDimstyleData(DimTabbRecaord);}trans.Commit();}}
这篇关于创建新的标注样式并设为当前标注样式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!