Message 1 of 7
SetBaseQuantity to m^2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
I know this is unsupported but before you write me off please make sure im doing this right. I have it working for EACH and Meter but this gives me an error on the last line.
Private Sub SetUnitsSQMTR()
Dim oApp As Inventor.Application: Set oApp = ThisApplication
Dim oPart As Inventor.PartDocument: Set oPart = oApp.ActiveDocument
'EACH
Dim oBU As BOMQuantity: Set oBU = oPart.ComponentDefinition.BOMQuantity
'Get the document UnitOfMeasure object to facilitate unit conversions
'Dim uom As UnitsOfMeasure: Set uom = oPart.UnitsOfMeasure
'Get the parameter
Dim oParam As Parameter
Set oParam = oPart.ComponentDefinition.Parameters("G_L")
oParam.ExposedAsProperty = True
oParam.Units = "m^2"
oParam.Expression = "0.001 m^2"
'Set the QtyType
Dim oType As BOMQuantityTypeEnum: oType = kParameterBOMQuantity
'set BaseQty
Call oPart.ComponentDefinition.BOMQuantity.SetBaseQuantity(oType, oParam)
End Sub
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
