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

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

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

Post by ppemawm »

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.<br /><br />Carbon copies of the assembly master sketch was used to create each body. Local coordinate system &quot;connectors or mates&quot; 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.
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 3446 times
Once assembled, variables were defined for the hanger angle, number of balls in motion, and time.  <br /><br />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.
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 3446 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.<br /><br />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.
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 3446 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.
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 3446 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!
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 3446 times
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 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: 476
Joined: Sun Jan 21, 2018 1:43 pm

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

Post by schupin »

:shock:

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

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

Post by Lookid »

Love your posts!!

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 :D : 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: 653
Joined: Sun Jan 05, 2020 4:56 pm

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

Post by fc_tofu »

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

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

Post by triplus »

Nice!
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

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

Post by Zolko »

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 — tutorials here and here
User avatar
Aleks
Posts: 309
Joined: Sun Mar 08, 2020 5:27 pm
Location: Bonn, Germany
Contact:

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

Post by Aleks »

Is this a physics simulation?
FreeCAD als Maschinenbauer in die Konstruktion und Fertigung integrieren. Schulung buchen: www.alsado.de/freecad-schulungen
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

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

Post by ppemawm »

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..." ;)
User avatar
Aleks
Posts: 309
Joined: Sun Mar 08, 2020 5:27 pm
Location: Bonn, Germany
Contact:

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

Post by Aleks »

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!
FreeCAD als Maschinenbauer in die Konstruktion und Fertigung integrieren. Schulung buchen: www.alsado.de/freecad-schulungen
Post Reply