Freecad collision detection
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Freecad collision detection
I am designing a 4 bar linkage mechanism.
I want to simulate the movement, and want to find out if they work as i intend them to.
I see in this video, that there is no collision detection in FreeCAD. https://www.youtube.com/watch?v=gV7jK0c7m40
So I google, and I find this. : https://www.youtube.com/watch?v=6CIorZvubtc
But this is using bounding boxes.
I want to do a proper collision detection, and take into account that some parts have non-parallelopoid shapes.
Is there any way to achieve it?
Thank you.
I want to simulate the movement, and want to find out if they work as i intend them to.
I see in this video, that there is no collision detection in FreeCAD. https://www.youtube.com/watch?v=gV7jK0c7m40
So I google, and I find this. : https://www.youtube.com/watch?v=6CIorZvubtc
But this is using bounding boxes.
I want to do a proper collision detection, and take into account that some parts have non-parallelopoid shapes.
Is there any way to achieve it?
Thank you.
Re: Freecad collision detection
You can do this:
a) using Sketcher if the linkage is 2D
b) using Assembly3 if the linkage is 3D
c) using MBDyn addon if you have to take dynamics (masses, inertia moments) into account
I do not really understand why you need collision detection for 4 bar linkage, can you elaborate a bit more?
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Freecad collision detection
You could try taking the common of the 2 objects and checking it for volume as a means of collision detection. but this is likely to be painfully show.
Another option, make a Points object from one of the shapes in Points workbench, setting the tolerance fairly high so not many points are created. The more points you use the higher the precision and fewer intersections to be missed, but the longer processing time. With a setting of 2 for the tolerance I get 52 points from a default cylinder.
The points list can be accessed as obj.Points.Points in python. Let's call the other object obj2. We can get its shape property as obj2.Shape.
A default cylinder and default cube:
Intersecting points found using this method:
Another option, make a Points object from one of the shapes in Points workbench, setting the tolerance fairly high so not many points are created. The more points you use the higher the precision and fewer intersections to be missed, but the longer processing time. With a setting of 2 for the tolerance I get 52 points from a default cylinder.
The points list can be accessed as obj.Points.Points in python. Let's call the other object obj2. We can get its shape property as obj2.Shape.
Code: Select all
contacted = [p for p in obj.Points.Points if obj2.Shape.isInside(p,.01,True)] #True means count points on face as intersecting
count = len(contacted)
print(f"There were {count} points of contact")
Intersecting points found using this method:
Re: Freecad collision detection
Like so, for example? (using Assembly 3)
Re: Freecad collision detection
How did you create the smooth gif? I have created an animated gif by exporting a set of single frames and used Gimp to create the animation. But the result is rather clumsy.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Freecad collision detection
Most amusing
I searched the forum how to do it and found your post describing using Gimp for it
The difference lies (I am guessing) in a way I create single frames?
Model animation is controlled using dd and Assembly 3 - this allows me to create a set of precisely stepped (in this case every 10 deg) frames each screen grabbed in a fixed window. I had 36 frames for this gif.
Re: Freecad collision detection
Thanks, perhaps I should retry. Besides: it was my first FreeCAD project, so bare with me.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Freecad collision detection
My first attempt at gif creation was decidedly crappy indeed
until I found your post that inspired me to try single frames and gimp (thank you for that!).
Re: Freecad collision detection
Btw
If this can be useful for anyone, I did this animation using A3, spreadsheet and writing a simple script and then encoding pics with ffmpeg.
Re: Freecad collision detection
Looks indeed very good. Can you provide the ffmpeg parameters?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.