Inline-four engine animation
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Inline-four engine animation
Hi!
I've created a new animation (for fun and because I think this things attract people to FreeCAD)
https://www.youtube.com/watch?v=HvcdKKO-wPU
Is not complete and it has errors like the valves not opening where they should (because of the circular cam), and there is no crankshaft. But I just couldn't wait to show it
OS: Linux Mint 17 Qiana
Platform: 64-bit
Version: 0.14.3671 (Git)
Branch: master
Hash: 57999cb78d5eb0964ba3a81de73a04f539771bce
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
Greetings, Javier.
I've created a new animation (for fun and because I think this things attract people to FreeCAD)
https://www.youtube.com/watch?v=HvcdKKO-wPU
Is not complete and it has errors like the valves not opening where they should (because of the circular cam), and there is no crankshaft. But I just couldn't wait to show it
OS: Linux Mint 17 Qiana
Platform: 64-bit
Version: 0.14.3671 (Git)
Branch: master
Hash: 57999cb78d5eb0964ba3a81de73a04f539771bce
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
Greetings, Javier.
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Re: Inline-four engine animation
Very nice!!
Do you have handy a link/forum post where I can read how it is done?
Do you have handy a link/forum post where I can read how it is done?
Re: Inline-four engine animation
Thanks!
Abdullah, you can find more info in my blog:
http://linuxforanengineer.blogspot.com. ... ation.html
The engine shown there is more simple but the method remains the same.
Abdullah, you can find more info in my blog:
http://linuxforanengineer.blogspot.com. ... ation.html
The engine shown there is more simple but the method remains the same.
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Re: Inline-four engine animation
Cannot sleep (2 a.m. now), because of this animation;) I've started thinking about different, sketch-based method.
My simple animation uses sketch and sketcher solver to determine piston position and conrod position/rotation.
To test the animation:
1. Open the attached file 2. Paste the script in the Python console and hit Enter:
Sorry, no video because of recording software issues (it doesn't like my Intel driver?).
To stop animation type
My simple animation uses sketch and sketcher solver to determine piston position and conrod position/rotation.
To test the animation:
1. Open the attached file 2. Paste the script in the Python console and hit Enter:
Code: Select all
import FreeCAD as App, FreeCADGui as Gui, Part, time, sys, math, Draft, DraftGeomUtils
from PyQt4 import QtGui,QtCore
class Animation(object):
def __init__(self):
App.Console.PrintMessage('init')
App.ActiveDocument.recompute()
self.timer = QtCore.QTimer()
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.my_update)
self.timer.start(50)
self.an = 0.1
def my_update(self):
string = '{0}'.format(self.an)
self.an = self.an + 0.01 if self.an < (2 * math.pi) else 0.0
angle = math.degrees(self.an)
App.ActiveDocument.Sketch.setDatum(5,App.Units.Quantity(str(angle)+' deg'))
App.ActiveDocument.recompute()
p1 = App.ActiveDocument.Sketch.Shape.Vertexes[0].Point
p2 = App.ActiveDocument.Sketch.Shape.Vertexes[1].Point
conrodangle = math.degrees(Draft.DraftVecUtils.angle(App.Vector(1,0,0),(p1-p2))) - 90
App.ActiveDocument.getObject("Cylinder").Placement = App.Placement(p1,App.Rotation(App.Vector(1,0,0),-90))
App.ActiveDocument.getObject("Sketch001").Placement = App.Placement(p1,App.Rotation(App.Vector(0,0,1),conrodangle))
def stop(self):
self.timer.stop()
animation = Animation()
To stop animation type
Code: Select all
animation.stop()
Re: Inline-four engine animation
kwahoo, I really like your aproximation, because it involves almost 0 math
On the other side, you are using the "recompute" command inside update(). For simple parts this is ok, but when complexity grows, it can be very very slow (my experience: http://linuxforanengineer.blogspot.com. ... heets.html )
On the other side, you are using the "recompute" command inside update(). For simple parts this is ok, but when complexity grows, it can be very very slow (my experience: http://linuxforanengineer.blogspot.com. ... heets.html )
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Re: Inline-four engine animation
Afaik "recompute()" itself is not the problem, number of sketch constraints/DOF is. But do we need such complicated mechanisms?
PS. Imagine psicofil's buggy with animated suspension simulation. Any volunteers here?
PS. Imagine psicofil's buggy with animated suspension simulation. Any volunteers here?
Re: Inline-four engine animation
At about 46 - 47 seconds into the video a couple of the piston faces are pre-selected, and it looks like ignition. Nice job Javier!
Re: Inline-four engine animation
Excellent Javier !A while ago I did an animation with freecad, python and vrml, on a 7-cylinder radial engine (https://www.youtube.com/watch?v=kzPeJnFNLPI). I'll try to use your script to do it without using vrml.
Thanks for sharing this!!
regards.
Thanks for sharing this!!
Would be great! I signed up to helpPS. Imagine psicofil's buggy with animated suspension simulation. Any volunteers here?
kwahoo: Wonderful work! It seems that the kinematics module is approaching to FreeCADI've started thinking about different, sketch-based method.
regards.
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
Scope Ingenieria (scopeingenieria.com)
Re: Inline-four engine animation
Thanks !
Even one or two scripts
I have something in mind...It seems that the kinematics module is approaching to FreeCAD
Even one or two scripts
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly