EaBIM
标题:
[实体对象] 获取线型名字
[打印本页]
作者:
萧闫子
时间:
2014-1-8 14:06
标题:
[实体对象] 获取线型名字
public string GetLinetypeName(ObjectId ID)
{
string functionReturnValue = null;
using (Transaction Trans = DB.TransactionManager.StartTransaction)
{
DBObject obj = Trans.GetObject(ID, OpenMode.ForRead);
if (obj is Entity)
{
Entity Ent = obj;
string rLT = Ent.Linetype.ToUpper;
switch (rLT)
{
case "BYLAYER":
LayerTableRecord LayR = Trans.GetObject(Ent.LayerId, OpenMode.ForRead);
functionReturnValue = ((LinetypeTableRecord)Trans.GetObject(LayR.LinetypeObjectId, OpenMode.ForRead)).Name;
break;
case "BYBLOCK":
functionReturnValue = "CONTINUOUS";
break;
default:
functionReturnValue = rLT;
break;
}
}
else
{
functionReturnValue = "";
}
Trans.Commit();
}
return functionReturnValue;
}
复制代码
欢迎光临 EaBIM (https://eabim.net/)
Powered by Discuz! X3.2