Fillet Feature on Edge from 3D Modell.

Fillet Feature on Edge from 3D Modell.

florian_wenzel
Advocate Advocate
669 Views
3 Replies
Message 1 of 4

Fillet Feature on Edge from 3D Modell.

florian_wenzel
Advocate
Advocate

Hi,

Inventor and Visual Studio

 

I try to make a Fillet Feature on a Edge of 3D Modell.

I was creating a Pocket in a 3D Model (simple Extrude with Cut Operation with kNegativeExtentDirection )

Now i try to make a Fillet on the EndFace of the Extrude Object.

 

 

The Final Result should look like This:

florianwenzelEJNZZ_0-1649069470250.png

 

I want to choose or select with Scripting those Edges.

 

florianwenzelEJNZZ_1-1649069470265.png

 

 

I was looking for information about the Position or number of: Points, Edges, Faces

But i was finde nothing.

 

Is this Posistion of Edges like in the Foto below?

 

florianwenzelEJNZZ_2-1649069470276.png

 

 

 

This is my Code:

 

Imports System.Runtime.InteropServices

Imports Inventor

Imports Microsoft.Win32

 

 

Module CommandFunctionButton_01

    Public Sub CommandFunctionfweButton_01()

 

        Dim oPartDoc As PartDocument = g_inventorApplication.ActiveDocument

        Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition

        Dim oTO As TransientObjects = g_inventorApplication.TransientObjects

        Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry

 

 

 

        Dim oWorkPoint1 As Vertex

        oWorkPoint1 = g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Pick a Points1")

 

        Dim oWorkPoint2 As Vertex

        oWorkPoint2 = g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Pick a Points2")

 

        Dim oWorkPoint3 As Vertex

        oWorkPoint3 = g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Pick a Points3")

 

 

        Dim oWorkPlaneA1 As WorkPlane

        oWorkPlaneA1 = oCompDef.WorkPlanes.AddByThreePoints(oWorkPoint1, oWorkPoint2, oWorkPoint3, False)

 

        Dim oWorkSketch As PlanarSketch = oCompDef.Sketches.Add(oWorkPlaneA1, False)

 

        Dim oRectangleLines As SketchEntitiesEnumerator

        oRectangleLines = oWorkSketch.SketchLines.AddAsTwoPointRectangle(oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(2.5, 1))

 

        Dim oProfile As Profile

        oProfile = oWorkSketch.Profiles.AddForSolid

 

        Dim oExtrudeDef As ExtrudeDefinition

        oExtrudeDef = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, PartFeatureOperationEnum.kCutOperation)

        Call oExtrudeDef.SetDistanceExtent(1, PartFeatureExtentDirectionEnum.kNegativeExtentDirection)

        Dim oExtrude1 As ExtrudeFeature

        oExtrude1 = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)

 

        Dim oEdges As Edge

 

 

        oEdges = oExtrude1.EndFaces.Item(10)

 

        Dim oFillet As FilletFeature

        oFillet = oCompDef.Features.FilletFeatures.AddSimple(oEdges, 1)

 

 

    End Sub

End Module

 

florianwenzelEJNZZ_3-1649069470284.png

 

 

 

I get a Error.

This Code works Fine until Extrude the Pocket.

Then it crash.

 

It is Possible to Select the Edges with a Number?

Thanks for any Suggestion.

0 Likes
Accepted solutions (2)
670 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

The Face.Edges object is an EdgeCollection, you declare it as Edge. Try to declare as Edges or use only one of the edges in this collection.

 

Dim oEdges As Edges
oEdges = oExtrude1.EndFaces.Item(1).Edges

Dim oEdgeColl as ObjectCollection
oEdgeColl=g_inventorApplication.TransientObjects.CreateObjectCollection

Dim oEdge As Edge
For Each oEdge in oEdges
   'Do some tests to get the desired edge(s)
   'If oEdge .... Then
       oEdgeColl.Add(oEdge)
   'End If
Next

   

 

Further I think there are not 10 EndFaces in your Extrusion. In your picture I see only one. The other three faces should be SideFaces. Do you extrude from the WorkPlane?

You can select the Edges by let the user pick it. Or you must find rules to identify them. For instance:

- Edge must be between EndFace and SideFace and

- Edge must have length of x (maybe a parameter value of the sketch profile used for extrusion?)

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 4

florian_wenzel
Advocate
Advocate

Hi,

 

Yeah, i will try to make some filter, to select the  Edges.

As you say,  maybe with the lenght criterium etc...

 

I Extrude from Created WorkPlaneA1, that was Created by .WorkPlanes.AddByThreePoints.

I'm not sure if, when i make a Pocket with extrude with CutOperation, that when i write Command EndFace, than take a EndFace of a Base Origin Model?

Is Tricky 🙂

 

Thank You.

0 Likes
Message 4 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

I made just a simple model imitating yours. The base model is made with Extrusion1. Then I create a WorkPlane and added a Sketch with a rectangle on it. The height of the rectangle is defined by a numeric user parameter "PocketHeight". The pocket is made with Extrusion2. Al this is made manual for this example.

 

PocketHeight.jpg

 

And here's the code (VBA) creating the fillets:

Option Explicit

Private Sub Fillet()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

'the extrude feature creating the pocket
Dim oExtrudeFeature As ExtrudeFeature
Set oExtrudeFeature = oDoc.ComponentDefinition.Features.ExtrudeFeatures.Item(2)

'the end face of the pocket, assuming there'S only one
Dim oFace As Face
Set oFace = oExtrudeFeature.EndFaces.Item(1)

'get the pocket height (defined as fx-Paramter)
Dim oParam As Parameter
Dim dPocketHeight As Double
For Each oParam In oDoc.ComponentDefinition.Parameters.UserParameters
    If oParam.Name = "PocketHeight" Then
        dPocketHeight = oParam.Value
    End If
Next

If dPocketHeight = 0 Then
    MsgBox ("Parameter 'PocketHeight' not found. Abort")
    Exit Sub
End If
    
'collect all edges of length "PocketHeight" in an EdgeCollection
Dim oEdgeColl As EdgeCollection
Set oEdgeColl = ThisApplication.TransientObjects.CreateEdgeCollection

Dim dMinParam As Double
Dim dMaxParam As Double
Dim dLength As Double
Dim oEdge As Edge

For Each oEdge In oFace.Edges
    Call oEdge.Evaluator.GetParamExtents(dMinParam, dMaxParam)
    Call oEdge.Evaluator.GetLengthAtParam(dMinParam, dMaxParam, dLength)
    
    If Round(dLength, 15) = dPocketHeight Then
        Call oEdgeColl.Add(oEdge)
    End If
Next

'create the fillet
Dim oFilletFeature As FilletFeature
Set oFilletFeature = oDoc.ComponentDefinition.Features.FilletFeatures.AddSimple(oEdgeColl, 0.5, , , False)

End Sub

R. Krieg
RKW Solutions
www.rkw-solutions.com