Revit二次开发之“框选”过滤
这里的框选,必须是整体选中。
框选的方式分两种:
左上->右下,必须整体选中。
右下->左上,只要部分选中。
url:http://revit.5d6d.com/thread-873-1-4.html
框选的方式分两种:
左上->右下,必须整体选中。
右下->左上,只要部分选中。
public void SelectPlanarFaces(Autodesk.Revit.DB.Document document)
{
UIDocument uidoc = new UIDocument(document);
ISelectionFilter selFilter = new PlanarFacesSelectionFilter(document);
IList<Reference> faces = uidoc.Selection.PickObjects(ObjectType.Face, selFilter, "Select multiple planar faces");
}
public class PlanarFacesSelectionFilter : ISelectionFilter
{
Document doc = null;
public PlanarFacesSelectionFilter(Document document)
{
doc = document;
}
public bool AllowElement(Element element)
{
return true;
}
public bool AllowReference(Reference refer, XYZ point)
{
if (doc.GetElement(refer).GetGeometryObjectFromReference(refer) is PlanarFace)
{
return true; // Only return true for planar faces. Non-planar faces will not be selectable
}
return false;
}
}
{
UIDocument uidoc = new UIDocument(document);
ISelectionFilter selFilter = new PlanarFacesSelectionFilter(document);
IList<Reference> faces = uidoc.Selection.PickObjects(ObjectType.Face, selFilter, "Select multiple planar faces");
}
public class PlanarFacesSelectionFilter : ISelectionFilter
{
Document doc = null;
public PlanarFacesSelectionFilter(Document document)
{
doc = document;
}
public bool AllowElement(Element element)
{
return true;
}
public bool AllowReference(Reference refer, XYZ point)
{
if (doc.GetElement(refer).GetGeometryObjectFromReference(refer) is PlanarFace)
{
return true; // Only return true for planar faces. Non-planar faces will not be selectable
}
return false;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。