OS: Debian GNU/Linux 10 (buster) (GNOME/gnome)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22474 (Git) AppImage
Build type: Release
Branch: master
Hash: a44f8ffd427fa9b23b1f00dbf62d66cd152cd774
Python version: 3.8.5
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: German/Germany (de_DE)
This is my first post to the forum. I'm playing with FreeCAD for quite some time (and several releases) already and recently started to make myself familiar with the Assembly 4 module.
Let me first state that I'm really impressed about the progress FreeCAD made during the last years.
My problem: I'm trying to animate parts along a path. For now, the path is a sketch (consisting of just lines and circles) and I'm working with the Frenet attachment. See attached simplified animation (the real thing is supposed to become a roller chain drive train in the end):
Obviously, this works fine for a single arc segment of the sketch, but I would like to see part move around the whole sketch. So the question appears to be: what type of curves does the Frenet attachment accept (I only managed to use this attachment to B-splines and arcs/circles)? Is there any "compound curve" type I could use or am I expected to convert the sketch into one single B-spline?
Or is there a better approach to what I want to achieve?
FrenetTB Attachment: which curve types are allowed?
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!
FrenetTB Attachment: which curve types are allowed?
Cheers,
Markus
Markus
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: FrenetTB Attachment: which curve types are allowed?
Frenet-Serret coordinate system requires curvature, thus it can't work with lines.
I think you should try to apply Draft PathArray, extract placements, and use SCLERP interpolation between occurrences for smooth motion. SCLERP interpolation is available as sclerp method of App.Placement.
To extract placements from Draft Arrays, use:
I think you should try to apply Draft PathArray, extract placements, and use SCLERP interpolation between occurrences for smooth motion. SCLERP interpolation is available as sclerp method of App.Placement.
Code: Select all
sclerp(placement2, t, shorten = True): interpolate between self and placement2.
Interpolation is a continuous motion along a helical path, made of equal transforms if discretized.
t = 0.0 - return self. t = 1.0 - return placement2. t can also be outside of 0..1 range, for extrapolation.
If quaternions of rotations of the two placements differ in sign, the interpolation will
take a long path. If 'shorten' is true, the signs are harmonized before interpolation, and the
interpolation takes the shorter path.
Code: Select all
plms = [child.Placement for child in App.ActiveDocument.Array.Shape.childShapes()]
Re: FrenetTB Attachment: which curve types are allowed?
Thank you, but I think this isn't really the the problem. It's that Frenet attachments appear to not accept more than one single basic curve segment. I could easily replace the straight lines with arcs with a very large radius.
I guess what I'm missing is some kind of a compound curve that the attachment would accept (tried upgrading the sketch to a wire, but FreeCAD just reports an error, even after replacing the lines with arcs)?
Cheers,
Markus
Markus
Re: FrenetTB Attachment: which curve types are allowed?
Thank you.
Sad, I thought.
And fixed it.
Wasn't that difficult, actually. At least for my specific case. Need to check if I have broken any other attachment cases and will likely create a pull request soon.
Cheers,
Markus
Markus
Re: FrenetTB Attachment: which curve types are allowed?
Hey, that's a great job! I stumbled upon this problem a few months ago, and the only way to get a workaround solution was to use a single B-spline, which was clearly a sub-optimal solution as you pointed out. I really hope your pull request will be accepted, there are a lot of use cases for this!