{"id":910,"date":"2020-04-09T22:04:42","date_gmt":"2020-04-09T22:04:42","guid":{"rendered":"https:\/\/www.parametriczoo.com\/?p=910"},"modified":"2020-04-10T11:05:16","modified_gmt":"2020-04-10T11:05:16","slug":"plane-and-solid-surface-intersection","status":"publish","type":"post","link":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/","title":{"rendered":"Plane and Solid\/Surface intersection"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;3.22.7&#8243;][et_pb_row _builder_version=&#8221;3.22.7&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.22.7&#8243;][et_pb_text _builder_version=&#8221;3.22.7&#8243;]<\/p>\n<p>So far we discussed Plane-Plane, Plane-Line and Plane-Curve intersections. None of these methods were not found in REVT-API and you had to find a work around to implement them yourself. The same applies to Plane-Solid intersection which we discuss in this post. The closest method you can find in Revit-API is the\u00a0<a href=\"https:\/\/www.revitapidocs.com\/2020\/cbde1739-3680-4f2a-8215-a48fd08dcb5c.htm\">CutWithHalfSpace()<\/a> method:<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;3.22.7&#8243; background_color=&#8221;#f2f2f2&#8243; border_width_all=&#8221;1px&#8221; border_color_all=&#8221;#d3d3d3&#8243; custom_margin=&#8221;-2px|||||&#8221; custom_padding=&#8221;11px|15px|0px|15px|false|true&#8221; saved_tabs=&#8221;all&#8221;]<\/p>\n<pre><code><span class=\"keyword\">public<\/span> <span class=\"keyword\">static<\/span> <a href=\"7a3b5ac1-c66d-9f81-a11d-9bcd4e026295.htm\">Solid<\/a> <span class=\"identifier\">CutWithHalfSpace<\/span>(\n\t<a href=\"7a3b5ac1-c66d-9f81-a11d-9bcd4e026295.htm\">Solid<\/a> <span class=\"parameter\">solid<\/span>,\n\t<a href=\"6a6ee978-f114-558d-3c69-00d289aa855f.htm\">Plane<\/a> <span class=\"parameter\">plane<\/span>\n)<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;3.22.7&#8243;]Above creates a new shell by removing the portion of the input solid which falls into the positive space of the plane.If nothing is generated then we must check the negetive the space by flippong the plane.This operation (if plane actually intersect the object) creates a new set of curves within the cut plane. All we need to do is to extract those curves. If the input geometry is a solid poly-surface then the intersection is expected to be multiple set of the Curve loops and if the geometry is a surface then a single curve or line may found.[\/et_pb_text][et_pb_image src=&#8221;https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection.jpg&#8221; _builder_version=&#8221;3.22.7&#8243; custom_padding=&#8221;0px|||||&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;3.22.7&#8243;]We search in the <a href=\"https:\/\/www.revitapidocs.com\/2020\/09baca60-e5ab-eef8-2622-2b956f258c8a.htm\">Edges<\/a> of the resulted geometry for the curves that are coincide with the input plane. In case of the line (Plane and planar surface) we need to search for a curve which is within the input plane. This can be done using the <a href=\"https:\/\/www.parametriczoo.com\/index.php\/2020\/03\/07\/plane-line-intersection-in-revit-api\/\">Plane-Line intersection<\/a> method we developed earlier. The line lies in the plane If the result of the intersection is Sunset :&nbsp;[\/et_pb_text][et_pb_text _builder_version=&#8221;3.22.7&#8243; background_color=&#8221;#f2f2f2&#8243; border_width_all=&#8221;1px&#8221; border_color_all=&#8221;#d3d3d3&#8243; custom_margin=&#8221;-2px|||||&#8221; custom_padding=&#8221;11px|15px|0px|15px|false|true&#8221; saved_tabs=&#8221;all&#8221;]<\/p>\n<pre style=\"font-family:Consolas;font-size:13px;color:black;\"><span class=\"keyword - control\" style=\"color:#8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color:#1f377f;\">curve<\/span> <span class=\"keyword\" style=\"color:blue;\">is<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color:#2b91af;\">Line<\/span><span class=\"punctuation\">)<\/span>\n<span class=\"punctuation\">{<\/span>\n    <span class=\"comment\" style=\"color:green;\">\/\/ check if the line lies on the plane <\/span>\n    <span class=\"class name - identifier - (TRANSIENT)\" style=\"color:#2b91af;\">Line<\/span> <span class=\"local name\" style=\"color:#1f377f;\">l<\/span> <span class=\"operator\">=<\/span> <span class=\"identifier - local name - (TRANSIENT)\" style=\"color:#1f377f;\">curve<\/span> <span class=\"keyword\" style=\"color:blue;\">as<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color:#2b91af;\">Line<\/span><span class=\"punctuation\">;<\/span>\n    <span class=\"keyword - control\" style=\"color:#8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color:#1f377f;\">plane<\/span><span class=\"operator\">.<\/span><span class=\"extension method name - identifier - (TRANSIENT)\" style=\"color:#74531f;\">Intersect<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color:#1f377f;\">l<\/span><span class=\"punctuation\">,<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color:#1f377f;\">threshold<\/span><span class=\"punctuation\">,<\/span><span class=\"keyword\" style=\"color:blue;\">out<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color:#2b91af;\">XYZ<\/span> <span class=\"ReSharper Dead Code - local name - unnecessary code - (TRANSIENT)\" style=\"color:#1f377f;\">p<\/span><span class=\"punctuation\">,<\/span><span class=\"keyword\" style=\"color:blue;\">out<\/span> <span class=\"keyword\" style=\"color:blue;\">double<\/span> <span class=\"ReSharper Dead Code - local name - unnecessary code - (TRANSIENT)\" style=\"color:#1f377f;\">t<\/span><span class=\"punctuation\">)<\/span><span class=\"operator\">==<\/span> <span class=\"enum name - identifier - (TRANSIENT)\" style=\"color:#2b91af;\">Plane_Line<\/span><span class=\"operator\">.<\/span><span class=\"enum member name - identifier - (TRANSIENT)\">Subset<\/span><span class=\"punctuation\">)<\/span>\n        <span class=\"identifier - local name - (TRANSIENT)\" style=\"color:#1f377f;\">intersections<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color:#74531f;\">Add<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color:#1f377f;\">curve<\/span><span class=\"punctuation\">);<\/span> <span class=\"comment\" style=\"color:green;\">\/\/ add curve to the intersection list of it lies on the intersection plane<\/span>\n<span class=\"punctuation\">}<\/span><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;3.22.7&#8243;]If the edge is a curve we must check if it is planar. In Revit API there is no direct method to check the planarity of the curve, however, if you build a <a href=\"https:\/\/www.revitapidocs.com\/2020\/84824924-cb89-9e20-de6e-3461f429dfd6.htm\">CurveLoop<\/a> from the curve then you can use methods to check (<a href=\"https:\/\/www.revitapidocs.com\/2020\/69c92503-2025-ddab-ba91-3085aa2e8117.htm\">HasPlane()<\/a>) and retrieve the plane (<a href=\"https:\/\/www.revitapidocs.com\/2020\/87e64330-90d4-c6bb-944d-d2dbb1529948.htm\">GetPlane()<\/a>) of the curve. Once the of the curve is available we can find out whether it is coincide with input plane or not. For this we use the <a href=\"https:\/\/www.parametriczoo.com\/index.php\/2020\/03\/03\/coincident-planes\/\">IsCoincident()<\/a> method that we have implemented before.[\/et_pb_text][et_pb_text _builder_version=&#8221;3.22.7&#8243; background_color=&#8221;#f2f2f2&#8243; border_width_all=&#8221;1px&#8221; border_color_all=&#8221;#d3d3d3&#8243; custom_margin=&#8221;-2px|||||&#8221; custom_padding=&#8221;11px|15px|0px|15px|false|true&#8221; saved_tabs=&#8221;all&#8221;]<\/p>\n<pre style=\"font-family: Consolas; font-size: 13px; color: black;\"><span class=\"comment\" style=\"color: green;\">\/\/ add the curve to an empty CurveLoop to find out if the curve is planar<\/span>\n<span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">CurveLoop<\/span> <span class=\"local name\" style=\"color: #1f377f;\">cl<\/span> <span class=\"operator\">=<\/span> <span class=\"keyword\" style=\"color: blue;\">new<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">CurveLoop<\/span><span class=\"punctuation\">();<\/span>\n<span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">cl<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">Append<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">curve<\/span><span class=\"punctuation\">);\n<span class=\"comment\">\/\/ if curve is planar then check if the plane of the curve is coincident with intersection plane <\/span><\/span>\n<span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">cl<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">HasPlane<\/span><span class=\"punctuation\">())<\/span> \n<span class=\"punctuation\">{<\/span>\n    <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Plane<\/span> <span class=\"ReSharper Dead Code - local name - unnecessary code - (TRANSIENT)\" style=\"color: #1f377f;\">pl<\/span> <span class=\"operator\">=<\/span> <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">cl<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">GetPlane<\/span><span class=\"punctuation\">();<\/span> <span class=\"comment\" style=\"color: green;\">\/\/ retrieve the plane of the curve<\/span>\n    <span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">plane<\/span><span class=\"operator\">.<\/span><span class=\"extension method name - identifier - (TRANSIENT)\" style=\"color: #74531f;\">IsCoincident<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">pl<\/span><span class=\"punctuation\">,<\/span> <span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">threshold<\/span><span class=\"punctuation\">))<\/span>\n        <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">intersections<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">Add<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">curve<\/span><span class=\"punctuation\">);<\/span> <span class=\"comment\" style=\"color: green;\">\/\/ add curve to the intersection list of it lies on the intersection plane<\/span>\n<span class=\"punctuation\">}<\/span><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;3.22.7&#8243;]Below is the full implementation of the method. The method returns a list of curves as result. In order to create planar surfaces from the closed chain of curves we must first create CurveLoops out of the separate curves. Note that the returned curves are not necessary in order and therefore cannot be added to a CurveLoop directly. To arrange the curves in right order we discuss an algorithm in the next post.[\/et_pb_text][et_pb_text _builder_version=&#8221;3.22.7&#8243; background_color=&#8221;#f2f2f2&#8243; border_width_all=&#8221;1px&#8221; border_color_all=&#8221;#d3d3d3&#8243; custom_margin=&#8221;-2px|||||&#8221; custom_padding=&#8221;11px|15px|0px|15px|false|true&#8221; saved_tabs=&#8221;all&#8221;]<\/p>\n<pre style=\"font-family: Consolas; font-size: 13px; color: black;\"><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> <\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">summary<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span>\n<span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> Intersect this solid with given plane and return the list of intersecting curves.<\/span>\n<span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> <\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">para<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span><span class=\"xml doc comment - text\" style=\"color: green;\">Note that curves are not in order.<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;\/<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">para<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span>\n<span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> <\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;\/<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">summary<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span>\n<span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> <\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">param<\/span><span class=\"xml doc comment - attribute name\" style=\"color: gray;\"> name<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">=<\/span><span class=\"xml doc comment - attribute quotes\" style=\"color: gray;\">\"<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">solid<\/span><span class=\"xml doc comment - attribute quotes\" style=\"color: gray;\">\"<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;&lt;\/<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">param<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span>\n<span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> <\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">param<\/span><span class=\"xml doc comment - attribute name\" style=\"color: gray;\"> name<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">=<\/span><span class=\"xml doc comment - attribute quotes\" style=\"color: gray;\">\"<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">plane<\/span><span class=\"xml doc comment - attribute quotes\" style=\"color: gray;\">\"<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;&lt;\/<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">param<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span>\n<span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> <\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">param<\/span><span class=\"xml doc comment - attribute name\" style=\"color: gray;\"> name<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">=<\/span><span class=\"xml doc comment - attribute quotes\" style=\"color: gray;\">\"<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">threshold<\/span><span class=\"xml doc comment - attribute quotes\" style=\"color: gray;\">\"<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;&lt;\/<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">param<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span>\n<span class=\"xml doc comment - delimiter\" style=\"color: gray;\">\/\/\/<\/span><span class=\"xml doc comment - text\" style=\"color: green;\"> <\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&lt;<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">returns<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;&lt;\/<\/span><span class=\"xml doc comment - name\" style=\"color: gray;\">returns<\/span><span class=\"xml doc comment - delimiter\" style=\"color: gray;\">&gt;<\/span>\n<span class=\"keyword\" style=\"color: blue;\">public<\/span> <span class=\"keyword\" style=\"color: blue;\">static<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">List<\/span><span class=\"punctuation\">&lt;<\/span><span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Curve<\/span><span class=\"punctuation\">&gt;<\/span> <span class=\"ReSharper Dead Code - extension method name - static symbol - (TRANSIENT)\" style=\"color: #74531f;\">Intersect<\/span><span class=\"punctuation\">(<\/span><span class=\"keyword\" style=\"color: blue;\">this<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Solid<\/span> <span class=\"parameter name\" style=\"color: #1f377f;\">solid<\/span><span class=\"punctuation\">,<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Plane<\/span> <span class=\"parameter name\" style=\"color: #1f377f;\">plane<\/span><span class=\"punctuation\">,<\/span> <span class=\"keyword\" style=\"color: blue;\">double<\/span> <span class=\"parameter name\" style=\"color: #1f377f;\">threshold<\/span><span class=\"punctuation\">)<\/span>\n<span class=\"punctuation\">{<\/span>\n    <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">List<\/span><span class=\"punctuation\">&lt;<\/span><span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Curve<\/span><span class=\"punctuation\">&gt;<\/span> <span class=\"local name\" style=\"color: #1f377f;\">intersections<\/span> <span class=\"operator\">=<\/span> <span class=\"keyword\" style=\"color: blue;\">new<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">List<\/span><span class=\"punctuation\">&lt;<\/span><span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Curve<\/span><span class=\"punctuation\">&gt;();<\/span>\n    <span class=\"comment\" style=\"color: green;\">\/\/ cut the solid with positive side of the plane<\/span>\n    <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Solid<\/span> <span class=\"local name\" style=\"color: #1f377f;\">s<\/span> <span class=\"operator\">=<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">BooleanOperationsUtils<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - static symbol - (TRANSIENT)\" style=\"color: #74531f;\">CutWithHalfSpace<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">solid<\/span><span class=\"punctuation\">,<\/span> <span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">plane<\/span><span class=\"punctuation\">);<\/span>\n    <span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">s<\/span> <span class=\"operator - operator - overloaded - (TRANSIENT)\" style=\"color: #74531f;\">==<\/span> <span class=\"keyword\" style=\"color: blue;\">null<\/span><span class=\"punctuation\">)<\/span>\n    <span class=\"punctuation\">{<\/span>\n        <span class=\"comment\" style=\"color: green;\">\/\/ it could be that the plane is just on the top of the solid <\/span>\n        <span class=\"comment\" style=\"color: green;\">\/\/ we cut the solid again by the reverse plane <\/span>\n        <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">s<\/span> <span class=\"operator\">=<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">BooleanOperationsUtils<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - static symbol - (TRANSIENT)\" style=\"color: #74531f;\">CutWithHalfSpace\n<\/span><span class=\"punctuation\">               (<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">solid<\/span><span class=\"punctuation\">,<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Plane<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - static symbol - (TRANSIENT)\" style=\"color: #74531f;\">CreateByNormalAndOrigin<\/span><span class=\"punctuation\">(<\/span><span class=\"operator - operator - overloaded - (TRANSIENT)\" style=\"color: #74531f;\">-<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">plane<\/span><span class=\"operator\">.<\/span><span class=\"identifier - property name - (TRANSIENT)\">Normal<\/span><span class=\"punctuation\">,<\/span> <span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">plane<\/span><span class=\"operator\">.<\/span><span class=\"identifier - property name - (TRANSIENT)\">Origin<\/span><span class=\"punctuation\">));<\/span>\n        <span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">s<\/span> <span class=\"operator - operator - overloaded - (TRANSIENT)\" style=\"color: #74531f;\">==<\/span> <span class=\"keyword\" style=\"color: blue;\">null<\/span><span class=\"punctuation\">)<\/span>\n            <span class=\"keyword - control\" style=\"color: #8f08c4;\">return<\/span> <span class=\"keyword\" style=\"color: blue;\">null<\/span><span class=\"punctuation\">;<\/span> <span class=\"comment\" style=\"color: green;\">\/\/ plane does not intersect the solid<\/span>\n    <span class=\"punctuation\">}<\/span>\n    <span class=\"comment\" style=\"color: green;\">\/\/ search for edges in the new solid geometry which lies on the plane <\/span>\n    <span class=\"keyword - control\" style=\"color: #8f08c4;\">foreach<\/span> <span class=\"punctuation\">(<\/span><span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Edge<\/span> <span class=\"local name\" style=\"color: #1f377f;\">edge<\/span> <span class=\"keyword - control\" style=\"color: #8f08c4;\">in<\/span> <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">s<\/span><span class=\"operator\">.<\/span><span class=\"identifier - property name - (TRANSIENT)\">Edges<\/span><span class=\"punctuation\">)<\/span>\n    <span class=\"punctuation\">{<\/span>\n        <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Curve<\/span> <span class=\"local name\" style=\"color: #1f377f;\">curve<\/span> <span class=\"operator\">=<\/span> <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">edge<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">AsCurve<\/span><span class=\"punctuation\">();<\/span>\n        <span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">curve<\/span> <span class=\"keyword\" style=\"color: blue;\">is<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Line<\/span><span class=\"punctuation\">)<\/span>\n        <span class=\"punctuation\">{<\/span>\n            <span class=\"comment\" style=\"color: green;\">\/\/ check if the line lies on the plane <\/span>\n            <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Line<\/span> <span class=\"local name\" style=\"color: #1f377f;\">l<\/span> <span class=\"operator\">=<\/span> <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">curve<\/span> <span class=\"keyword\" style=\"color: blue;\">as<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Line<\/span><span class=\"punctuation\">;<\/span>\n            <span class=\"comment\" style=\"color: green;\">\/\/ add curve to the intersection list if it lies on the intersection plane<\/span>\n            <span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">plane<\/span><span class=\"operator\">.<\/span><span class=\"extension method name - identifier - (TRANSIENT)\" style=\"color: #74531f;\">Intersect<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">l<\/span><span class=\"punctuation\">,<\/span> <span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">threshold<\/span><span class=\"punctuation\">,<\/span> <span class=\"keyword\" style=\"color: blue;\">out<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">XYZ<\/span> <span class=\"ReSharper Dead Code - local name - unnecessary code - (TRANSIENT)\" style=\"color: #1f377f;\">p<\/span><span class=\"punctuation\">,<\/span> <span class=\"keyword\" style=\"color: blue;\">out<\/span> <span class=\"keyword\" style=\"color: blue;\">double<\/span> <span class=\"ReSharper Dead Code - local name - unnecessary code - (TRANSIENT)\" style=\"color: #1f377f;\">t<\/span><span class=\"punctuation\">)<\/span> <span class=\"operator\">==<\/span> <span class=\"enum name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Plane_Line<\/span><span class=\"operator\">.<\/span><span class=\"enum member name - identifier - (TRANSIENT)\">Subset<\/span><span class=\"punctuation\">)<\/span>\n                <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">intersections<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">Add<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">curve<\/span><span class=\"punctuation\">);<\/span> \n        <span class=\"punctuation\">}<\/span>\n        <span class=\"keyword - control\" style=\"color: #8f08c4;\">else<\/span>\n        <span class=\"punctuation\">{<\/span>\n            <span class=\"comment\" style=\"color: green;\">\/\/ add the curve to an empty CurveLoop to find out if the curve is planar<\/span>\n            <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">CurveLoop<\/span> <span class=\"local name\" style=\"color: #1f377f;\">cl<\/span> <span class=\"operator\">=<\/span> <span class=\"keyword\" style=\"color: blue;\">new<\/span> <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">CurveLoop<\/span><span class=\"punctuation\">();<\/span>\n            <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">cl<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">Append<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">curve<\/span><span class=\"punctuation\">);\n<span class=\"comment\">        \/\/ if curve is planar then check if the plane of the curve is coincident with intersection plane <\/span><\/span>\n            <span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">cl<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">HasPlane<\/span><span class=\"punctuation\">())<\/span> \n            <span class=\"punctuation\">{<\/span>\n                <span class=\"class name - identifier - (TRANSIENT)\" style=\"color: #2b91af;\">Plane<\/span> <span class=\"local name\" style=\"color: #1f377f;\">pl<\/span> <span class=\"operator\">=<\/span> <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">cl<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">GetPlane<\/span><span class=\"punctuation\">();<\/span> <span class=\"comment\" style=\"color: green;\">\/\/ retrieve the plane of the curve<\/span>\n                <span class=\"comment\" style=\"color: green;\">\/\/ add curve to the intersection list of it lies on the intersection plane<\/span>\n                <span class=\"keyword - control\" style=\"color: #8f08c4;\">if<\/span> <span class=\"punctuation\">(<\/span><span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">plane<\/span><span class=\"operator\">.<\/span><span class=\"extension method name - identifier - (TRANSIENT)\" style=\"color: #74531f;\">IsCoincident<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">pl<\/span><span class=\"punctuation\">,<\/span> <span class=\"identifier - parameter name - (TRANSIENT)\" style=\"color: #1f377f;\">threshold<\/span><span class=\"punctuation\">))<\/span>\n                    <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">intersections<\/span><span class=\"operator\">.<\/span><span class=\"identifier - method name - (TRANSIENT)\" style=\"color: #74531f;\">Add<\/span><span class=\"punctuation\">(<\/span><span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">curve<\/span><span class=\"punctuation\">);<\/span> \n            <span class=\"punctuation\">}<\/span>\n        <span class=\"punctuation\">}<\/span>\n    <span class=\"punctuation\">}<\/span>\n    <span class=\"keyword - control\" style=\"color: #8f08c4;\">return<\/span> <span class=\"identifier - local name - (TRANSIENT)\" style=\"color: #1f377f;\">intersections<\/span><span class=\"punctuation\">;<\/span> <span class=\"comment\" style=\"color: green;\">\/\/ return the result.<\/span>\n<span class=\"punctuation\">}<\/span><\/pre>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So far we discussed Plane-Plane, Plane-Line and Plane-Curve intersections. None of these methods were not found in REVT-API and you had to find a work around to implement them yourself. The same applies to Plane-Solid intersection which we discuss in this post. The closest method you can find in Revit-API is the\u00a0CutWithHalfSpace() method:public static Solid [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":935,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":""},"categories":[46,45],"tags":[50,33,47,48],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Plane and Solid\/Surface intersection - Parametric Zoo<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Plane and Solid\/Surface intersection - Parametric Zoo\" \/>\n<meta property=\"og:description\" content=\"So far we discussed Plane-Plane, Plane-Line and Plane-Curve intersections. None of these methods were not found in REVT-API and you had to find a work around to implement them yourself. The same applies to Plane-Solid intersection which we discuss in this post. The closest method you can find in Revit-API is the\u00a0CutWithHalfSpace() method:public static Solid [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/\" \/>\n<meta property=\"og:site_name\" content=\"Parametric Zoo\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-09T22:04:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-10T11:05:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2110\" \/>\n\t<meta property=\"og:image:height\" content=\"1325\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"PARA\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"PARA\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.parametriczoo.com\/#website\",\"url\":\"https:\/\/www.parametriczoo.com\/\",\"name\":\"Parametric Zoo\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.parametriczoo.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#primaryimage\",\"url\":\"https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection2.jpg\",\"contentUrl\":\"https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection2.jpg\",\"width\":2110,\"height\":1325},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/\",\"url\":\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/\",\"name\":\"Plane and Solid\/Surface intersection - Parametric Zoo\",\"isPartOf\":{\"@id\":\"https:\/\/www.parametriczoo.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#primaryimage\"},\"datePublished\":\"2020-04-09T22:04:42+00:00\",\"dateModified\":\"2020-04-10T11:05:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.parametriczoo.com\/#\/schema\/person\/0368c6eb8bfe3a003504793be2a2e0e3\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.parametriczoo.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Plane and Solid\/Surface intersection\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.parametriczoo.com\/#\/schema\/person\/0368c6eb8bfe3a003504793be2a2e0e3\",\"name\":\"PARA\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.parametriczoo.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2b2ff0ff40493545df12d0b31a504675?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2b2ff0ff40493545df12d0b31a504675?s=96&d=mm&r=g\",\"caption\":\"PARA\"},\"url\":\"https:\/\/www.parametriczoo.com\/index.php\/author\/para\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Plane and Solid\/Surface intersection - Parametric Zoo","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/","og_locale":"en_US","og_type":"article","og_title":"Plane and Solid\/Surface intersection - Parametric Zoo","og_description":"So far we discussed Plane-Plane, Plane-Line and Plane-Curve intersections. None of these methods were not found in REVT-API and you had to find a work around to implement them yourself. The same applies to Plane-Solid intersection which we discuss in this post. The closest method you can find in Revit-API is the\u00a0CutWithHalfSpace() method:public static Solid [&hellip;]","og_url":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/","og_site_name":"Parametric Zoo","article_published_time":"2020-04-09T22:04:42+00:00","article_modified_time":"2020-04-10T11:05:16+00:00","og_image":[{"width":2110,"height":1325,"url":"https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection2.jpg","type":"image\/jpeg"}],"author":"PARA","twitter_card":"summary_large_image","twitter_misc":{"Written by":"PARA","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.parametriczoo.com\/#website","url":"https:\/\/www.parametriczoo.com\/","name":"Parametric Zoo","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.parametriczoo.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#primaryimage","url":"https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection2.jpg","contentUrl":"https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection2.jpg","width":2110,"height":1325},{"@type":"WebPage","@id":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/","url":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/","name":"Plane and Solid\/Surface intersection - Parametric Zoo","isPartOf":{"@id":"https:\/\/www.parametriczoo.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#primaryimage"},"datePublished":"2020-04-09T22:04:42+00:00","dateModified":"2020-04-10T11:05:16+00:00","author":{"@id":"https:\/\/www.parametriczoo.com\/#\/schema\/person\/0368c6eb8bfe3a003504793be2a2e0e3"},"breadcrumb":{"@id":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.parametriczoo.com\/index.php\/2020\/04\/09\/plane-and-solid-surface-intersection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.parametriczoo.com\/"},{"@type":"ListItem","position":2,"name":"Plane and Solid\/Surface intersection"}]},{"@type":"Person","@id":"https:\/\/www.parametriczoo.com\/#\/schema\/person\/0368c6eb8bfe3a003504793be2a2e0e3","name":"PARA","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.parametriczoo.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2b2ff0ff40493545df12d0b31a504675?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2b2ff0ff40493545df12d0b31a504675?s=96&d=mm&r=g","caption":"PARA"},"url":"https:\/\/www.parametriczoo.com\/index.php\/author\/para\/"}]}},"jetpack_featured_media_url":"https:\/\/www.parametriczoo.com\/wp-content\/uploads\/2020\/04\/plane-geometry-intersection2.jpg","_links":{"self":[{"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/posts\/910"}],"collection":[{"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/comments?post=910"}],"version-history":[{"count":0,"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/posts\/910\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/media\/935"}],"wp:attachment":[{"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/media?parent=910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/categories?post=910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.parametriczoo.com\/index.php\/wp-json\/wp\/v2\/tags?post=910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}