How can I find if Mass Properties have been Overridden

Use this space to ask how to do whatever you're trying to use SolidWorks to do.
User avatar
loeb
Posts: 68
Joined: Sun Jan 16, 2022 5:55 pm
Answers: 1
x 39
x 10

How can I find if Mass Properties have been Overridden

Unread post by loeb »

I have some assemblies and discovered that someone, a long time ago, overrode the mass properties of some of the parts. Other than going through every part and checking if the mass props have been overridden in every configuration, is there an easy way to identify them?
ryan-feeley
Posts: 82
Joined: Thu Jan 20, 2022 3:35 pm
Answers: 1
x 31
x 91

Re: How can I find if Mass Properties have been Overridden

Unread post by ryan-feeley »

I'm sure there's an API solution that loops through all your models... But short of that, if you only care about parts that are used in assemblies, if you look at the "Mass Properties" of each top-level assembly, there is a note at the bottom that indicates if any part within the assembly hierarchy is overridden.

Here is the relevant section from the Swx on-line help:
mass-properties-dialog-box.png
I looked at one of my assemblies, which I know has some aspects overridden, and I see this at the bottom of that dialog box. Of course, as you pointed out, mass properties can be overridden on a per-configuration basis, so just looking at the assemblies is very incomplete. But it may be enough to catch anything important.

```
One or more components have overridden mass properties:
10130 - PCB Assy@10128 - Loaded PCB Assy@10123 - Pivoting Elements Assy
10228 - Bare Cable<Default>@10121 - Cable Assy, 8cond, 1.25mm PicoBlade, Custom Anchor<Default>
```
User avatar
gupta9665
Posts: 411
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 434
x 450

Re: How can I find if Mass Properties have been Overridden

Unread post by gupta9665 »

For single file (active config), you can use following codes. The codes can be further modified to traverse each component's configurations and create a report with the components name and their configurations in which mass is overridden.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim MassProp As SldWorks.MassProperty

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set MassProp = swModel.Extension.CreateMassProperty

If MassProp.OverrideMass Then
MsgBox "Mass Properties are overridden!!"
End If
End Sub
Deepak Gupta
SOLIDWORKS Consultant/Blogger
Post Reply