Looking for fillet on sheet metal

Looking for fillet on sheet metal

Anonymous
Not applicable
1,428 Views
11 Replies
Message 1 of 12

Looking for fillet on sheet metal

Anonymous
Not applicable

Hi all

We are using a lot of sheet metal parts.

We always create 1/32" minimum fillet everywhere to ease the laser path.

 

I would like to have a macro wich can look up for any edge egal to thickness that has no fillet, and create them (or display error message).

 

Is there someone who can help?

 

Thanks

0 Likes
Accepted solutions (2)
1,429 Views
11 Replies
Replies (11)
Message 2 of 12

bshbsh
Collaborator
Collaborator
Accepted solution

VBA:

Public Sub Fillet()
    Dim InvDoc As PartDocument
    Set InvDoc = ThisApplication.ActiveDocument
    Dim EC As EdgeCollection
    Set EC = ThisApplication.TransientObjects.CreateEdgeCollection
    For Each SurfaceBody In InvDoc.ComponentDefinition.SurfaceBodies
        For Each Edge In SurfaceBody.Edges
            EC.Add Edge
        Next
    Next
    Dim CRD As CornerRoundDefinition
    Dim Radius As Double
    Radius = 1 / 32
    Radius = InvDoc.UnitsOfMeasure.ConvertUnits(Radius, kInchLengthUnits, kCentimeterLengthUnits)
    Set CRD = InvDoc.ComponentDefinition.Features.CornerRoundFeatures.CreateCornerRoundDefinition(EC, Radius)
    Dim CRF As CornerRoundFeature
    Set CRF = InvDoc.ComponentDefinition.Features.CornerRoundFeatures.Add(CRD)
End Sub
0 Likes
Message 3 of 12

Anonymous
Not applicable
Wonderfull
Thank you very much Bshbsh.
0 Likes
Message 4 of 12

Anonymous
Not applicable

Hello Bshbsh

 

Your VBA macro is nice but can it be possible to also check for the edges in corner like the one on the image?

 

Thanks again

 

 

0 Likes
Message 5 of 12

Anonymous
Not applicable
Sorry Bshbsh, I forgot to give you a part of info.
Can it be possible to look for edge whitout radius into the flat pattern??

Thanks
0 Likes
Message 6 of 12

bshbsh
Collaborator
Collaborator
Accepted solution

The macro doesn't check anything, it just selects all edges for fillet. Inventor then tries to fillet the selected edges and it silently ignores edges that are impossible to fillet. Your example is such an impossible one. Try to put a Corner Fillet on it by hand and you'll see.

It is possible to fillet these edges after if you unfold the model first, then run the fillet macro, then refold, but it will fail because of that edge.

The only way to put a fillet on that edge if you put it directly onto the unfolded flat pattern that is used for the laser cutting too, but those fillets will only be visible in your flat pattern, and not in the folded model.

Or you could just make those corner reliefs slightly larger to be able to fillet them.

 

Here's a modified version of the macro. It can put the fillets on the flat pattern too. Run the macro on the folded model first, then go to the flat pattern and run it again.

Public Sub Fillet()
    Dim InvDoc As PartDocument
    Set InvDoc = ThisApplication.ActiveDocument
    Dim CD As Object
    If InvDoc.ActivatedObject Is Nothing Then
        Set CD = InvDoc.ComponentDefinition
    Else
        If InvDoc.ActivatedObject.Type = kFlatPatternObject Then
            Set CD = InvDoc.ActivatedObject
        End If
    End If
    Dim EC As EdgeCollection
    Set EC = ThisApplication.TransientObjects.CreateEdgeCollection
    For Each SurfaceBody In CD.SurfaceBodies
        For Each Edge In SurfaceBody.Edges
            EC.Add Edge
        Next
    Next
    Dim CRD As CornerRoundDefinition
    Dim Radius As Double
    Radius = 1 / 32
    Radius = InvDoc.UnitsOfMeasure.ConvertUnits(Radius, kInchLengthUnits, kCentimeterLengthUnits)
    Set CRD = CD.Features.CornerRoundFeatures.CreateCornerRoundDefinition(EC, Radius)
    Dim CRF As CornerRoundFeature
    Set CRF = CD.Features.CornerRoundFeatures.Add(CRD)
End Sub
0 Likes
Message 7 of 12

Anonymous
Not applicable

Thank you very much Bshbsh.
This is good.
I think I will check to add some lines for the macro to triger itself 2 times, with a "Flat pattern" command and a "Go to folded part" command before "save" command.

😉

0 Likes
Message 8 of 12

fredform
Advocate
Advocate

I realize this is a very old thread but I found this post and thought the suggested solution was very useful.

 

When I first found out you could apply a Corner Round using a feature as input I was very happy because I assumed it would be "parametrically" linked, where any updates/changes to the body/feature would also be reflected in the Corner Round feature being updated. Unfortunately this is not the case as it is simply a way to select all possible edges in an quick manner.

 

So, is there a way to modify this script so that it edits an existing Corner Round feature rather than creating a new one? I tried to change it but never got it working:

Dim partDoc As PartDocument = ThisDoc.Document
Dim partDef As SheetMetalComponentDefinition = partDoc.ComponentDefinition

Dim body As SurfaceBody = partDef.SurfaceBodies.Item(1) 
Dim edgeSet As EdgeCollection = ThisApplication.TransientObjects.CreateEdgeCollection
For Each Edge As Edge In body.Edges
	edgeSet.Add(Edge)
Next

Dim SMF As SheetMetalFeatures = partDef.Features
Dim CRD As CornerRoundDefinition = SMF.CornerRoundFeatures.CreateCornerRoundDefinition(edgeSet, 1)

' Move EndOfPart above feature before making changes
Dim feat1 As Inventor.ThickenFeature = partDef.Features.ThickenFeatures.Item("Thicken1")
feat1.SetEndOfPart(False)

Dim CRF As CornerRoundFeature = SMF.CornerRoundFeatures.Item("Corner Round1")
'CRF.Definition.RemoveEdgeSet(1)
CRF.Definition.AddEdgeSet(CRF, 1)

partDef.Features.Item(partDef.Features.Count).SetEndOfPart(False)

 

 

Best regards,

Fredrik

0 Likes
Message 9 of 12

bshbsh
Collaborator
Collaborator

I don't really understand what you are trying to do here. Do you just want to edit the radius of one radius set? Or add edges to it?

0 Likes
Message 10 of 12

fredform
Advocate
Advocate

Hi bshbsh,

 

I want to add edges to it. If the geometry has changed and new edges created I want them to be added to the existing Corner Round feature (without creating a new feature).

 

/Fredrik

0 Likes
Message 11 of 12

bshbsh
Collaborator
Collaborator

but a part can have multiple fillets, each with multiple feature sets with different radii. how would the macro know, to which one would you like to add what? or is yours a special case where there is only ever one fillet with one set of radii, at the end of the part?

0 Likes
Message 12 of 12

fredform
Advocate
Advocate

Well, I defined the feature to reference as:

Dim CRF As CornerRoundFeature = SMF.CornerRoundFeatures.Item("Corner Round1")

If I could add the edge set to it, as defined by the CornerRoundDefinition (CRD variable) everything would be good but it errors out for some reason. I tried clearing the edge set as well but it made no difference.

0 Likes