Dim swApp As Object Dim Part As Object Dim SelMgr As Object Dim Face As Object Dim vEdgeArr As Variant Dim vEdge As Variant Dim OuteSideLength As Double Dim vCurveParam As Variant Dim StartPt(2) As Double Dim EndPt(2) As Double Dim vStartPt As Variant Dim vEndPt As Variant Dim holesCount As Integer Dim longHolesCount As Integer Dim unknownHolesCount As Integer Sub main() Set swApp = Application.SldWorks Set Part = swApp.ActiveDoc Set SelMgr = Part.SelectionManager If SelMgr.GetSelectedObjectType3(1, -1) <> swSelFACES Then MsgBox "Selection is not face", vbInformation Exit Sub End If Set Face = SelMgr.GetSelectedObject6(1, -1) OuteSideLength = 0 holesCount = 0 longHolesCount = 0 unknownHolesCount = 0 Set swLoop = Face.GetFirstLoop While Not swLoop Is Nothing If swLoop.IsOuter Then vEdgeArr = swLoop.GetEdges For Each vEdge In vEdgeArr Set swEdge = vEdge Set swCurve = swEdge.GetCurve vCurveParam = swEdge.GetCurveParams2 StartPt(0) = vCurveParam(0) StartPt(1) = vCurveParam(1) StartPt(2) = vCurveParam(2) EndPt(0) = vCurveParam(3) EndPt(1) = vCurveParam(4) EndPt(2) = vCurveParam(5) vStartPt = StartPt vEndPt = EndPt CurveLength = swCurve.GetLength2(vCurveParam(6), vCurveParam(7)) OuteSideLength = OuteSideLength + CurveLength Next vEdge ElseIf swLoop.GetEdgeCount() = 1 Then vEdgeArr = swLoop.GetEdges For Each vEdge In vEdgeArr Set swEdge = vEdge Set swCurve = swEdge.GetCurve If swCurve.IsCircle Then holesCount = holesCount + 1 End If Next vEdge ElseIf swLoop.GetEdgeCount() = 4 Then circCount = 0 LineCount = 0 vEdgeArr = swLoop.GetEdges For Each vEdge In vEdgeArr Set swEdge = vEdge Set swCurve = swEdge.GetCurve If swCurve.IsCircle Then circCount = circCount + 1 End If If swCurve.IsLine Then LineCount = LineCount + 1 End If Next vEdge If circCount = 2 Then If LineCount = 2 Then longHolesCount = longHolesCount + 1 End If End If Else unknownHolesCount = unknownHolesCount + 1 End If Set swLoop = swLoop.GetNext Wend MsgBox "Außenlänge=" + Str(OuteSideLength * 1000) + "mm" + " Bohrungen=" + Str(holesCount) + " Langlöcher=" + Str(longHolesCount) + " nicht erkannte Löcher=" + Str(unknownHolesCount) End Sub