iLogic flange

iLogic flange

Anonymous
Not applicable
1,072 Views
2 Replies
Message 1 of 3

iLogic flange

Anonymous
Not applicable

All I want to do i create a flange of a certain height and width from a selected edge and stick a hole in the center of the flange.  That's it.  Is it possible to hotkey an iTrigger to create the flange and hole in one click?

0 Likes
1,073 Views
2 Replies
Replies (2)
Message 2 of 3

HermJan.Otterman
Advisor
Advisor

I think you need at leas two clicks, one to select the edge, the other to activate the command....

 

When you look in the API help, you can find this code (VBA) on how to create a flange.

 

 

 

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

    ' Get the sheet metal component definition.
    Dim smCompDef As SheetMetalComponentDefinition
    Set smCompDef = sheetMetalDoc.ComponentDefinition

    ' Create a sketch on the x-y plane.
    Dim sketch As PlanarSketch
    Set sketch = smCompDef.Sketches.Add(smCompDef.WorkPlanes.Item(3))

    Dim tg As TransientGeometry
    Set tg = ThisApplication.TransientGeometry

    ' Draw a rectangle.
    Call sketch.SketchLines.AddAsTwoPointRectangle(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(25, 15))

    ' Create a profile.
    Dim profile As profile
    Set profile = sketch.Profiles.AddForSolid

    Dim smFeatures As SheetMetalFeatures
    Set smFeatures = smCompDef.Features

    ' Build up a face feature definition.
    Dim faceDef As FaceFeatureDefinition
    Set faceDef = smFeatures.FaceFeatures.CreateFaceFeatureDefinition(profile)

    ' Create a face feature.
    Dim faceFeature As faceFeature
    Set faceFeature = smFeatures.FaceFeatures.Add(faceDef)

    ' Get the "top" face.
    Dim topFace As face
    Set topFace = smCompDef.SurfaceBodies.Item(1).LocateUsingPoint(kFaceObject, tg.CreatePoint(5, 5, smCompDef.Thickness.Value))

    ' Create a collection containing the four edges.
    Dim edgeSet As EdgeCollection
    Set edgeSet = ThisApplication.TransientObjects.CreateEdgeCollection
    Dim i As Integer
    For i = 1 To 4
        Call edgeSet.Add(topFace.Edges.Item(i))
    Next

    ' Create the flange definition.
    Dim flangeDef As FlangeDefinition
    Set flangeDef = smFeatures.FlangeFeatures.CreateFlangeDefinition(edgeSet, "90", 6)

    ' Edit the definition to define a different width extent for each edge.
    For i = 1 To 4
        Dim faceEdge As Edge
        Set faceEdge = edgeSet.Item(i)
        Select Case i
            Case 1
                ' Do nothing and let it default to the edge extent.
            Case 2
                ' Edit the width extent to be centered.
                Call flangeDef.SetCenteredWidthExtent(faceEdge, 10)
            Case 3
                ' Edit the width extent to be offset as measured from the vertices of the edge.
                Call flangeDef.SetOffsetWidthExtent(faceEdge, faceEdge.StartVertex, 2, faceEdge.StopVertex, 5)
            Case 4
                ' Edit the width extent to be an offset width extent.
                Call flangeDef.SetWidthOffsetWidthExtent(faceEdge, 6, 2, faceEdge.StartVertex, True)
        End Select
    Next

    ' Create the flange.
    Call smFeatures.FlangeFeatures.Add(flangeDef)
End Sub

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


Message 3 of 3

Anonymous
Not applicable

I should be able to fumble through that to get what I need.  It looks like the code creates a part and face and then cycles through one side of each edge to create the three different types of flanges?  What I don't see is how to store a user selected edge for editing.

As a result of some searching, I found the code:

    Dim selEdge As Edge 
    selEdge = ThisApplication.CommandManager.Pick(kPartEdgeFilter, "Select edge.")

That should be what I need to pair the two.  I'll post the code when I get a minute to write it.

 

Is there any chance someone could post a help code for creating a sheet metal hole?  I don't have any access to the api help.  If only I could install a free version of VS on my workstation....

 

 

0 Likes