vs2010下,获取CAD选中直线的图层
有人了解吗?谢谢帮忙!
[CommandMethod("GLL")]
public void GetLineLayer()
{
var ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptEntityOptions pEntOpts = new PromptEntityOptions("请选取直线:");
pEntOpts.AddAllowedClass(typeof(Line), true);
PromptEntityResult pEntRes = ed.GetEntity(pEntOpts);
if (pEntRes.Status != PromptStatus.OK)
return;
ed.WriteMessage(
$"\n直线所在图层为{(pEntRes.ObjectId.GetObject(OpenMode.ForRead) as Line)?.Layer}");
}