Heavy Performance Issue When Query MassOverridden

Heavy Performance Issue When Query MassOverridden

c_hoppen
Advocate Advocate
602 Views
8 Replies
Message 1 of 9

Heavy Performance Issue When Query MassOverridden

c_hoppen
Advocate
Advocate

Hello,

I have stumbled across a pretty heavy performance problem. It seems that the query of MassProperties.MassOverridden leads to a recalculation of the mass.

 

Have a large assembly open (around 2,000 files  or more). Run the code below. In my case I have 2381 files open and the code takes about 2 minutes (i9-9900k, 32 GB RAM, SSD)

Sub Main()

Dim assmDoc As AssemblyDocument
Set assmDoc = ThisApplication.ActiveDocument

Dim assmDef As AssemblyComponentDefinition
Set assmDef = assmDoc.ComponentDefinition

Dim massProps As MassProperties
Set massProps = assmDef.MassProperties

Dim isOverridden As Boolean
isOverridden = massProps.MassOverridden

End Sub

 Inventor 2022.3.2 Build 350.

Is this a known issue?

Thanks

Christoph

0 Likes
603 Views
8 Replies
Replies (8)
Message 2 of 9

bradeneuropeArthur
Mentor
Mentor
Sub Main()

Dim assmDoc As AssemblyDocument
assmDoc = ThisApplication.ActiveDocument

Dim assmDef As AssemblyComponentDefinition
assmDef = assmDoc.ComponentDefinition

Dim massProps As MassProperties
massProps = assmDef.MassProperties

massProps.CacheResultsOnCompute = False

Dim isOverridden As Boolean
isOverridden = massProps.MassOverridden

MsgBox (isOverridden)

End Sub

Use this!

"

oMassProps.CacheResultsOnCompute = False

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 9

c_hoppen
Advocate
Advocate
CacheResultsOnCompute = False

doesn't make a difference! Same time consumption!

 

I measured the influence of the two settings on the query time:

choppen_1-1667848338505.png

choppen_0-1667848270607.png

CacheResultsOnCompute = False is faster, but waiting one minute for a "yes or no" ist still unacceptable.

 

0 Likes
Message 4 of 9

bradeneuropeArthur
Mentor
Mentor

Is there any other kind of coding used in your company via i-logic VBA Vb.net etc that runs parallel?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 9

bradeneuropeArthur
Mentor
Mentor

Do you have the option calculate mass for assemblies and parts on save on?
You can find the application options.

bradeneuropeArthur_0-1667853360744.png

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 9

c_hoppen
Advocate
Advocate

@bradeneuropeArthur  schrieb:

Is there any other kind of coding used in your company via i-logic VBA Vb.net etc that runs parallel?


No.

0 Likes
Message 7 of 9

c_hoppen
Advocate
Advocate

@bradeneuropeArthur  schrieb:

Do you have the option calculate mass for assemblies and parts on save on?
You can find the application options.


No, it's Part Only.

 

To make it clear: I don't want to calculate the mass. I just want to know if the mass in the top assembly is overridden. The answer should be a quick "yes or no" and not "let me think about it some minutes".  

0 Likes
Message 8 of 9

bradeneuropeArthur
Mentor
Mentor
I know, but with this option on the mass is already calculated on forehand, which seems to be the issue with your models.
I think that inventor needs first to update the mass before it will know if it is overwritten or not.
The mass properties are a bit special properties which is hard to explain and complex.
Maybe you can first test if this option on is solving your problem, because I personally have no issue with large assemblies and your code.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 9 of 9

c_hoppen
Advocate
Advocate

@bradeneuropeArthur  schrieb:
I know, but with this option on the mass is already calculated on forehand, which seems to be the issue with your models.

I tried it with several other Assemblies having more than 1.000 unique files loaded an the result is always the same.

(with massProps.CacheResultsOnCompute = False)

 

Maybe you can first test if this option on is solving your problem, because I personally have no issue with large assemblies and your code.

What is large to you? 

My first sample is the Express Mode Demo "Osgood" from 2015 (55 sec.)

choppen_0-1668418305349.png

I did a test with the "Material Process Line" Sample having 1263 files and it takes about 23 seconds.

choppen_1-1668418375672.png

Another sample was the "Large Assembly Sample" coming with the Adesk Poket Demos (31 sec.)

choppen_2-1668418712858.png

In contrast to the first example, the last one is faster, because in the first one the geometries are much more complex.

 

For me there is no reason to do any calculation, only to find out if a bool value is true or false.

 

Christoph

 

0 Likes