cam following options (solved)

Report observations made with the new Toponaming branch.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

cam following options (solved)

Post by bambuko »

Simple sketch of cam and a line that is meant to follow it:
cam_sketch.png
cam_sketch.png (7.95 KiB) Viewed 1792 times
Is it possible in FreeCAD?
Converting cam curves to bspline doesn't work because tangent doesn't work?
Any other options?

Code: Select all

OS: elementary OS 6.1 JAlnir (Pantheon/pantheon)
Word size of FreeCAD: 64-bit
Version: 2022.407.26244 +4693 (Git) AppImage
Build type: Release
Branch: LinkDaily
Hash: 9610830a8fd492b3b3d96f8328507c80f1437cda
Python version: 3.9.12
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United Kingdom (en_GB)
Last edited by bambuko on Sat Apr 30, 2022 8:05 am, edited 1 time in total.
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: cam following options

Post by chrisb »

bambuko wrote: Fri Apr 29, 2022 10:44 am Any other options?
Tesselate with multiple arcs to approximate the B-spline you want.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Veteran
Posts: 8550
Joined: Thu Dec 27, 2018 12:28 pm

Re: cam following options

Post by Roy_043 »

Using the BoundBox.Ymin of the cam sketch in an expression can work:

Code: Select all

Sketch.Shape.BoundBox.YMin
See attached file.
Attachments
line-follows-cam.FCStd
(6.47 KiB) Downloaded 53 times
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: cam following options

Post by bambuko »

chrisb wrote: Fri Apr 29, 2022 11:34 am ...Tesselate with multiple arcs to approximate the B-spline you want.
Not quite sure how is this supposed to work?
Perhaps I have not explained it well enough....
With multiple arcs you still can only make it tangent to one of these arcs :oops:


Roy_043 wrote: Fri Apr 29, 2022 11:57 am Using the BoundBox.Ymin of the cam sketch in an expression can work:
Precisely what I had in mind.
Haven't got a clue what BoundBox is ;)
(sorry :( :oops: will have to educate myself, no problem....)
but it works perfectly.
Thank you :!:
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: cam following options

Post by chrisb »

bambuko wrote: Fri Apr 29, 2022 3:57 pm With multiple arcs you still can only make it tangent to one of these arcs :oops:
That would indeed require either a complicated cascading expression or some python code. What a hassle compared to the bounding box.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: cam following options

Post by bambuko »

chrisb wrote: Fri Apr 29, 2022 5:14 pm What a hassle compared to the bounding box.
Roy_043 wrote: ...

LATER EDIT:
There is a bit of a problem with particular cam I am modelling :oops:
or maybe it is something to do with the way I am using it? (inside part design sketch)

Not exactly what I intended....
puzzled :oops:
Screenshot from 2022-04-29 18.26.12.png
Screenshot from 2022-04-29 18.26.12.png (9.62 KiB) Viewed 1655 times
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: cam following options

Post by chrisb »

bambuko wrote: Fri Apr 29, 2022 5:27 pm Not exactly what I intended....
Looks like the well known flipping. If you want the liine to be always at the bottom, then you must not set the distance between the origin and the line, set instead the vertical distance of one of the endpoints of the line. Those are signed, and thus you can assure with a negative value that it is alway below the x-axis.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: cam following options

Post by bambuko »

chrisb wrote: Fri Apr 29, 2022 6:19 pm ...Looks like the well known flipping...
possibly not???
to be "correct" I would expect

Code: Select all

Sketch.Shape.BoundBox.YMin
to return 14.75
???
Screenshot from 2022-04-29 20.03.24.png
Screenshot from 2022-04-29 20.03.24.png (19.89 KiB) Viewed 1593 times
Screenshot from 2022-04-29 20.41.49.png
Screenshot from 2022-04-29 20.41.49.png (12.79 KiB) Viewed 1570 times
P.S.
how do you set "vertical distance of one of the endpoints of the line" ??
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
User avatar
Roy_043
Veteran
Posts: 8550
Joined: Thu Dec 27, 2018 12:28 pm

Re: cam following options

Post by Roy_043 »

If the cam sketch is not plane-parallel to the XY plane (of the Body) you will need to adjust the expression. The boundingbox of the sketch is not in the coordinate system of the sketch, but in the coordinate system of its container (the Body in your case). If that does not help: post your file.
User avatar
bambuko
Veteran
Posts: 2185
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: cam following options

Post by bambuko »

Roy_043 wrote: Sat Apr 30, 2022 6:58 am If the cam sketch is not plane-parallel to the XY plane (of the Body) you will need to adjust the expression. The boundingbox of the sketch is not in the coordinate system of the sketch...
Thank you!
Looks like you hit the nail on it's head ;)
The sketch plane is in ZY plane (of the Body).
Let's see if I am clever enough to "...adjust the expression..." :mrgreen:

LATER EDIT:

bingo :mrgreen:
Screenshot from 2022-04-30 08.41.16.png
Screenshot from 2022-04-30 08.41.16.png (15.28 KiB) Viewed 1489 times
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
Post Reply