Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: Anonymous

Here is an image I captured from my computer after I ran that rule on a simple sheet metal part with one bend.

Sheet Metal Bends Count Results.png

 As you can see, the message displayed by my rule reported that there were:

1 Bends

0 BendPartFeatures

0 UnwrapFeatures

2 FlatBendResults

1 Flat Pattern Top Face Bend Edges

1 Flat Pattern Bottom Face Bend Edges

2 Total Flat Pattern Bend Edges

 

This part was started from a 'Face' feature (simple rectangular sketch, which was thickened into a solid plate using the sheet metal Plate tool.  Then I added one 'Flange' at 90 degrees using the sheet metal Flange tool, which automatically adds the bend in there for me, according to the current sheet metal rule.  The other features are just Hole features.  So this detailed inspection of this simple part, should give us some insight into how these types of things are counted.

 

I will now simplify my rule above to only get the 'Bends' count, then write that number to a user parameter named "BendsCount", similarly to what I had commented out at the end of that last code.

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("A Part Document must be active for this rule to work. Exiting.",vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
If Not TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
	MsgBox("This Part is not a Sheet Metal Part.  Exiting rule.",,"")
	Exit Sub
End If
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
Dim oBends As Integer = oSMDef.Bends.Count
MsgBox("This Sheet Metal Part has:  " & oBends & " 'Bends'.", vbInformation, "BendsCount")
Dim oUParams As UserParameters = oSMDef.Parameters.UserParameters
Dim oUParam As UserParameter
Try
	oUParam = oUParams.Item("BendsCount")
	oUParam.Value = oBends
Catch
	oUParam = oUParams.AddByValue("BendsCount", oBends, UnitsTypeEnum.kUnitlessUnits)
End Try

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)