## V0.19: Just for fun--Newton's Cradle

ppemawm
Posts: 744
Joined: Fri May 17, 2013 3:54 pm
Location: Manhattan New York

### V0.19: Just for fun--Newton's Cradle

If they can do it in Solidworks we can do it in FreeCAD!...https://www.youtube.com/watch?v=d7QLdHGKtOk

I thought it would be fun to see if I could simulate Newton's cradle motion with the Assembly4 (V0.9.3) animator. The following screenshots describe the process:

The PartDesign workbench was used to create each body in-context.

Carbon copies of the assembly master sketch was used to create each body. Local coordinate system "connectors or mates" were then attached to the proper vertices in the master sketch for each body. The master sketch serves as the solver for the assembly. If the dimensions in the master sketch are changed, the assembly will update.
Capture.JPG (229.51 KiB) Viewed 2032 times
Once assembled, variables were defined for the hanger angle, number of balls in motion, and time.

The hanger angle was used to vary the position of the attachment offset of a selected hanger body link as shown in the above property panel.
Capture2.JPG (245.4 KiB) Viewed 2032 times
This property panel of the variables shows the conditional expression used to approximate the pendulum motion with a sin function for small values of displacement angles.

The Assembly4 animator varies the input and output angle of the hangers for a specified time duration. The accuracy of the motion is only limited by your ingenuity in describing the relations of the variables.
newtons_cradle.gif (538.45 KiB) Viewed 2032 times
Another conditional can be used to decide what to do if there is one or two balls involved as shown in the property panel expression.
Capture3.JPG (89.87 KiB) Viewed 2032 times
Three or more balls could be done in a similar manner but would require more complex conditional expressions of course. That's where the fun comes in!
newtons_cradle2.gif (572.42 KiB) Viewed 2032 times
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Version: 0.19.20887 (Git)
Build type: Release
Branch: master
Hash: 42c56d9fef82b484448e3730eb7da69c48fe1374
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
"It is a poor workman who blames his tools..."
schupin
Posts: 407
Joined: Sun Jan 21, 2018 1:43 pm

### Re: V0.19: Just for fun--Newton's Cradle

Extremely impressive (as usual, but still )
Lookid
Posts: 38
Joined: Wed Sep 12, 2018 7:39 pm
Location: France

### Re: V0.19: Just for fun--Newton's Cradle

Master sketch, attach to local coordinates, carbon copies, the same words in each post of yours.
It seems that by understanding these few principles, you can use Assembly4 at full power make a lot of things.

Bold of me to ask, but hey : Would it be possible to create a very simplified assembly using these principles, and explaining the thought process in the creation, either with text or with a voice-over? What does what and its purpose, in an ELI5 manner. This would be gold.

Also, I'm not really into the CAD world, but are there (a lot of) things that commercial CAD software can do that FreeCAD can't?
fc_tofu
Posts: 654
Joined: Sun Jan 05, 2020 4:56 pm

### Re: V0.19: Just for fun--Newton's Cradle

Quite amazing!
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

### Re: V0.19: Just for fun--Newton's Cradle

Nice!
Zolko
Posts: 1087
Joined: Mon Dec 17, 2018 10:02 am

### Re: V0.19: Just for fun--Newton's Cradle

ppemawm wrote:
Fri May 22, 2020 4:45 pm
If they can do it in Solidworks we can do it in FreeCAD!...https://www.youtube.com/watch?v=d7QLdHGKtOk
wow .... impressive, thank-you. In the case of 2 balls bouncing, the motion of the 2 balls is not identical: do you actually calculate the physical laws for the motion ?
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
Aleks
Posts: 85
Joined: Sun Mar 08, 2020 5:27 pm
Location: Sankt Augustin, Germany
Contact:

### Re: V0.19: Just for fun--Newton's Cradle

Is this a physics simulation?
ppemawm
Posts: 744
Joined: Fri May 17, 2013 3:54 pm
Location: Manhattan New York

### Re: V0.19: Just for fun--Newton's Cradle

Thank you all for the kind comments.
Lookid wrote:
Sat May 23, 2020 9:50 am
Would it be possible to create a very simplified assembly using these principles, and explaining the thought process in the creation, either with text or with a voice-over? What does what and its purpose...
I refer you to one of zolko's excellent tutorials: https://github.com/Zolko-123/FreeCAD_Ex ... /README.md
and sjgallagher2's master sketch tutorial: https://forum.freecadweb.org/viewtopic. ... 51#p369748
Zolko wrote:
Sat May 23, 2020 11:59 am
the motion of the 2 balls is not identical: do you actually calculate the physical laws for the motion ?
Aleks wrote:
Sat May 23, 2020 6:50 pm
Is this a physics simulation?
No. Pendulum motion is nonlinear. However, the displacement angle as a function of time is approximately related to the cosine of the angle from vertical for small displacements (<20 deg). I am using a sinusoidal change in time to simulate the motion for this demonstration.

This is only an example to show the potential of using expressions, attachment offset, and the animator. It is the simplest of the simple. There is no physical collision detection other than the conditional statement.

Note that the angle is being incremented by (5) in this simulation. I suspect the delay is caused by the sequential execution of the animator. If you make the increment smaller the delay is less.
Last edited by ppemawm on Sun May 24, 2020 10:29 am, edited 1 time in total.
"It is a poor workman who blames his tools..."
Aleks
Posts: 85
Joined: Sun Mar 08, 2020 5:27 pm
Location: Sankt Augustin, Germany
Contact:

### Re: V0.19: Just for fun--Newton's Cradle

I love using expressions and a spreadsheet. It allows me to quickly prototype some more complex model without writing anything in python. Love your work.Keep it up!