Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Vladimir.Ananyev
in reply to: Anonymous

 Here is my test for the flange feature #1 in your sheet metal model.

 

Flange.jpg

 

Sub Test()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As SheetMetalComponentDefinition
    Set oDef = oDoc.ComponentDefinition
    
    Dim oFlangeFeatures As FlangeFeatures
    Set oFlangeFeatures = oDef.Features.FlangeFeatures
    Debug.Print "FlangeFeatures.Count = " & oFlangeFeatures.Count
    
    ' Get the flange feature.
    Dim oFlange As FlangeFeature
    Set oFlange = oFlangeFeatures.Item(1)
    
    ' Position the end of part marker to just before this feature so the
    ' edges are in their original state.
    Call oFlange.SetEndOfPart(True)

    Dim oFlangeDef As FlangeDefinition
    Set oFlangeDef = oFlange.Definition

    Dim oEdge As Edge
    Set oEdge = oFlangeDef.Edges.Item(1)
    
    Dim Length As Double
    
        'calculation of the edge length
        Dim oCurveEval As CurveEvaluator
        Set oCurveEval = oEdge.Evaluator
        Dim MinParam As Double
        Dim MaxParam As Double
        Call oCurveEval.GetParamExtents(MinParam, MaxParam)
        Call oCurveEval.GetLengthAtParam(MinParam, MaxParam, Length)
        
    Debug.Print "Length, cm = " & Length
    
    ' Set the stop node back to the bottom of the browser.
    Call oDef.SetEndOfPartToTopOrBottom(False)
    
    Beep
End Sub

Results:

FlangeFeatures.Count = 3
Length, cm = 10

Hope this could help.

cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network