Hi @valdas_kulikajevasYW7SV. Sure. I usually include something like that, but did not know what your preference was, or what units you may be using. Find the 'For...Next' loop in the code, which contains the following line:
oSizes.Item(i) = UOM.ConvertUnits(oSizes.Item(i), UnitsTypeEnum.kDatabaseLengthUnits, UOM.LengthUnits)
...then insert this line of code right under that line of code, but still within that loop (before the 'Next' keyword).
oSizes.Item(i) = Math.Ceiling(oSizes.Item(i) / 0.1) * 0.1
That will round the value up to the next increment of .1, by dividing the value by that increment amount, then rounding that result up to the next whole number, then multiplying that result by the increment amount again. I am also assuming that your document units are millimeters, because the 'database' units for distance in Inventor are centimeters, so most distances you get from Inventor objects by code will be in centimeters, instead of document units (if they are different). Also most raw numerical values you put into a code window, that are supposed to represent a distance, will be automatically understood as being a value in centimeters. Just something to keep in mind. When simply converting from centimeters to millimeters, some simple math can be used, instead of a units conversion Function, but some folks deal with many different types of units, in which case the simple math would not always work.
Also, if there are things like WorkPoints, WorkAxis, WorkPlanes turned on within your model files, or within the assembly, for the component origin work features, that might effect the accuracy of these 'bounding box' measurement type codes. So, you may need to turn all of that type of stuff off before taking these measurements, to get more accurate results. I do not know if using the ComponentOccurrence.OrientedMinimumRangeBox property would do anything to avoid those types of things, because there is very little documentation being shown on its online help web page.
Wesley Crihfield

(Not an Autodesk Employee)