Hi
I cobbled together a rule for you to look at.
This will create the Parameters and then populate them with the Sheetmetal Extents.
I will leave the BOM formatting up to you.
Note this will not update dynamically, you need additional steps for that.
Dim oPartDoc As PartDocument = ThisDoc.Document
Dim userParams As UserParameters = oPartDoc.ComponentDefinition.Parameters.UserParameters
Dim newParam As UserParameter ' Placeholder
Dim oFormat As CustomPropertyFormat
'LENGTH
Try
oParam = oPartDoc.ComponentDefinition.Parameters("LENGTH")
Catch 'If the parameter was not found, then create a new one.
newParam = userParams.AddByExpression("LENGTH", 0, "mm") ' Create the Parameter as per above
newParam.ExposedAsProperty = True 'Flag for Export
oFormat = newParam.CustomPropertyFormat 'For some reason or other this line is needed to enable the following formatting
oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision 'Set one decimal place
'oFormat.Units="mm" 'Units
oFormat.ShowUnitsString = False
oFormat.ShowLeadingZeros = False
oFormat.ShowTrailingZeros = False
End Try
'WIDTH
Try
oParam = oPartDoc.ComponentDefinition.Parameters("WIDTH")
Catch 'If the parameter was not found, then create a new one.
newParam = userParams.AddByExpression("WIDTH", 0, "mm") ' Create the Parameter as per above
newParam.ExposedAsProperty = True 'Flag for Export
oFormat = newParam.CustomPropertyFormat 'For some reason or other this line is needed to enable the following formatting
oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision 'Set one decimal place
'oFormat.Units="mm" 'Units
oFormat.ShowUnitsString = False
oFormat.ShowLeadingZeros = False
oFormat.ShowTrailingZeros = False
End Try
'THICK
Try
oParam = oPartDoc.ComponentDefinition.Parameters("THICK")
Catch 'If the parameter was not found, then create a new one.
newParam = userParams.AddByExpression("THICK", 0, "mm") ' Create the Parameter as per above
newParam.ExposedAsProperty = True 'Flag for Export
oFormat = newParam.CustomPropertyFormat 'For some reason or other this line is needed to enable the following formatting
oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision 'Set one decimal place
'oFormat.Units="mm" 'Units
oFormat.ShowUnitsString = False
oFormat.ShowLeadingZeros = False
oFormat.ShowTrailingZeros = False
End Try
'---------------------------------
Dim oPart As PartDocument
oPart = ThisApplication.ActiveDocument
oDoc = ThisApplication.ActiveDocument
'Turn off work features so they don't calculate
oPart.ObjectVisibility.AllWorkFeatures = False
InventorVb.DocumentUpdate()
'
Dim sizes As New List(Of Double)
'
sizes.Add(SheetMetal.FlatExtentsLength)
sizes.Add(SheetMetal.FlatExtentsWidth)
sizes.Sort()
Parameter("LENGTH") = sizes(1)
Parameter("WIDTH") = sizes(0)
Parameter("THICK") = "Thickness"
iLogicVb.UpdateWhenDone = True
'Turn back on work features - optional
oPart.ObjectVisibility.AllWorkFeatures = True
Reg
2026.1