修改命名空间
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitCore.Assists;
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前模型或链接模型的实体元素
|
||||
/// </summary>
|
||||
public class ElementInLinkOrCurrentDocument : ISelectionFilter
|
||||
{
|
||||
public ElementInLinkOrCurrentDocument(Document doc)
|
||||
{
|
||||
this.doc = doc;
|
||||
}
|
||||
|
||||
private readonly Document doc;
|
||||
|
||||
public bool LastCheckedWasFromLink => null != LinkedDocument;
|
||||
|
||||
public Document LinkedDocument { get; private set; }
|
||||
|
||||
public bool AllowElement(Element e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AllowReference(Reference r, XYZ p)
|
||||
{
|
||||
LinkedDocument = null;
|
||||
|
||||
var e = doc.GetElement(r);
|
||||
|
||||
if (e is RevitLinkInstance li)
|
||||
{
|
||||
LinkedDocument = li.GetLinkDocument();
|
||||
|
||||
e = LinkedDocument.GetElement(r.LinkedElementId);
|
||||
}
|
||||
|
||||
return e != null
|
||||
&& e.CanHaveTypeAssigned()
|
||||
&& e.HasPhases()
|
||||
&& e.get_BoundingBox(null) != null
|
||||
&& e.Category is { Parent: null }
|
||||
&& e is not Panel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user