- 积分
- 25236
- 明经币
- 个
- 注册时间
- 2003-6-27
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2012-4-25 16:13:50
|
显示全部楼层
using (Transaction ctrans = db.TransactionManager.StartTransaction())
{
DBDictionary mlDict = (DBDictionary)ctrans.GetObject(db.MLStyleDictionaryId, OpenMode.ForWrite);
if (mlDict.Contains("M2"))
{
se.WriteMessage("\nM2 已存在");
}
else
{
MlineStyle mlStyle = new MlineStyle();
mlStyle.Name = "M2";
mlStyle.StartAngle = sCon.PI90;
mlStyle.EndAngle = sCon.PI90;
MlineStyleElement mlElement1 = new MlineStyleElement(1, Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci, 1), ObjectId.Null);
mlStyle.Elements.Add(mlElement1, true);
MlineStyleElement mlElement2 = new MlineStyleElement(-2, Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci, 2), ObjectId.Null);
mlStyle.Elements.Add(mlElement2, true);
mlDict.SetAt(mlStyle.Name, mlStyle);
ctrans.AddNewlyCreatedDBObject(mlStyle, true);
}
ctrans.Commit();
} |
|