|
叶老师:你好!有一个Revit二次开发的问题,想向您咨询一下!我想控制用户选择链接DWG中的图块,但是却无法选择DWG图块,问题出在什么地方呢
主要代码如下:Selection sel = uiApp.ActiveUIDocument.Selection;
DWGBlockSelectionFilter blockFilter = new DWGBlockSelectionFilter();
Reference refgeo = sel.PickObject(ObjectType.PointOnElement, blockFilter, "请拾取图块");
过滤器:
public bool AllowElement(Element element)
{
if (element is ImportInstance)
{
ImportInstance instance = element as ImportInstance;
if (instance.IsLinked)
{
Reference refer = new Reference(element);
GeometryObject geometryObject = instance.GetGeometryObjectFromReference(refer);
if (geometryObject is GeometryInstance)
{
return true;
}
}
}
return false;
}
|
|