So I am getting closer and hoping someone more knowledgeable at coding than me could help out.
This code works as intended. The problem is that I don't want to have to type out all of the possible features.
doc = ThisApplication.ActiveDocument
Dim oSMCompDef As SheetMetalComponentDefinition
oSMCompDef = doc.ComponentDefinition
Dim oSMFeature As SheetMetalFeatures = oSMCompDef.Features
Dim oFaceFeature As FaceFeature
For Each oFaceFeature In oSMFeature.FaceFeatures
If oFaceFeature.Definition.UseDefaultSheetMetalRule = False Then
' MessageBox.Show(oFaceFeature.Name & " Found", oFaceFeature.Name & " Info")
oFaceFeature.Definition.UseDefaultSheetMetalRule = True
' MessageBox.Show("Default Sheet Metal Rule wasn't used. Set to Default", "Face Feature Info")
End If
Next
Dim oContFlgFeature As ContourFlangeFeature
For Each oContFlgFeature In oSMFeature.ContourFlangeFeatures
If oContFlgFeature.Definition.UseDefaultSheetMetalRule = False Then
' MessageBox.Show(oContFlgFeature.Name & " Found", oContFlgFeature.Name & " Info")
oContFlgFeature.Definition.UseDefaultSheetMetalRule = True
' MessageBox.Show("Default Sheet Metal Rule wasn't used. Set to Default", "Feature Info")
Else
' MessageBox.Show("Default Sheet Metal Rule Already In Use.", "Feature Info")
End If
Next
Dim oContRollFeature As ContourRollFeature
For Each oContRollFeature In oSMFeature.ContourRollFeatures
If oContRollFeature.Definition.UseDefaultSheetMetalRule = False Then
' MessageBox.Show(oContRollFeature.Name & " Found", oContRollFeature.Name & " Info")
oContRollFeature.Definition.UseDefaultSheetMetalRule = True
' MessageBox.Show("Default Sheet Metal Rule wasn't used. Set to Default", "Feature Info")
Else
' MessageBox.Show("Default Sheet Metal Rule Already In Use.", "Feature Info")
End If
Next
I tried this bit of code to see if I could just pass thru "oCase" and "oFeatureType". As text in a Message Box, it works great.
Dim oFeature As PartFeature' SheetMetalFeatures' = oSMCompDef.Features
For Each oFeature In oSMCompDef.Features
Dim oCase As String
oCase = oFeature.Type.ToString
MessageBox.Show("Feature Type: " & oCase, "Feature Type Info") 'oFeature.Type.ToString, "Feature Type Info")
Dim oFeatureType As String
oFeatureType = oFeature.Type.ToString.TrimStart("k").Replace("Object","")
MessageBox.Show("Feature Type Modified: " & oFeatureType, "Feature Type Info")
Passing it thru to a Select Case doesn't work so well though.
Select Case oFeature.Type
Case oCase
MessageBox.Show(oCase & " Found", oCase & " Info")
Dim oCaseFeature As ObjectCollection
oCaseFeature = oFeature
For Each oCaseFeature In oSMCompDef.Features
If oCaseFeature.Definition.UseDefaultSheetMetalRule = False Then
MessageBox.Show(oCaseFeature.Name & " Found", oCaseFeature.Name & " Info")
oCaseFeature.Definition.UseDefaultSheetMetalRule = True
MessageBox.Show("Default Sheet Metal Rule wasn't used. Set to Default", "Feature Info")
Else
MessageBox.Show("Default Sheet Metal Rule Already In Use.", "Feature Info")
End If
Next
For a little more context, I was trying to use a similar idea to this link, without all of the debug.print;
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-DBFECEA9-4801-477F-950C-C2CF56320CE9
And the code is message 4 from this link;
https://forums.autodesk.com/t5/inventor-programming-ilogic/default-sheetmetal-rules-on-body/td-p/102...
Again, any and all help is greatly appreciated.
Thank you