<?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: Section View Profile Area calculation in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10958659#M20909</link>
    <description>&lt;P&gt;If some element is in link file how can I do it then?&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;can you help me out here....&lt;/P&gt;</description>
    <pubDate>Fri, 18 Feb 2022 11:02:27 GMT</pubDate>
    <dc:creator>sahin.ikbal</dc:creator>
    <dc:date>2022-02-18T11:02:27Z</dc:date>
    <item>
      <title>Section View Profile Area calculation</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10938422#M20906</link>
      <description>&lt;P&gt;I want to calculate the section's closed profiles area.I have taken some reference from here-&amp;nbsp;&lt;A href="https://github.com/jeremytammik/SectionCutGeo" target="_blank"&gt;https://github.com/jeremytammik/SectionCutGeo&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But I have two problems after that&lt;/P&gt;&lt;P&gt;1.How can I get the non-line curves from this view, for now I can get lines only.&lt;BR /&gt;2.How can I calculate the area enclosed by closed looped curves in a plane.&lt;BR /&gt;&lt;BR /&gt;How would you suggest me to go about this problem?&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.png" style="width: 838px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1022688i2DBB5B7AD518D4BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 09:18:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10938422#M20906</guid>
      <dc:creator>sahin.ikbal</dc:creator>
      <dc:date>2022-02-09T09:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Section View Profile Area calculation</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10938816#M20907</link>
      <description>&lt;P&gt;When you cut a solid with a view the view specific geometry creates a planar face in the view plane.&lt;/P&gt;&lt;P&gt;This planar face has a FaceNormal matching the view direction.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The edges of the planar face have a graphics style with GraphicsStyleType.Cut.&lt;/P&gt;&lt;P&gt;You can get the area directly from the planar face.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cylinder with spherical ends" style="width: 191px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1022787iA08A87CB2D710DA3/image-size/large?v=v2&amp;amp;px=999" role="button" title="220209a.PNG" alt="Cylinder with spherical ends" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Cylinder with spherical ends&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Section 1" style="width: 424px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1022789i496C6C60AEF2B7A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="220209b.PNG" alt="Section 1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Section 1&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Detail view within Section 1" style="width: 263px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1022790i5C465B765ABD0F2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="220209c.PNG" alt="Detail view within Section 1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Detail view within Section 1&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    Public Function Obj_220209a(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result
        Dim app = commandData.Application
        Dim uidoc = commandData.Application.ActiveUIDocument
        Dim IntDoc = uidoc.Document
        Dim GView As View = uidoc.ActiveGraphicalView

        Dim R As Reference = Nothing
        Try
            R = uidoc.Selection.PickObject(Selection.ObjectType.Element, "Pick object to cut.")
        Catch ex As Exception
            Return Result.Cancelled
        End Try
        Dim Ops As New Options With {.View = GView, .ComputeReferences = False, .IncludeNonVisibleObjects = False}
        Dim El As Element = IntDoc.GetElement(R)
        Dim GeomEl As GeometryElement = El.Geometry(Ops)
        If GeomEl Is Nothing Then
            TaskDialog.Show("Error", "No available geometry")
            Return Result.Cancelled
        End If
        Dim Area As Double = 0
        Dim SList As Solid() = ExtractSolids(GeomEl)
        For i = 0 To SList.Length - 1
            Dim FList As FaceArray = SList(i).Faces

            For ia = 0 To FList.Size - 1
                Dim PF As PlanarFace = TryCast(FList(ia), PlanarFace)
                If PF Is Nothing Then Continue For Else
                If PF.FaceNormal.IsAlmostEqualTo(GView.ViewDirection) = False Then Continue For Else
                If FaceWithCutEdges(IntDoc, PF) = False Then Continue For Else

                Area += PF.Area

                Using Tx As New Transaction(IntDoc, "Draw cut edges")
                    If Tx.Start = TransactionStatus.Started Then

                        Dim PL As Plane = Plane.CreateByNormalAndOrigin(PF.FaceNormal, PF.Origin)
                        Dim SKP As SketchPlane = SketchPlane.Create(IntDoc, PL)

                        Dim EdgeLoops As EdgeArrayArray = PF.EdgeLoops
                        For ib = 0 To EdgeLoops.Size - 1
                            Dim EA As EdgeArray = EdgeLoops(ib)

                            For ic = 0 To EA.Size - 1
                                Dim ed As Edge = EA(ic)
                                Dim C As Curve = ed.AsCurve

                                IntDoc.Create.NewModelCurve(C, SKP)

                            Next
                        Next


                        Tx.Commit()
                    End If
                End Using


            Next
        Next
    End Function

    Private Function FaceWithCutEdges(D As Document, PF As PlanarFace) As Boolean
        Dim EdgeLoops As EdgeArrayArray = PF.EdgeLoops
        Dim Ed As Edge = EdgeLoops.Item(0).Item(0)
        If Ed.GraphicsStyleId = ElementId.InvalidElementId Then
            Return False
        End If
        Dim GSEl As GraphicsStyle = D.GetElement(Ed.GraphicsStyleId)
        Return GSEl.GraphicsStyleType = GraphicsStyleType.Cut
    End Function


    Private Function ExtractSolids(GE As GeometryElement) As Solid()
        Dim SList As New List(Of Solid)
        Dim GeomObs As GeometryObject() = GE.ToArray
        For i = 0 To GeomObs.Length - 1
            Dim GeomOb As GeometryObject = GeomObs(i)
            Select Case GeomOb.GetType
                Case GetType(Solid)
                    SList.Add(GeomOb)
                Case GetType(GeometryInstance)
                    Dim GInst As GeometryInstance = GeomOb
                    Dim j = ExtractSolids(GInst.GetInstanceGeometry)
                    If j.Length &amp;gt; 0 Then
                        SList.AddRange(j)
                    End If
                Case Else
            End Select
        Next
        Return SList.ToArray
    End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 12:26:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10938816#M20907</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-02-09T12:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Section View Profile Area calculation</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10941558#M20908</link>
      <description>&lt;P&gt;Thank You Very Much&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;It's working Perfectly.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 10:04:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10941558#M20908</guid>
      <dc:creator>sahin.ikbal</dc:creator>
      <dc:date>2022-02-10T10:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Section View Profile Area calculation</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10958659#M20909</link>
      <description>&lt;P&gt;If some element is in link file how can I do it then?&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;can you help me out here....&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 11:02:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10958659#M20909</guid>
      <dc:creator>sahin.ikbal</dc:creator>
      <dc:date>2022-02-18T11:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Section View Profile Area calculation</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10958713#M20910</link>
      <description>&lt;P&gt;The issue with that is when you extract the geometry by view the view will be in the wrong document. So if you provide that in the options it is ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you create a temporary copy of the linked document you can open it in the background to create a view in that matching your source view. You would have to transform the position of the view in terms of how the source view extent sits in the linked document rather than the source document. Then you can perhaps process the elements in the same way in the copy of the linked document as you would do without links.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would suggest copying the linked document so you don't have to unload it in the source document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The alternative to the above would be you get the bounding box of the view extent, transform that into the link document to filter elements there. The solids of those elements can then be used to create a direct shape in the source document that you can then cut.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to bring one thing to the other either way.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 11:55:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10958713#M20910</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-02-18T11:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Section View Profile Area calculation</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10958752#M20911</link>
      <description>&lt;P&gt;Thanks, will try to implement your suggestions.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 12:28:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/section-view-profile-area-calculation/m-p/10958752#M20911</guid>
      <dc:creator>sahin.ikbal</dc:creator>
      <dc:date>2022-02-18T12:28:22Z</dc:date>
    </item>
  </channel>
</rss>

