Create Contour Flange edge

Create Contour Flange edge

kpeddibh
Explorer Explorer
416 Views
2 Replies
Message 1 of 3

Create Contour Flange edge

kpeddibh
Explorer
Explorer

Hello,

 

how can we create contour flange edges using Inventor Functions.

 

the attached screenshot shows the edges options. we want to simulate the edge creation in program. how can we do this.

 

Thank You,

Rakesh

 

0 Likes
417 Views
2 Replies
Replies (2)
Message 2 of 3

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi Rakesh,

 

In Counter Flange, edges means edges of face. Please find the sample VBA code to flange with edges collection.

 

Sub Main()
    ' Create a new sheet metal document, using the default sheet metal template.
    Dim oSheetMetalDoc As PartDocument
    Set oSheetMetalDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
                 ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject, , , "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"))

    ' Set a reference to the component definition.
    Dim oCompDef As SheetMetalComponentDefinition
    Set oCompDef = oSheetMetalDoc.ComponentDefinition

    ' Set a reference to the sheet metal features collection.
    Dim oSheetMetalFeatures As SheetMetalFeatures
    Set oSheetMetalFeatures = oCompDef.Features

    ' Create a new sketch on the X-Y work plane.
    Dim oSketch As PlanarSketch
    Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3))

    ' Set a reference to the transient geometry object.
    Dim oTransGeom As TransientGeometry
    Set oTransGeom = ThisApplication.TransientGeometry

    ' Draw a 4cm x 3cm rectangle with the corner at (0,0)
    Call oSketch.SketchLines.AddAsTwoPointRectangle( _
                                oTransGeom.CreatePoint2d(0, 0), _
                                oTransGeom.CreatePoint2d(4, 3))

    ' Create a profile.
    Dim oProfile As Profile
    Set oProfile = oSketch.Profiles.AddForSolid

    Dim oFaceFeatureDefinition As FaceFeatureDefinition
    Set oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile)

    ' Create a face feature.
    Dim oFaceFeature As FaceFeature
    Set oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition)

    ' Get the top face for creating the flange.
    ' We'll assume that the 6th face is the top face.
    Dim oFrontFace As Face
    Set oFrontFace = oFaceFeature.Faces.Item(6)

    ' Collect up all edges of the face
    Dim oEdgeCollection As EdgeCollection
    Set oEdgeCollection = ThisApplication.TransientObjects.CreateEdgeCollection

    Dim oEdge As Edge
    For Each oEdge In oFrontFace.Edges
        Call oEdgeCollection.Add(oEdge)
    Next

    Dim oFlangeDefinition As FlangeDefinition
    Set oFlangeDefinition = oSheetMetalFeatures.FlangeFeatures.CreateFlangeDefinition(oEdgeCollection, 3.14159 / 2, "2 in")

    ' Set the bend radius value
    oFlangeDefinition.BendRadius = oCompDef.BendRadius.Value * 2

    ' Create a flange feature
    Dim oFlangeFeature As FlangeFeature
    Set oFlangeFeature = oSheetMetalFeatures.FlangeFeatures.Add(oFlangeDefinition)
    
    Dim oCamera As Camera
    Set oCamera = ThisApplication.ActiveView.Camera
    
    oCamera.ViewOrientationType = kIsoTopRightViewOrientation
    oCamera.Apply
    
    ThisApplication.ActiveView.Fit

End Sub

CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 3

piyushjhaveri1
Contributor
Contributor

Thanks - This works well.

 

0 Likes