Define Assembly Axis coincident with Center Of Mass
Define Assembly Axis coincident with Center Of Mass
I'm looking to create a pivot point at exactly the Assembly COM.
So far I have achieved this by creating a COM feature in the assembly and then creating an assembly sketch with a single sketch point that I drag coincident to the COM point then using this point and a Plane to define the Axis.
This works but the sketch point does not update when the COM moves.
To get an update I have to delete the sketch point coincident relation and reapply it, which is insanely tedious.
Is there a nicer way to do this? Seems like there should be.
So far I have achieved this by creating a COM feature in the assembly and then creating an assembly sketch with a single sketch point that I drag coincident to the COM point then using this point and a Plane to define the Axis.
This works but the sketch point does not update when the COM moves.
To get an update I have to delete the sketch point coincident relation and reapply it, which is insanely tedious.
Is there a nicer way to do this? Seems like there should be.
- mattpeneguy
- Posts: 1386
- Joined: Tue Mar 09, 2021 11:14 am
- x 2489
- x 1899
Re: Define Assembly Axis coincident with Center Of Mass
I just put a center of mass in an assembly yesterday. I hardly ever use it, but what you are asking should work.Rob wrote: ↑Thu Oct 28, 2021 8:07 am I'm looking to create a pivot point at exactly the Assembly COM.
So far I have achieved this by creating a COM feature in the assembly and then creating an assembly sketch with a single sketch point that I drag coincident to the COM point then using this point and a Plane to define the Axis.
This works but the sketch point does not update when the COM moves.
To get an update I have to delete the sketch point coincident relation and reapply it, which is insanely tedious.
Is there a nicer way to do this? Seems like there should be.
Just tried selecting the COM and a sketch point and yep, I can't make a relation. I get it this may be intentional, as I can see some horrible circular reference scenarios, but when's that ever stopped SW? SW's motto should be "always giving the users enough rope to hang themselves".
Hey @gupta9665, it appears the COM is accessible in the API, but I'm guessing it won't update and any macro you made assigning the axis to the COM via macro would require re-running the macro? Maybe this could be handled by a Macro feature that would update with each rebuild?
http://help.solidworks.com/2012/English ... ple_vb.htm
- Glenn Schroeder
- Posts: 1520
- Joined: Mon Mar 08, 2021 11:43 am
- Location: southeast Texas
- x 1758
- x 2129
Re: Define Assembly Axis coincident with Center Of Mass
I tried it. It wouldn't let me apply a relation by Ctrl+ selecting the sketch point (or end point of a line) and the CoM, but it would let me drag it to the CoM and apply a relation that way. I moved a component, which of course caused the CoM to move. The sketch point did not move with it, even after a Ctrl+Q rebuild. I opened the sketch, and it showed the Coincident relation, but it still didn't update.mattpeneguy wrote: ↑Thu Oct 28, 2021 8:29 am I just put a center of mass in an assembly yesterday. I hardly ever use it, but what you are asking should work.
Just tried selecting the COM and a sketch point and yep, I can't make a relation. I get it this may be intentional, as I can see some horrible circular reference scenarios, but when's that ever stopped SW? SW's motto should be "always giving the users enough rope to hang themselves".
Hey @gupta9665, it appears the COM is accessible in the API, but I'm guessing it won't update and any macro you made assigning the axis to the COM via macro would require re-running the macro? Maybe this could be handled by a Macro feature that would update with each rebuild?
http://help.solidworks.com/2012/English ... ple_vb.htm
"On the days when I keep my gratitude higher than my expectations, well, I have really good days."
Ray Wylie Hubbard in his song "Mother Blues"
Ray Wylie Hubbard in his song "Mother Blues"
Re: Define Assembly Axis coincident with Center Of Mass
Thanks Mattmattpeneguy wrote: ↑Thu Oct 28, 2021 8:29 am I just put a center of mass in an assembly yesterday. I hardly ever use it, but what you are asking should work.
Just tried selecting the COM and a sketch point and yep, I can't make a relation. I get it this may be intentional, as I can see some horrible circular reference scenarios, but when's that ever stopped SW? SW's motto should be "always giving the users enough rope to hang themselves".
Hey @gupta9665, it appears the COM is accessible in the API, but I'm guessing it won't update and any macro you made assigning the axis to the COM via macro would require re-running the macro? Maybe this could be handled by a Macro feature that would update with each rebuild?
http://help.solidworks.com/2012/English ... ple_vb.htm
I was hunting the correct API calls unsuccessfully but you showed me the way..
I ended up creating two planes to define the axis and then update the plane offsets based on the current COM.
It's a hack for sure but its working..
Code: Select all
Option Explicit
Dim swApp As SldWorks.SldWorks
Sub main()
Set swApp = Application.SldWorks
Dim swModel As SldWorks.ModelDoc2
Set swModel = swApp.ActiveDoc
Dim swMassProperty As SldWorks.MassProperty
Set swMassProperty = swModel.Extension.CreateMassProperty
Dim vComPts As Variant
vComPts = swMassProperty.CenterOfMass
Debug.Print vComPts(0), vComPts(1), vComPts(2)
Dim swDimension As SldWorks.Dimension
Set swDimension = swModel.Parameter("D1@COMPlaneXZ")
swDimension.SystemValue = Abs(vComPts(1))
Set swDimension = swModel.Parameter("D1@COMPlaneYZ")
swDimension.SystemValue = Abs(vComPts(0))
swModel.EditRebuild3
End Sub
Re: Define Assembly Axis coincident with Center Of Mass
I could be clever and say Catia as this will do exactly what you want
What you can try is:
Create COM
Then create 3 global variables which you can assign the values in XYZ of COM (make sure you set to automatically rebuild)
Create 3 planes paralel to Front, top, Right and link to the 3 global variables.
Create point of intersection of these 3 planes.
If the COM changes this will update the global variables which in turn updates the planes and then the point.
What you can try is:
Create COM
Then create 3 global variables which you can assign the values in XYZ of COM (make sure you set to automatically rebuild)
Create 3 planes paralel to Front, top, Right and link to the 3 global variables.
Create point of intersection of these 3 planes.
If the COM changes this will update the global variables which in turn updates the planes and then the point.
Re: Define Assembly Axis coincident with Center Of Mass
That should be SW motto.
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
Re: Define Assembly Axis coincident with Center Of Mass
Perfect Graham!!GrahamK wrote: ↑Thu Oct 28, 2021 10:02 am I could be clever and say Catia as this will do exactly what you want
What you can try is:
Create COM
Then create 3 global variables which you can assign the values in XYZ of COM (make sure you set to automatically rebuild)
Create 3 planes paralel to Front, top, Right and link to the 3 global variables.
Create point of intersection of these 3 planes.
If the COM changes this will update the global variables which in turn updates the planes and then the point.
This is basically what my macro did but via equations!
SW warns about a potential circular ref, but that's fair enough
Re: Define Assembly Axis coincident with Center Of Mass
Another way is to create massless part that you can mate to the cg. Then you can mate to that object. It seems to follow the cg accurately on rebuild.
- Attachments
-
- Assem1.SLDASM
- (211.47 KiB) Downloaded 89 times
- DanPihlaja
- Posts: 847
- Joined: Thu Mar 11, 2021 9:33 am
- Location: Traverse City, MI
- x 811
- x 978
Re: Define Assembly Axis coincident with Center Of Mass
That is a great idea.GrahamK wrote: ↑Thu Oct 28, 2021 10:02 am I could be clever and say Catia as this will do exactly what you want
What you can try is:
Create COM
Then create 3 global variables which you can assign the values in XYZ of COM (make sure you set to automatically rebuild)
Create 3 planes paralel to Front, top, Right and link to the 3 global variables.
Create point of intersection of these 3 planes.
If the COM changes this will update the global variables which in turn updates the planes and then the point.
The only issue that I see is when/if one of the distances goes into the negative or becomes 0. How do you determine positive/negative direction?
-Dan Pihlaja
Solidworks 2022 SP4
2 Corinthians 13:14
Solidworks 2022 SP4
2 Corinthians 13:14
Re: Define Assembly Axis coincident with Center Of Mass
In SW2022, you just need to define the Coordinate System. Its origin, planes and axes are now selectable and usable for many downstream operations (including sketching, mates and more).Rob wrote: ↑Thu Oct 28, 2021 8:07 am I'm looking to create a pivot point at exactly the Assembly COM.
So far I have achieved this by creating a COM feature in the assembly and then creating an assembly sketch with a single sketch point that I drag coincident to the COM point then using this point and a Plane to define the Axis.
This works but the sketch point does not update when the COM moves.
To get an update I have to delete the sketch point coincident relation and reapply it, which is insanely tedious.
Is there a nicer way to do this? Seems like there should be.
- mattpeneguy
- Posts: 1386
- Joined: Tue Mar 09, 2021 11:14 am
- x 2489
- x 1899
Re: Define Assembly Axis coincident with Center Of Mass
Hmm. That works and should be a robust solution!
BTW, who championed adding those planes and axes to the coordinate systems? I'd like to thank them. I'd be testing this out in the Beta if we weren't stuck on Windows 7 (can't upgrade past 2020).
Re: Define Assembly Axis coincident with Center Of Mass
Yes, the new functionality is pretty crazy. We can even achieve freedom from the ORIGIN!!!
I stress-test the enhancements and reported the results here:
https://www.engineersrule.com/coordinat ... -and-axes/
Re: Define Assembly Axis coincident with Center Of Mass
I asked the same question here:mattpeneguy wrote: ↑Thu Oct 28, 2021 5:24 pm BTW, who championed adding those planes and axes to the coordinate systems? I'd like to thank them.
https://r1132100503382-eu1-3dswym.3dexp ... NJjqu20FVg
- DanPihlaja
- Posts: 847
- Joined: Thu Mar 11, 2021 9:33 am
- Location: Traverse City, MI
- x 811
- x 978
Re: Define Assembly Axis coincident with Center Of Mass
Its been in the top ten every single time I have ever participated in it.mattpeneguy wrote: ↑Thu Oct 28, 2021 5:24 pm Hmm. That works and should be a robust solution!
BTW, who championed adding those planes and axes to the coordinate systems? I'd like to thank them. I'd be testing this out in the Beta if we weren't stuck on Windows 7 (can't upgrade past 2020).
-Dan Pihlaja
Solidworks 2022 SP4
2 Corinthians 13:14
Solidworks 2022 SP4
2 Corinthians 13:14
Re: Define Assembly Axis coincident with Center Of Mass
Along the lines of colt's post, if you use a surface instead of a solid body, then you needn't worry about any effects the CG ball has on the CG calcs as it is massless and its material selection is..immaterial. EDIT:
And apply the black/while tile texture to the surface ball to give it a CG look: