How to edit Variable Fillet with SolidWorks API

79 Views Asked by At

I'm wondering how I go about editing a Variable fillet using the solidworks API. In short, I'm updating a multi-body part which contains several variable fillets that break when a base feature is updated. (The edge is no longer present and goes missing in the feature)

This is the code that I have:

Dim swSelMgr As SelectionMgr = swModel.SelectionManager

Dim status = swModel.Extension.SelectByID2(featureName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)

Dim swFeat As Feature = swSelMgr.GetSelectedObject6(1, -1)
Dim featData As VariableFilletFeatureData2 = swFeat.GetDefinition
swModel.ClearSelection2(True)

Dim startVert As Vertex = filletEdge.GetStartVertex()
Dim endVert As Vertex = filletEdge.GetEndVertex()
Dim R1 = radii(0)
Dim R2 = radii(1)

status = featData.AccessSelections(swModel, Nothing)

featData.AsymmetricFillet = False
featData.ConicTypeForCrossSectionProfile = swFeatureFilletProfileType_e.swFeatureFilletCircular
featData.SetConicRhoOrRadius(filletEdge, R1)
featData.SetRadius(startVert, R2)
featData.SetRadius(endVert, R1)

Try
    status = swFeat.ModifyDefinition(featData, swModel, Nothing)
Catch ex As Exception
    status = False
End Try

Yet the final status returns False. radii(0) is 0.00314 and radii(1) is 0.00164. I can put everything in manually via the UI and it applies just fine. I've never worked with variable fillets through the API so I'm not entirely sure what I'm doing, just taking shots in the dark. I do know that its a symmetric fillet, with a circular profile. Any help would be greatly appreciated. Thanks!

0

There are 0 best solutions below