How to distinguish between curvloop face and curvloop opening?

How to distinguish between curvloop face and curvloop opening?

AndrewButenko
Advocate Advocate
334 Views
3 Replies
Message 1 of 4

How to distinguish between curvloop face and curvloop opening?

AndrewButenko
Advocate
Advocate

Hello! 

 

I get curveloops from wall reference  by next function:

 

 

  Function GetCrvls(doc As Document, refer As Reference) As List(Of CurveLoop)
        Dim lcrvs As New List(Of CurveLoop)


        Dim elem As Element = doc.GetElement(refer.ElementId)

        Dim opt As Options = New Options
        opt.ComputeReferences = True
        opt.View = doc.ActiveView

        Dim geoElem As GeometryElement = elem.Geometry(opt)


        Dim stableRefString As String = refer.ConvertToStableRepresentation(doc)

        For Each gObj As GeometryObject In geoElem

            Dim solid As Solid = TryCast(gObj, Solid)

            If (Not (solid) Is Nothing) Then

                For Each f As Face In solid.Faces
                    Dim r As Reference = f.Reference
                    If (r Is Nothing) Then
                        Continue For
                    End If

                    Dim j As Integer = 0

                    If r.ConvertToStableRepresentation(doc).Equals(stableRefString) Then

                        For Each crvl As CurveLoop In f.GetEdgesAsCurveLoops
                            lcrvs.Add(crvl)
                        Next
                    End If
                Next
            End If
        Next


        Return lcrvs

    End Function

 

 

Always before that I got a curvloop in the zero element of the list that repeated the outer contour of the reference, and in all the rest - curvloops of openings. But now I am faced with the fact that the reference outline is not zero in the list. Can someone tell me how to find a curvloop that follows the outline of the reference?

0 Likes
335 Views
3 Replies
Replies (3)
Message 2 of 4

architect.bim
Collaborator
Collaborator

Hi!

May be you need to check curve loop length. Outline should have the biggest one.


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes
Message 3 of 4

AndrewButenko
Advocate
Advocate

Hello!
I also thought so, but there are times when the perimeter of the opening is greater than the perimeter of the wall.

0 Likes
Message 4 of 4

sahin.ikbal
Advocate
Advocate

You need to calculate the area of the curveloops, by creating some geometry from it.
Then you can take the greater area's curveloop as Face and less as opening.