- UID
- 658062
- 积分
- 2147
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-10-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
[CommandMethod("cdimup")]
public static void TestDimUp()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = HostApplicationServices.WorkingDatabase;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
// Select a dimension
try
{
PromptEntityOptions peo = new PromptEntityOptions("\nSelect a Dimension >>");
peo.SetRejectMessage("\nYou have to select the Dimension only >>");
peo.AddAllowedClass(typeof(Dimension), false);
PromptEntityResult res;
res = ed.GetEntity(peo);
if (res.Status != PromptStatus.OK)
return;
Entity ent = (Entity)tr.GetObject(res.ObjectId, OpenMode.ForRead);
if (ent == null)
return;
Dimension dim = (Dimension)ent as Dimension;
if (dim == null) return;
if (!dim.IsWriteEnabled) dim.UpgradeOpen();
// Add Xdata:
dim.XData = new ResultBuffer(
new TypedValue((int)DxfCode.ExtendedDataRegAppName, "ACAD"),
new TypedValue((int)DxfCode.ExtendedDataAsciiString, "DSTYLE"),
new TypedValue((int)DxfCode.ExtendedDataControlString, "{"),
new TypedValue((int)DxfCode.ExtendedDataInteger16, 77),
new TypedValue((int)DxfCode.ExtendedDataInteger16, 1),
new TypedValue((int)DxfCode.ExtendedDataControlString, "}")
);
dim.DowngradeOpen();
tr.Commit();
}
catch (System.Exception ex)
{
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(ex.Message);
}
}
}
|
|