修改命名空间

This commit is contained in:
GG Z
2026-02-21 16:31:24 +08:00
parent 97c0b18dc7
commit 2ad3d0fde0
188 changed files with 783 additions and 2710 deletions

View File

@@ -0,0 +1,37 @@
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
namespace ShrlAlgoToolkit.RevitCore.Assists;
/// <summary>
/// <c>
/// dwg元素选择过滤ObjectType.PointOnElement默认选择块选择曲线使用 ElementReferenceType.REFERENCE_TYPE_LINEAR
/// var dwgElemSelection = new DwgElementSelection(ElementReferenceType.REFERENCE_TYPE_LINEAR);
/// var refer = UiDocument.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.PointOnElement, dwgElemSelection);
/// Element elem = Document.GetElement(refer);
/// GeometryElement geoElem = elem.get_Geometry(new Options());
/// GeometryObject geoObj = elem.GetGeometryObjectFromReference(refer);
/// 图层:(Document.GetElement(geoObj.GraphicsStyleId) as GraphicsStyle).GraphicsStyleCategory.Name
/// 元素类型geoObj?.GetType().Name
/// </c>
/// </summary>
public class DwgElementSelection : ISelectionFilter
{
private readonly ElementReferenceType elementReferenceType;
private Element e;
public GeometryObject SelectedElement { get; private set; }
public DwgElementSelection(ElementReferenceType elementReferenceType = ElementReferenceType.REFERENCE_TYPE_INSTANCE)
{ this.elementReferenceType = elementReferenceType; }
public bool AllowElement(Element elem)
{
e = elem;
return e.Document.GetElement(e.GetTypeId()) is CADLinkType;
}
public bool AllowReference(Reference reference, XYZ position)
{
return reference.ElementReferenceType == elementReferenceType &&
e.GetGeometryObjectFromReference(reference).GraphicsStyleId != ElementId.InvalidElementId;
}
}