Can someone provide a snippet on how to reverse the direction of an existing sheet metal edge flange? Any format is fine (VB, VBA, C#)
Hi Rick and Peter,
Use the ReverseOffset method. Here's a quick VBA example of the process with an edge flange named "Edge-Flange1".
Sub Testing() Dim swApp As SldWorks.SldWorks Set swApp = Application.SldWorks Dim Part As PartDoc Dim MyFeature As Feature Dim featureDef As EdgeFlangeFeatureData Dim retval As Boolean Dim message As String Set Part = swApp.ActiveDoc Set MyFeature = Part.FeatureByName("Edge-Flange1") Set featureDef = MyFeature.GetDefinition 'rollback to edit the feature retval = featureDef.AccessSelections(Part, Nothing) 'reverse the flange If featureDef.ReverseOffset = True Then featureDef.ReverseOffset = False Else featureDef.ReverseOffset = True End If 'complete the edit operation retval = MyFeature.ModifyDefinition(featureDef, Part, Nothing) 'in case the modification failed If retval = False Then Call featureDef.ReleaseSelectionAccess End IfEnd Sub
Good question, the API help isn't very helpful here as there is no mention of the property Length. There are two sets of offset properties though, OffsetDistance and PositionOffsetDistance. Maybe one of those controls the length and you can times them by -1?
Thank you both for the reply. A quick test and it works! Much appreciated.
Retrieving data ...