<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: select elements witch cut by the view in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6830615#M61042</link>
    <description>&lt;P&gt;Thanks for replies&lt;/P&gt;&lt;P&gt;I wonder is it possible to use section bounding box for&amp;nbsp;outline&lt;/P&gt;&lt;P&gt;I try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ViewSection viewSection = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element)) as ViewSection;
BoundingBoxXYZ bb = viewSection.get_BoundingBox(null);

XYZ pt1 =&amp;nbsp;bb.Max;
XYZ pt2 =bb.Min;

Outline _outline = new Outline(pt1, pt2);
BoundingBoxIntersectsFilter CutPlaneFilter = new BoundingBoxIntersectsFilter(_outline);
List&amp;lt;Element&amp;gt; ElemsInCutPlane = new FilteredElementCollector(doc, doc.ActiveView.Id)
.WhereElementIsNotElementType()
.WhereElementIsViewIndependent()
.WherePasses(CutPlaneFilter)
.ToList&amp;lt;Element&amp;gt;();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it returns null.&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jan 2017 16:45:26 GMT</pubDate>
    <dc:creator>desdinova</dc:creator>
    <dc:date>2017-01-25T16:45:26Z</dc:date>
    <item>
      <title>select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6793155#M61036</link>
      <description>&lt;P&gt;HI,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for a way to hide all the framing members that are being cut on the section or elevation view.&lt;/P&gt;&lt;P&gt;currently I have to select them and hide them manually. &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any methods or properties that allows me to filter out the elements that cut by the view thru the &amp;nbsp;API?&lt;/P&gt;&lt;P&gt;I tried to google this and search the chm file for cut line but have no luck yet. any suggestions? Thanks.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cut line.jpg" style="width: 511px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/309349iB0EFA80B35243541/image-dimensions/511x340?v=v2" width="511" height="340" role="button" title="cut line.jpg" alt="cut line.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 18:25:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6793155#M61036</guid>
      <dc:creator>glenncai</dc:creator>
      <dc:date>2017-01-09T18:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6793799#M61037</link>
      <description>&lt;P&gt;sorry for my funny typo.&amp;nbsp;&lt;img id="womanembarrassed" class="emoticon emoticon-womanembarrassed" src="https://forums.autodesk.com/i/smilies/16x16_woman-embarrassed.png" alt="Woman Embarassed" title="Woman Embarassed" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 22:24:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6793799#M61037</guid>
      <dc:creator>glenncai</dc:creator>
      <dc:date>2017-01-09T22:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6822116#M61038</link>
      <description>&lt;P&gt;You can use a BoundingBoxIntersectsFilter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BoundingBoxIntersectsFilter CutPlaneFilter = new BoundingBoxIntersectsFilter(_outline);&lt;/P&gt;&lt;P&gt;List&amp;lt;Element&amp;gt; &amp;nbsp;ElemsInCutPlane =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; new FilteredElementCollector(doc, ActiveView.Id)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .WhereElementIsNotElementType()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .WherePasses(CutPlaneFilter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .ToList&amp;lt;Element&amp;gt;();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where _outline&amp;nbsp;is made from the&amp;nbsp;points of a region in the cutplane , for instance the Crop Region&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 23:25:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6822116#M61038</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-01-21T23:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6828704#M61039</link>
      <description>&lt;P&gt;Hello gleencai&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you find solution&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a similar question&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BoundingBoxIntersectsFilter CutPlaneFilter = new BoundingBoxIntersectsFilter(_outline);&lt;/P&gt;&lt;P&gt;List&amp;lt;Element&amp;gt; &amp;nbsp;ElemsInCutPlane =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; new FilteredElementCollector(doc, ActiveView.Id)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .WhereElementIsNotElementType()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .WherePasses(CutPlaneFilter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .ToList&amp;lt;Element&amp;gt;();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Didn't work for më Thanks in advance. ...&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 22:48:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6828704#M61039</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-01-24T22:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6828909#M61040</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/530848"&gt;@desdinova&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry to hear that it doesn't work for you. Before posting a did a small scale test, and it worked fine.( 1 wall in empty project)&amp;nbsp;&amp;nbsp;The "code" in my previous post, is intended as a roadmap / pseudocode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my testing code:&lt;/P&gt;&lt;PRE&gt;            StringBuilder s = new StringBuilder();
            Document doc = revit.Application.ActiveUIDocument.Document;
            Autodesk.Revit.DB.View ActView = doc.ActiveView;
            XYZ pt1 = new XYZ(0, 0, 0);
            XYZ pt2 = new XYZ(0, 0, 100);
            XYZ pt3 = new XYZ(0, 100, 100);
            XYZ pt4 = new XYZ(0, 100, 0);
            Outline _outline = new Outline(pt1, pt3);
            _outline.AddPoint(pt2);
            _outline.AddPoint(pt4);

            BoundingBoxIntersectsFilter CutPlaneFilter = new BoundingBoxIntersectsFilter(_outline);
            List&amp;lt;Element&amp;gt; ElemsInCutPlane =
                   new FilteredElementCollector(doc, doc.ActiveView.Id)
                            .WhereElementIsNotElementType()
                            .WhereElementIsViewIndependent()
                            .WherePasses(CutPlaneFilter)
                            .ToList&amp;lt;Element&amp;gt;();
            s.AppendLine(string.Format("{0} elements found",ElemsInCutPlane.Count));
            s.AppendLine();
            foreach (Element e in ElemsInCutPlane)
            {
                s.AppendLine(string.Format("{0}  &amp;lt;{1}&amp;gt;   {2}", e.Name,e.Id,e.GetType()));
            }
            TaskDialog.Show("debug", s.ToString());
            //using (Transaction t = new Transaction(doc, "test"))
            //{
            //    t.Start();
            //    SketchPlane _plane = SketchPlane.Create(doc, new Plane(XYZ.BasisX, XYZ.Zero));
            //    doc.Create.NewModelCurve(Line.CreateBound(pt1, pt3), _plane);
            //    t.Commit();
            //}&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jan 2017 00:48:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6828909#M61040</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-01-25T00:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6828947#M61041</link>
      <description>&lt;P&gt;Hi desdlinova&lt;/P&gt;&lt;P&gt;It works for me. The only problem I have is the outline of the crop region. I'm not able to make it under control.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 01:11:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6828947#M61041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-25T01:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6830615#M61042</link>
      <description>&lt;P&gt;Thanks for replies&lt;/P&gt;&lt;P&gt;I wonder is it possible to use section bounding box for&amp;nbsp;outline&lt;/P&gt;&lt;P&gt;I try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ViewSection viewSection = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element)) as ViewSection;
BoundingBoxXYZ bb = viewSection.get_BoundingBox(null);

XYZ pt1 =&amp;nbsp;bb.Max;
XYZ pt2 =bb.Min;

Outline _outline = new Outline(pt1, pt2);
BoundingBoxIntersectsFilter CutPlaneFilter = new BoundingBoxIntersectsFilter(_outline);
List&amp;lt;Element&amp;gt; ElemsInCutPlane = new FilteredElementCollector(doc, doc.ActiveView.Id)
.WhereElementIsNotElementType()
.WhereElementIsViewIndependent()
.WherePasses(CutPlaneFilter)
.ToList&amp;lt;Element&amp;gt;();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it returns null.&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 16:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6830615#M61042</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-01-25T16:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6831886#M61043</link>
      <description>&lt;P&gt;It might work, but you'd have to project the&amp;nbsp;3D bounderies unto the cutPlane, while remembering / realising that BounderyBox.Min and Max are coordinates local to the bounderybox.&amp;nbsp; Furthermore I suspect that an Outline needs at least 3 points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;have a solution following a different path, using the CropRegionShapeManager of the view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    public class Cmd_SelectElemsInCutPlane : IExternalCommand
    {

        public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit,
        ref string message, ElementSet elements)
        {
            Document doc = revit.Application.ActiveUIDocument.Document;
            Autodesk.Revit.DB.View ActView = doc.ActiveView;

            List&amp;lt;CurveLoop&amp;gt;  _crop = ActView.GetCropRegionShapeManager().GetCropShape().ToList&amp;lt;CurveLoop&amp;gt;();
            CurveLoop cvLoop = _crop.First();
            List&amp;lt;XYZ&amp;gt; _cropPoints = new List&amp;lt;XYZ&amp;gt;();
            foreach( Curve cv in cvLoop)
            {
                if (cv is Line)
                {
                    _cropPoints.Add(cv.GetEndPoint(0));
                }
                else
                {
                    // redundant all curves in crop region are straight lines
                    List&amp;lt;XYZ&amp;gt; temp = cv.Tessellate().ToList&amp;lt;XYZ&amp;gt;();
                    temp.RemoveAt(temp.Count - 1);
                    _cropPoints.AddRange(temp );
                }
            }
            if (_cropPoints.Count &amp;lt; 3) return Result.Failed;
            Outline _outline = new Outline(_cropPoints[0], _cropPoints[1]);
            for (int i = 2; i &amp;lt; _cropPoints.Count; i++)
            {
                _outline.AddPoint(_cropPoints[i]);
            }
// if you need a bigger region just scale 
//            _outline.Scale(100);

            BoundingBoxIntersectsFilter CutPlaneFilter = new BoundingBoxIntersectsFilter(_outline);
// simplefy the result using OfClass or OfCategory
            List&amp;lt;Element&amp;gt; ElemsInCutPlane =
                   new FilteredElementCollector(doc, doc.ActiveView.Id)
                            .WhereElementIsNotElementType()
                            .WhereElementIsViewIndependent()
                            .WherePasses(CutPlaneFilter)
                            .ToList&amp;lt;Element&amp;gt;();
            List&amp;lt;ElementId&amp;gt; IdsInCutPlane = new List&amp;lt;ElementId&amp;gt;();
            foreach (Element e in ElemsInCutPlane)
            {
// "postprocessing" here if needed 
                IdsInCutPlane.Add(e.Id);
            }
            revit.Application.ActiveUIDocument.Selection.SetElementIds ( IdsInCutPlane);
            return Result.Succeeded;
        }
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 01:05:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6831886#M61043</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-01-26T01:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6833361#M61044</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;FAIR59;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It works like a charm....&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 15:51:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6833361#M61044</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-01-26T15:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: select elements witch cut by the view</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6833920#M61045</link>
      <description>&lt;P&gt;&lt;SPAN&gt;FAIR59&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sorry for the late reply guys. It is hard to squeeze time when deadline is approaching. The&amp;nbsp;solution that you provided is awesome. but for me I just have to modify it a little bit since I'm using Macro for testing. and It looks like&amp;nbsp;List&amp;lt;CurveLoop&amp;gt; not working in Revit 2015. but is fine on company's Revit 2016. Thanks for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;		public void SelectCutElement()
		{
			Document doc = this.ActiveUIDocument.Document;
			UIDocument uidoc = this.ActiveUIDocument;
			Autodesk.Revit.DB.View ActView = doc.ActiveView;

			List&amp;lt;CurveLoop&amp;gt;  _crop = ActView.GetCropRegionShapeManager().GetCropShape().ToList&amp;lt;CurveLoop&amp;gt;();
			CurveLoop cvLoop = _crop.First();
			List&amp;lt;XYZ&amp;gt; _cropPoints = new List&amp;lt;XYZ&amp;gt;();
			foreach( Curve cv in cvLoop)
			{
				if (cv is Line)
				{
					_cropPoints.Add(cv.GetEndPoint(0));
				}
				else
				{
					// redundant all curves in crop region are straight lines
					List&amp;lt;XYZ&amp;gt; temp = cv.Tessellate().ToList&amp;lt;XYZ&amp;gt;();
					temp.RemoveAt(temp.Count - 1);
					_cropPoints.AddRange(temp );
				}
			}
			
			string info = "";
			if (_cropPoints.Count &amp;gt; 3)
			{
				Outline _outline = new Outline(_cropPoints[0], _cropPoints[1]);
				
				for (int i = 2; i &amp;lt; _cropPoints.Count; i++)
				{
					_outline.AddPoint(_cropPoints[i]);
				}
				// if you need a bigger region just scale
				//            _outline.Scale(100);

				BoundingBoxIntersectsFilter CutPlaneFilter = new BoundingBoxIntersectsFilter(_outline);
				// simplefy the result using OfClass or OfCategory
				List&amp;lt;Element&amp;gt; ElemsInCutPlane =	new FilteredElementCollector(doc, doc.ActiveView.Id).WhereElementIsNotElementType().WhereElementIsViewIndependent().WherePasses(CutPlaneFilter).ToList&amp;lt;Element&amp;gt;();
				
				List&amp;lt;ElementId&amp;gt; IdsInCutPlane = new List&amp;lt;ElementId&amp;gt;();
				foreach (Element e in ElemsInCutPlane)
				{
					// "postprocessing" here if needed
					IdsInCutPlane.Add(e.Id);
					info += e.Name;
					info += Environment.NewLine;
				}

				uidoc.Selection.SetElementIds (IdsInCutPlane);
			}
			
			TaskDialog.Show("info",info);

		}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 18:45:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/select-elements-witch-cut-by-the-view/m-p/6833920#M61045</guid>
      <dc:creator>glenncai</dc:creator>
      <dc:date>2017-01-26T18:45:56Z</dc:date>
    </item>
  </channel>
</rss>

