Dynamic centre of gravity display

Hello @ all and @ all

When I ask for the center of gravity of a set, it displays well and I can see with the mass properties the XYZ coordinates.

As assembly is a complicated kinematic, I would like the coordinates to be displayed permanently.
Today I created a sketch that gives me these coordinates, the only problem is that I can't see it all the time.
a) you have to rebuild so that the new coordinates are displayed, then open the sketch to have the numbers (or property of the CM)

With the inventor of 12 years ago (long before the CM existed in SW) the dimensions appeared dynamically on the screen (like a scrolling counter).

I couldn't find anything in the online or on the net help for SW.

I can't find how to put sensors (to see if it's the solution)
https://help.solidworks.com/2020/french/SolidWorks/sldworks/t_Sensors_Creating.htm?id=6e0144124e75446da1e3a5334703b005#Pg0

Do you have a trick or macro that could do that.

Kind regards

1 Like

Good evening @Zozo_mp ,

The attached macro offers the display of the coordinates of the CdG of an assembly automatically, after a movement of one or more components, in response to an event of type " swAssemblyComponentMoveNotify2 " (phew...) sent by SolidWorks.

image

Before determining the position of the CdG, SolidWorks must necessarily rebuild the assembly to update its geometry. Given this delay, the display of the modified coordinates cannot be done continuously as the movement progresses, it is only possible when the movement is complete.

For the same reason, the possibility of taking into account other events (change of a dimension, a constraint, etc.) has been excluded, due to successive and rapidly unbearable downtimes.
The " Calculate " button on the right side of the window offers the user the means to recalculate the CoG at any time of their choice.

Kind regards.

CenterDeGravite.swp (98.5 KB)

7 Likes

Thank you @m.blt

I look and keep you informed of the result.
Even if I have to click calculate, this will go faster than Ctrl B "rebuild" + Ctrl M (mass properties display) + Esc to get back on the screen.

There is no change of side, only a rotation with parts that move during the rotation and therefore change the position of the CM

Kind regards

1 Like

Oops!
Can you tell me in which folder to put the SWP so that it is visible and usable in SW

Thank you

1 Like

Good evening

The macro record doesn't matter...
The most practical is a personal folder in which to store macros to find them easily.

In use, the important thing is to be able to activate it from SolidWorks by associating it with a button placed in the macro toolbar (or any other toolbar).
Customizable button for immediate recognition (see video).

4 Likes

Thank you @m.blt

Excellent answer! It works perfectly even if it lags a little :wink:

Kind regards