Hello,
I'm updating the "Units" of a document but the "Unit Quantity" doesn't update.
pic01- With a vba macro I change the linear Dim Display Precision using
"oObject.UnitsOfMeasure.LengthDisplayPrecision = 1" then update the part
"oObject.Update". I've tried with oObject.Update2 (true) but the result is the same.
pic02- the Unit Quantity format doesn't get updated.
pic03- When I change manually the units and re-open the document the update is finally done.
How can I reach this result with vba? thanks
Any help would be greatly appreciated!
pic1
Hi! I was able to reproduce your observation with the code below. I also tried to update the precision using an "Update" method, however it did not work.
Sub Main() 'Get the drawing. Assume a part is open. Dim part As Inventor.PartDocument = ThisDoc.Document 'Show old unit quantity value MessageBox.Show("Old Precision: " & part.UnitsOfMeasure.LengthDisplayPrecision & vbNewLine & _ "Old Unit Quantity: " & part.ComponentDefinition.BOMQuantity.UnitQuantity) 'Update display precision part.UnitsOfMeasure.LengthDisplayPrecision = 3 'Show the unit quantity again to see if value changed MessageBox.Show("New Precision: " & part.UnitsOfMeasure.LengthDisplayPrecision & vbNewLine & _ "Old Unit Quantity: " & part.ComponentDefinition.BOMQuantity.UnitQuantity) End Sub
I also noticed that the "Base Quantity" property shows the updated display precision (See image below). And I was able to manually update it by selecting another parameter and then re-selecting the right parameter. I haven't tested it, but maybe using the "SetBaseQuantity" method to be another parameter and changing it back would trigger the update of the display precision. Hope this helps someone to figure this out!
Can't find what you're looking for? Ask the community or share your knowledge.