<?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: Fabrication Parts ElementIntersection in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404566#M35710</link>
    <description>&lt;P&gt;Looking at the specific part you share above, I would suggest that a collision check with its convex hull would yield the desired result, wouldn't it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, I can only repeat from above:&amp;nbsp;if you really need the exact clashing volume, you need to have a solid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to create a solid from a mesh would be to take each mesh face (infinitely thin), thicken it by a realistic amount to create a solid (how thick is your material? 1 mm? 1.2 mm?) and unite all those solids into one single composite shape.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would reflect the real part geometry very precisely, in fact.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Mar 2020 14:30:50 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2020-03-27T14:30:50Z</dc:date>
    <item>
      <title>Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9396509#M35702</link>
      <description>&lt;P&gt;&lt;SPAN&gt;When attempting to create an ElementIntersectsElementFilter with a fabrication part, it results in an exception where the FabricationParts category is not supported by this filter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After looking into this, it seems that FabricationPart's geometry is made up of Mesh objects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The BooleanOperationsUtils.ExecuteBooleanOperation method seems to only support solids.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What would be the best way to detect an intersection between a FabricationPart and another element, or an intersection between a Mesh and a Mesh / Solid?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried creating a MeshToSolid function that uses the TesselatedShapeBuilder to convert the Mesh to a Solid, which would then allow me to use the boolean operations, but it rarely succeeds to create a solid from the FabricationPart mesh.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 13:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9396509#M35702</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-24T13:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9397243#M35703</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;replied with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I would also expect the BooleanOperationsUtils to only support solids.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can also well imagine that it is difficult and often impossible to convert a mesh to a solid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing that might be easy to achieve is to collect all the mesh vertices, determine their convex hull, and create a solid from that that can be used by the BooleanOperationsUtils for the element-to-solid intersection:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2009/06/convex-hull-and-volume-computation.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2009/06/convex-hull-and-volume-computation.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried anything like that?&lt;/P&gt;&lt;P&gt;Or, one step simpler, and worthwhile trying out first, just intersect with the bounding box.&lt;/P&gt;&lt;P&gt;The latter has the additional advantage of being a quick element filter, whereas the solid intersection is slow.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Verdana',sans-serif;"&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 17:13:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9397243#M35703</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-24T17:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9397334#M35704</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have thought of using the convex hull of the vertices, but my concern is that protrusions on the Fabrication part would drastically change its geometry with this method. I am looking to get a more accurate intersection volume.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am already using the bounding box filter as a first pass before running the boolean operation.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 17:44:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9397334#M35704</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-24T17:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9398874#M35705</link>
      <description>&lt;P&gt;Dear Doug,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your query and for moving the issue out here into the public discussion forum for all to share and contribute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have already used the bounding box intersection filter, I would assume that you have narrowed down the candidate BIM elements enough to retrieve them out of the Revit memory space into your own .NET add-in memory space for post-processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you would like to perform an intersection test with them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For what purpose? Collision detection?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can well imagine that the convex hull of the mesh points might be excessive and that protrusions on the fabrication part might drastically affect their convex hull geometry.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many other options a can be imagined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One efficient and minimal approach that should cover your needs is to calculate intersections with lines instead of solids.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Retrieve all the mesh edge curves as lines. If the edges are non-linear, tessellate them to retrieve lots of little line segments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Search for intersections between any of the lines with your other candidate collision elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Line intersection is easy and cheap to calculate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How does that sound?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. Tracking history:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2020/03/split-pipe-and-headless-revit.html#comment-4845677945" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2020/03/split-pipe-and-headless-revit.html#comment-4845677945&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;16397789 [Fabrication Parts ElementIntersection]&lt;/LI&gt;
&lt;LI&gt;16405352 [Fabrication Parts ElementIntersection]&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 10:53:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9398874#M35705</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-03-25T10:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9400067#M35706</link>
      <description>&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, the purpose is for determining the exact clashing intersection volume, not just whether or not there is an intersection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this line method could tell me whether or not a line from a mesh intersects with another solid, but it would not give me the total intersection volume. I am also not sure if this method would work when trying to intersect two meshes (two fabrication parts).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have noticed that the reason I may not be able to create a solid with the TessellatedShapeBuilder is because the FabricationPart mesh just may not be a closed mesh. I am currently looking for a third party library to simply close the mesh so I can pass that into the shape builder.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 17:53:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9400067#M35706</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-25T17:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9400077#M35707</link>
      <description>&lt;P&gt;Dear Doug,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well that is a very strong requirement: if you need the clashing volume, you need to have a solid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, the only way to get a solid from a mesh that does not form a closed shape is to close it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, finding a suitable third-party solution to that task will same you a lot of non-trivial work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking forward to hearing what suitable third-party libraries you can find and how you end up resolving this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 17:57:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9400077#M35707</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-03-25T17:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9400206#M35708</link>
      <description>&lt;P&gt;I was able to use the &lt;A href="https://github.com/gradientspace/geometry3Sharp" target="_blank" rel="noopener"&gt;geometry3Sharp&lt;/A&gt; open source geometry library to perform "MeshAutoRepair", which closes the mesh. Getting closer ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the TessellatedShapeBuilder is still giving me the following issues:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="selflink"&gt;NonManifoldEdge&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;Same edge is used by more than two faces. This issue can be posted for topologically impossible face sets as well as for face sets with duplicate faces. Associated numbers are face and loop in which the problem became obvious indices respectively.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="selflink"&gt;OverlappingAdjacentFaces&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;Adjacent faces which either exactly overlaps or have a too acute angle between them. This issue can be reported for face sets with duplicate faces as well. Associated numbers are face and loop indices of one face and face and loop indices of another face respectively.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My thought is that these issues have to do with the 0 thickness edges on the part (see below).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the progress so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FabricationPart on Left, Closed mesh (DirectShape) on Right&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Annotation 2020-03-25 145854.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/745641iF033CB5577D54816/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annotation 2020-03-25 145854.png" alt="Annotation 2020-03-25 145854.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 19:04:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9400206#M35708</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-25T19:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404486#M35709</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;,&amp;nbsp;or others, still no success creating a solid from this geometry. Any other insight would be helpful.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 13:58:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404486#M35709</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-27T13:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404566#M35710</link>
      <description>&lt;P&gt;Looking at the specific part you share above, I would suggest that a collision check with its convex hull would yield the desired result, wouldn't it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, I can only repeat from above:&amp;nbsp;if you really need the exact clashing volume, you need to have a solid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to create a solid from a mesh would be to take each mesh face (infinitely thin), thicken it by a realistic amount to create a solid (how thick is your material? 1 mm? 1.2 mm?) and unite all those solids into one single composite shape.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would reflect the real part geometry very precisely, in fact.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 14:30:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404566#M35710</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-03-27T14:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404575#M35711</link>
      <description>&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the specific shape I shared, a convex hull may be ok, but for other shapes it could be an issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions on .NET libraries available that can thicken the mesh and help create a valid solid?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 14:33:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404575#M35711</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-27T14:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404598#M35712</link>
      <description>&lt;P&gt;Dear Doug,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just from reading your previous messages in this thread, I was assuming that the geometry3Sharp library would enable that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, you could just create each thickening solid from scratch by grabbing the face edge vertices and duplicating them up and down in the face normal direction by half the material thickness, or, put differently, by extruding each mesh face a mm or two.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 14:40:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404598#M35712</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-03-27T14:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404642#M35713</link>
      <description>&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked at&amp;nbsp;&lt;SPAN&gt;geometry3Sharp and didn't see an obvious way to do this. I may have to attempt the thickening myself as you say ...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am surprised the Revit API doesn't have a built in way to check for an intersection of a FabricationPart, those are the parts of the building model that are most useful for coordination.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 15:00:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9404642#M35713</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-03-27T15:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9413806#M35714</link>
      <description>&lt;P&gt;FYI: I was finally able to create a solution on my own using the geometry3Sharp libraries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is some of the relevant code to obtain the mesh intersection volumes.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        public static (g3.DMesh3 resultMesh, double volume, double area) MeshIntersect(this g3.DMesh3 dMesh1, g3.DMesh3 dMesh2)
        {
            var ar1 = new gs.MeshAutoRepair(dMesh1);
            ar1.Apply();
            var ar2 = new gs.MeshAutoRepair(dMesh2);
            ar2.Apply();

            var meshMeshCut = new g3.MeshMeshCut() { Target = ar1.Mesh, CutMesh = ar2.Mesh };
            meshMeshCut.Compute();

            var h1 = meshMeshCut.Target.GetIntersectingTriangles(meshMeshCut.CutMesh);

            var meshMeshCut2 = new g3.MeshMeshCut() { Target = ar2.Mesh, CutMesh = ar1.Mesh };
            meshMeshCut2.Compute();

            var h2 = meshMeshCut2.Target.GetIntersectingTriangles(meshMeshCut2.CutMesh);

            var r1 = new gs.MeshAutoRepair(g3.MeshEditor.Combine(new g3.DMesh3[] { h1, h2 }));
            r1.Apply();

            var volArea = g3.MeshMeasurements.VolumeArea(r1.Mesh, r1.Mesh.TriangleIndices(), r1.Mesh.GetVertex);

#if DEBUG
            //r1.Mesh.GetRevitGeometry().CreateTestDirectShape();
#endif

            return (r1.Mesh, volArea.x, volArea.y);
        }

        private static g3.DMesh3 GetIntersectingTriangles(this g3.DMesh3 mesh, g3.DMesh3 cutMesh)
        {
            var hMesh = new g3.DMesh3(mesh);
            g3.DMeshAABBTree3 spatial2 = new g3.DMeshAABBTree3(cutMesh, true);
            spatial2.WindingNumber(g3.Vector3d.Zero);
            g3.SafeListBuilder&amp;lt;int&amp;gt; keepT1 = new g3.SafeListBuilder&amp;lt;int&amp;gt;();
            g3.gParallel.ForEach(hMesh.TriangleIndices(), (tid) =&amp;gt; {
                g3.Vector3d v = hMesh.GetTriCentroid(tid);
                if (spatial2.WindingNumber(v) &amp;gt; 0.9)
                    keepT1.SafeAdd(tid);
            });
            var keepT2 = keepT1.Result.ToDictionary(i =&amp;gt; i, i =&amp;gt; true);
            g3.MeshEditor.RemoveTriangles(hMesh, hMesh.TriangleIndices().Where(tid =&amp;gt; !keepT2.ContainsKey(tid)).ToList());
            return hMesh;
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 01 Apr 2020 04:02:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9413806#M35714</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-04-01T04:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9413960#M35715</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Doug,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Brilliant! Congratulations!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As far as I can tell from the two methods you share, you are intersecting mesh triangles and returning a mesh as a result.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That makes perfect sense.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or is are you in fact determining a real intersection volume, as your text suggests?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Oh, I see, by automatically repairing the mesh, you may be able to create a complete closed shell with a well-defined volume. Great!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In any case, it sounds like a very useful result that enables you to solve the clash detection task.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Would it be possible to share a complete minimal reproducible case with the community in case anybody else runs into the need?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 06:43:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9413960#M35715</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-04-01T06:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9414508#M35716</link>
      <description>&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is determining the volume and area using the geometry3Sharp library functions after repairing/closing, cutting, determining intersecting triangles, combining, then repairing/closing again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is part of a much larger solution, but I can share some additional interop functions used to transition between g3.DMesh3 and Revit API objects. With these, you can start with a Revit API solid or mesh and then call the MeshIntersect method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        public static g3.DMesh3 GetDMesh3(this Mesh mesh)
        {
            g3.DMesh3Builder meshBuilder = new g3.DMesh3Builder();
            meshBuilder.Meshes.Add(new g3.DMesh3());
            meshBuilder.SetActiveMesh(0);
            meshBuilder.AppendMesh(mesh);
            return meshBuilder.Meshes.First();
        }

        public static g3.DMesh3 GetDMesh3(this Solid solid)
        {
            g3.DMesh3Builder meshBuilder = new g3.DMesh3Builder();
            meshBuilder.Meshes.Add(new g3.DMesh3());
            meshBuilder.SetActiveMesh(0);
            foreach(Face face in solid.Faces)
            {
                meshBuilder.AppendMesh(face.Triangulate());
            }
            return meshBuilder.Meshes.First();
        }

        public static void AppendMesh(this g3.DMesh3Builder meshBuilder, Mesh mesh)
        {
            for (int i = 0; i &amp;lt; mesh.NumTriangles; i++)
            {
                MeshTriangle mt = mesh.get_Triangle(i);
                int v0 = meshBuilder.AppendVertex(mt.get_Vertex(0).X, mt.get_Vertex(0).Y, mt.get_Vertex(0).Z);
                int v1 = meshBuilder.AppendVertex(mt.get_Vertex(1).X, mt.get_Vertex(1).Y, mt.get_Vertex(1).Z);
                int v2 = meshBuilder.AppendVertex(mt.get_Vertex(2).X, mt.get_Vertex(2).Y, mt.get_Vertex(2).Z);
                meshBuilder.AppendTriangle(v0, v1, v2);
            }
        }

        public static IList&amp;lt;GeometryObject&amp;gt; GetRevitGeometry(this g3.DMesh3 dMesh)
        {
            TessellatedShapeBuilder builder = new TessellatedShapeBuilder();
            GetFaces(dMesh, builder);
            builder.Build();
            var result = builder.GetBuildResult();
            return result.GetGeometricalObjects();
        }

        private static void GetFaces(g3.DMesh3 mesh, TessellatedShapeBuilder builder)
        {
            builder.OpenConnectedFaceSet(true);
            foreach (var triangle in mesh.Triangles())
            {
                var va = mesh.GetVertex(triangle.a);
                var vb = mesh.GetVertex(triangle.b);
                var vc = mesh.GetVertex(triangle.c);
                XYZ v0 = new XYZ(va.x, va.y, va.z);
                XYZ v1 = new XYZ(vb.x, vb.y, vb.z);
                XYZ v2 = new XYZ(vc.x, vc.y, vc.z);
                TessellatedFace tesseFace = new TessellatedFace(new List&amp;lt;XYZ&amp;gt; { v0, v1, v2 }, ElementId.InvalidElementId);
                if (builder.DoesFaceHaveEnoughLoopsAndVertices(tesseFace)) builder.AddFace(tesseFace);
            }
            builder.CloseConnectedFaceSet();
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 01 Apr 2020 12:28:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9414508#M35716</guid>
      <dc:creator>djohansing</dc:creator>
      <dc:date>2020-04-01T12:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9884191#M35717</link>
      <description>&lt;P&gt;I'm not sure how to post a question and where, but I have a semi related question, possibly for&amp;nbsp;&lt;SPAN&gt;Jeremy Tammik. I am trying to understand how to access the Autodesk Fabrication Parts Options Tab fields through the Revit API. Any help is appreciated.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 18:05:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/9884191#M35717</guid>
      <dc:creator>greg7KTAR</dc:creator>
      <dc:date>2020-11-20T18:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Fabrication Parts ElementIntersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/12933904#M35718</link>
      <description>&lt;P&gt;We came out with a simplified version if somebody is looking for a solution with no external library. We basically:&lt;/P&gt;&lt;P&gt;-Use the Mesh to get all points (Mesh.Vertices).&lt;/P&gt;&lt;P&gt;-Project all points into a plane normal to the direction of Prefabrication part with element.Location.Curve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Once projected, we extract the 4 outer extremes XYZ.&lt;/P&gt;&lt;P&gt;-Create a line in each extreme with the vector of the prefabrication part (element.Location.Curve) and use PlanarFace.Intersect to find the intersection points between Prefabrication parts and Walls.&lt;/P&gt;&lt;P&gt;I hope it helps somebody:)&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 17:06:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/fabrication-parts-elementintersection/m-p/12933904#M35718</guid>
      <dc:creator>NonicaTeam</dc:creator>
      <dc:date>2024-08-01T17:06:46Z</dc:date>
    </item>
  </channel>
</rss>

