<?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: Deviations between points and a wall in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7868282#M51606</link>
    <description>&lt;P&gt;Thank you very much for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indeed, if I find the View3D higher up and pass it into CalculateDeviation function it improves the performance but it is still not so fast. I&amp;nbsp;should have saw that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The direction I use for the ray is the orientation of the wall. Following your advise I had a closer look to the properties of a wall and the methods associated to the faces and I found a faster way to calculate the deviations. Before the foreach loop, I find the two faces with the normal corresponding to the orientation. Then in the foreach loop I determine the distances between a point and the two faces and I keep the smallest one. Now, I can calculate deviations for 1M points only in a few seconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding the color of the points, I will do more research and try your first option. I will perhaps post a more detailed question about that if I still don't manage to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hélène&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Mar 2018 13:35:56 GMT</pubDate>
    <dc:creator>helene.macher</dc:creator>
    <dc:date>2018-03-20T13:35:56Z</dc:date>
    <item>
      <title>Deviations between points and a wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7860137#M51604</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned in the title, I want to compute the deviations between points belonging to a point cloud and a wall and display the deviations with a colormap. I already managed to do the following steps:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1.&amp;nbsp;Prompt the user to select a wall and a point cloud&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Filter the points located in a given distance of the wall (to select points of interest)&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;PointCloudFilter filter = PointCloudFilterFactory.CreateMultiPlaneFilter(planes);
PointCollection points = pointCloudInstance.GetPoints (filter,0.000001,999999);&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;3. Calculate the distances between the collected points and the wall using a foreach loop and the ReferenceIntersector class&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;List&amp;lt;double&amp;gt; list = new List&amp;lt;double&amp;gt;();
foreach (CloudPoint point in points)
   {
     XYZ tpoint = trf.OfPoint(point);
     double length = CalculateDeviation(doc, wall, tpoint, orientation);
     list.Add(length);
   }

private Double CalculateDeviation(Document doc, Wall wall, XYZ origin, XYZ rayDirection)
    {
        FilteredElementCollector collector = new FilteredElementCollector(doc);
        bool isNotTemplate(View v3) =&amp;gt; !(v3.IsTemplate);
        View3D view3D = collector.OfClass(typeof(View3D)).Cast&amp;lt;View3D().First&amp;lt;View3D (isNotTemplate);
        ElementId eid = wall.Id as ElementId;
        ReferenceIntersector refIntersector = new ReferenceIntersector(eid, FindReferenceTarget.All, view3D);
        ReferenceWithContext referenceWithContext = refIntersector.FindNearest(origin, rayDirection);

        if (referenceWithContext != null)
        {
            Reference reference = referenceWithContext.GetReference();
            XYZ intersection = reference.GlobalPoint;
            
            double length = intersection.DistanceTo(origin);
            return length;
        }
    }&lt;/PRE&gt;&lt;P&gt;I manage to calculate the deviations but since I would like to calculate deviations for as much as possible points (numPoints = 999999&amp;nbsp;for the GetPoints method of&amp;nbsp;pointCloudInstance) to see small deformations, it takes really a long time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started programming in C# only two weeks ago so my first question is &lt;STRONG&gt;can I reduce the time required for the calculation of deviations&lt;/STRONG&gt; either by modifying some functions or using an other method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moreover, I would like to &lt;STRONG&gt;display the deviations by applying a custom colormap to points&lt;/STRONG&gt;. I already have a look at the help documentation (PointCloudColorSettings and PointCloudColorMode) but I’m not sure I can do that. &lt;STRONG&gt;Do you have any idea if it’s possible or not?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hélène&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 15:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7860137#M51604</guid>
      <dc:creator>helene.macher</dc:creator>
      <dc:date>2018-03-16T15:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Deviations between points and a wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7861152#M51605</link>
      <description>&lt;P&gt;You can definitely improve performance by not filtering for a 3D view with every point iteration i.e. find the View3D higher up and pass into the CalculateDeviation function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unclear on what direction you are using for the ray? If you obtain the faces of the wall you can get the distance of a point from the face by using Face.Project method and reading Distance property of IntersectionResult.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not overly familiar with the use of point clouds within the API but each CloudPoint appears to have a color field set by integer. Have you tried setting this? Would probably have to do it in combination with correct &lt;SPAN&gt;PointCloudColorMode value,&amp;nbsp;probably PointCloudColorMode.&lt;SPAN class="selflink"&gt;NoOverride by the look of it.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Integer color value obtained as follows&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/how-to-change-text-color/m-p/7812764/highlight/true#M29055" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/how-to-change-text-color/m-p/7812764/highlight/true#M29055&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Failing that CloudPoint derives from element and most elements can have their colour overridden in view (View.SetElementOverrides). However it seems like the&amp;nbsp;first option is the intended approach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a property&amp;nbsp;&lt;SPAN&gt;PointCloudInstance&lt;SPAN class="languageSpecificText"&gt;&lt;SPAN class="cs"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;SupportsOverrides so evidently not all point clouds support overrides for some reason.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 23:11:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7861152#M51605</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-03-16T23:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Deviations between points and a wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7868282#M51606</link>
      <description>&lt;P&gt;Thank you very much for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indeed, if I find the View3D higher up and pass it into CalculateDeviation function it improves the performance but it is still not so fast. I&amp;nbsp;should have saw that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The direction I use for the ray is the orientation of the wall. Following your advise I had a closer look to the properties of a wall and the methods associated to the faces and I found a faster way to calculate the deviations. Before the foreach loop, I find the two faces with the normal corresponding to the orientation. Then in the foreach loop I determine the distances between a point and the two faces and I keep the smallest one. Now, I can calculate deviations for 1M points only in a few seconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding the color of the points, I will do more research and try your first option. I will perhaps post a more detailed question about that if I still don't manage to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hélène&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 13:35:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7868282#M51606</guid>
      <dc:creator>helene.macher</dc:creator>
      <dc:date>2018-03-20T13:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Deviations between points and a wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7868707#M51607</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;SPAN&gt;Hélène&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the analysis visualisation framework AVF to display a colour map on the wall face:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/avf" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/avf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could project the deviations of the points into colours in the colour map.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 15:22:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7868707#M51607</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-03-20T15:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Deviations between points and a wall</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7878827#M51608</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Let me summarize the different ways to apply a colormap to a point cloud for those who are interested with this subject.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I first tried to set the Colorfield of points contained in a PointCollection directly in my foreach loop. Unfortunately, it seems that I can access the Color of a point (point.Color) but I can’t set it. My understanding is that points in PointCollection are in a read-only mode but perhaps I am wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Therefore, I had a look to the Analysis Visualization Framework (AVF). Thank you very much Jeremy, I didn’t know AVF. AVF enables to draw color graphics on the screen in a Revit Project. The results data is transient; it is stored only in the model until the document is closed. There are two options:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN&gt;OPTION 1:&lt;/SPAN&gt;&lt;/U&gt;&lt;SPAN&gt; AVF – Analysis display with markers&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;BR /&gt;A new point cloud is created and colorized based on the deviations from the wall. This requires XYZ points and values attributed to these points (distances from the wall in my case). In order to do this, the point cloud has to be splitted into smaller ones (it is recommended to create multiple primitives with no more than 500 points; I tried multiple primitives with 1000 points and it works). Additionally, the number of points is limited to around 800000 according to my readings.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Display with markers - Visual Style: Hidden Line" style="width: 387px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/479640iA4CB029CD3F99561/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OPT1-1.PNG" alt="Display with markers - Visual Style: Hidden Line" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Display with markers - Visual Style: Hidden Line&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Display with markers - Visual Style: Wireframe" style="width: 387px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/479641i03ED2971E87EF582/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OPT1-2.PNG" alt="Display with markers - Visual Style: Wireframe" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Display with markers - Visual Style: Wireframe&lt;/span&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN&gt;OPTION 2:&lt;/SPAN&gt;&lt;/U&gt;&lt;SPAN&gt; AVF – Analysis display on wall surface&lt;BR /&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;Wall face is colorized based on deviation values. This requires UV points i.e. points in the local coordinate system of the wall and values attributed to these points. I calculated the projection of the XYZ points into the wall face to obtain the UV points (IntersectionResult ir = face.Project(p); UV uvpoint = ir.UVPoint;). Of course, I have to separate the deviations for the two sides of the wall.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Display on surface - Result offset from the wall face" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/479649iB59D69C5F4FAB0B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OPT2.PNG" alt="Display on surface - Result offset from the wall face" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Display on surface - Result offset from the wall face&lt;/span&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The benefit of using markers is that we can see occluded parts of a wall. For a colorized surface, color values are also assigned to occluded parts (interpolation of the color even if there is no points). But perhaps a colorized surface is more suitable for visualization purpose because markers are located both inside and outside the wall. I can use the Wireframe visual style to see all the points but it make the colormap disappear (see images above). I still don’t have decided which option is the better one. I have to do some tests on a bigger project with much more points to determine which is the most suitable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The last thing I have to address is how to manage the views. I am not familiar with views in Revit. Currently I use the default 3D view to display the result but I would like to create a new view with only the analyzed wall and the result of the analysis. However, I don’t want that this view affect the others. &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 14:17:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/deviations-between-points-and-a-wall/m-p/7878827#M51608</guid>
      <dc:creator>helene.macher</dc:creator>
      <dc:date>2018-03-23T14:17:02Z</dc:date>
    </item>
  </channel>
</rss>

