cam groove

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

from your own screenshot:

looks at the left side roller cam gap, and then look at the gap size in the slope. doesn't it bother you that if someone took your advice they would have junk parts?

others on this thread were gently pointing out the flaw to you and in the process setting a warning to others. if you insist your method is valid, that's potentially misleading. please take that into account as you defend it, or it won't be a simple mistake anymore :(
stupid cam.PNG
stupid cam.PNG (35.72 KiB) Viewed 1012 times
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: cam groove

Post by TheMarkster »

@emills2, do you think this one would work?

I had to remove the ruled surfaces and bsplines from the model to get it under the size restriction so it could be uploaded. Basically, the macro creates 4 bsplines, 2 copies of 2 bsplines actually. 1 is the radius of the cylinder, and the other is a bit smaller, the radius of the inside of the slot. For example, if the cylinder is radius = 10 and the slot is 1 mm deep, then the radius of one bspline is 10, and the other is 9. The 2 copies (one for each radius) are moved up along the z axis by the amount of the slot height. 4 ruled surfaces are created with the bsplines used as edges, these new faces used to form a shell, the shell used to form a solid. The solid is then cut from the cylinder. I believe all the angles should be right angles because of the way the bsplines are positioned, but they could be easily re-positioned even to make the angles greater than 90 degrees.

Note: the yac macro requires the 3D Parametric Curve macro to be installed via the Tools -> Addon Manager. That macro (the first one in the list of macros because it has a number as the first character) must also be renamed from Macro_3D_Parametric_Curve.FCMacro to Macro_3D_Parametric_Curve.py (so my macro can import it as a module).

I'm working on a thread maker macro based on the same principles. I'll just incorporate the code from the other macro (with due credit to the source) rather than force users to jump through those hoops. It's coming along, but needs some refinement.
threadmaker.png
threadmaker.png (123.59 KiB) Viewed 1004 times
Attachments
yac.py
(4.06 KiB) Downloaded 26 times
yac.FCStd
(481.57 KiB) Downloaded 43 times
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

as of right now i see the same basic issue. check out this edited model. i have added a slicing solid. if you go into the sketch, you can edit the angle dimension.

at angle 0, the slot looks nice and perpendicular to the outer surface and cylinder axis
yac_01_0_degrees_cut.PNG
yac_01_0_degrees_cut.PNG (65.53 KiB) Viewed 1002 times
at angle 45, the slot walls are now at an angle. a cam roller is only supposed to rotate along its axis. this is rotating the axis of the roller itself! so now instead of just translating and converting rotary to linear, your cam is rotating is axis, and whatever it is attached to! this is not typically desired, and doesn't follow the images and animations linked on the front page.
yac_02_45_degrees_cut.PNG
yac_02_45_degrees_cut.PNG (128.12 KiB) Viewed 1002 times
yac_03_45_degrees_cut.PNG
yac_03_45_degrees_cut.PNG (129.06 KiB) Viewed 1002 times
i can't speak to the macro because it looks long...but i can tell you what i have doubts about. and what i would do if i were writing the macro. this is not intended to be an exact how-to, but if you're already working on the problem, most of it should make sense.

the cam profile can be anything you want. just draw the path of the CENTER POINT of the cam roller on the outer cylinder. any way you can achieve this is fine. in my cases, i drew an extruded curve into a surface, cut the cylinder (a copy) with this surface, and extracted the outer edge of the cut cylinder as my path. (after this solidworks had builtin tools)

first problem: map this path of the center point to the bottom of the groove correctly, so it rotates with the cylinder. i think freecad can do this...maybe, with python. if you get a far as i did above, you can extract this edge as a trimming curve of the cut cylinder. you should then be able to 'push' this same trimming curve into a smaller cylinder. the way trimming curves work is they internally 'unfold' the NURBS representation, draw the curve flat in uv as if it was xy, and then refold the surface. so the same trimming curve on a large cylinder gets scaled down on a smaller cylinder, IF the uv parametrization of the cylinders is the same (i bet you it is).

if this succeeds, you will now have two curves. one along the outer cylinder, one along the inner cylinder. two points drawn at the same curve parameter 't' on both curve will define a line that goes through the central axis of both cylinders, and cross it perpendicularly!!! this defines the positions of the roller axis at each time 't'. a ruled surface needs to be drawn between these two curves. ruled is absolutely necessary, because the axis of the cam roller is always a straight line. FreeCAD has several ruled surface options, so i hope that with 'twin mapped curves' it should pull it off without scrambling the surface. since the parametrization will be identical exactly where we want to join the curves as a surface.

this ruled surface is never an extruded surface unless the profile is flat.

now the hard part, and i don't know if FreeCAD can do this: produce a clean offset surface of this 'cam axis path ruled suface'. this is the surface that is technically correct to run a cam on. it is always exactly one radius way from the center of the cam.

this is necessary for printing only. if machining, just use the curve on the outer cylinder to guide the tool, no modeling needed

EDIT: when i said 'clean offset surface', i do not mean just make a copy above and a copy below. that doesn't work. you'll get varying cross section widths when measured perpendicular to the cam surface. these must be proper offsets, and these cannot be calculated 'manually' even with a full access to the NURBS definition of the surface. they are always approximate, and often they have much higher degree and pole count.
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

i don't know if it's appropriate here, but i could show some of the core necessary elements of the strategy above using onshape.....as a communication shortcut. but i don't really want to promote onshape. i dunno
cam3d_onshape_example.PNG
cam3d_onshape_example.PNG (184.08 KiB) Viewed 999 times
Last edited by emills2 on Mon Jul 16, 2018 6:14 am, edited 1 time in total.
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

Hah! looks like onshape can't do it either...maybe. so far i've only done it myself with solidworks with the 'solid body sweep' feature.

the critical thing here is that onshape doesn't allow 'selective' rotation of the profile along the sweep.
cam3d_onshape_example_01.PNG
cam3d_onshape_example_01.PNG (156.99 KiB) Viewed 998 times
cam3d_onshape_example_02.PNG
cam3d_onshape_example_02.PNG (269.56 KiB) Viewed 998 times
to achieve the 'solid body sweep' effect, i think what i said before is the best strategy...at least technically correct. there are two hard parts: offset the path radially inward or outward (same difference), and then get good offset surfaces of the ruled surface joining the two paths.
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

i will no longer mention the program i'm using to generate these images...and i hope FreeCAD forgives me :D this is the only way to get the point across fast. i don't want to do all this myself in FreeCAD, but it can be useful to those that need it.

in picture below:
-i used an extruded sketch to cut a cylinder, defining a curve along that cylinder. this curve will be the path of my cam
-i offset the cut cylinder inwards. this shrinks the cam path inwards, in x and y, but not in z. my cam will stay flat, and pointed at the cylinder axis
cam3d_onshape_example_03.PNG
cam3d_onshape_example_03.PNG (159.89 KiB) Viewed 997 times
notice that the offset inner surface is NOT on the original cutting surface (extruded sketch). it's related to it, but not on it.

this key difference is what Chrisb pointed out in Oldmachine's models, and that i saw in yours. this causes two problems that compound each other in those models:
-the cam path changes width, so it either sloppy or too narrow
-the angle changes, so the cam cannot roll flat on any surface, but drags along a point
- when you combine these two issues, you need a 1" slot for a .25" cam roller. this is more like a bag of cats than a smooth cam in terms of mechanical action (i'm exaggerating to make a point).
Last edited by emills2 on Mon Jul 16, 2018 6:16 am, edited 1 time in total.
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

turns out that other program doesn't have solid sweep or a ruled surface tool that i understand. but FreeCAD has a ruled surface tool that i understand!

so i brought it home in step, selected inner/outer edges in pairs, and hit Part>ruled surface!

i was able to do three of the section where they clearly line up, and then created offset. some sections don't line up (highlighted green), and can't be ruled, because the stupid offset in the other program decide to change the goddamn parametrization for no discernable reason. you can see the two segments toward the bottom don't start and stop together, and if i try to rule them it just makes a mess.

this is easy to fix but very tedious.: everywhere there is an edge on one but not the other, you have to split the other at the corresponding point. you find the corresponding point by projecting back to the cylinder axis and intersecting. then you get the parameter value at the intersection. then you produce 2 new segments around the intersection point parameter value. now you can rule the pair.
cam 3d 01.PNG
cam 3d 01.PNG (144.67 KiB) Viewed 996 times
Attachments
cam 3d.FCStd
(73.66 KiB) Downloaded 38 times
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

same model as before

once you have your ruled surfaces of the cam axis travel surface
you can offset to the actual honest to goodness cam rolling surfaces (need one above and one below, both at cam radius + clearance offset distance)
cam 3d 02.PNG
cam 3d 02.PNG (325.79 KiB) Viewed 993 times
the offset surfaces' edges don't really follow the cylindrical wall anymore. while technically correct as far as offsetting goes, this is annoying, because we want to use these surfaces to cut our cylinder clean off to define our groove.

two options:
-extend the surfaces (tons of work, not recommended)
-before you make the cam axis travel surface, offset inward more than necessary, and add an outer offset as well. use those to make the ruled surfaces. the offset surfaces will then extend beyond the cylindrical wall and can be trimmed to size. much easier than extending.
cam 3d 03.PNG
cam 3d 03.PNG (127.94 KiB) Viewed 993 times
i got a lot more done after switching back to FreeCAD than i thought i would. i'm kind of blown away by how easily and quickly FreeCAD pumped out those offsets. Now i think i wasted time by going to Onshape. i might try to do the whole thing in FreeCAD for fun...but monday is near :(

this would certainly benefit from a script anyways. perfect job for Part Module.
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: cam groove

Post by chrisb »

Can anyone please tell me why frenet isn't working here? The rectangle should keep its orientation.
Attachments
Bildschirmfoto 2018-07-16 um 09.09.02.png
Bildschirmfoto 2018-07-16 um 09.09.02.png (19.19 KiB) Viewed 976 times
cam_cb.FCStd
(100.41 KiB) Downloaded 29 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: cam groove

Post by emills2 »

chrisb wrote: Mon Jul 16, 2018 6:31 am Can anyone please tell me why frenet isn't working here? The rectangle should keep its orientation.
notice how my use case has a flat on both ends ? there's a story behind that... :lol:

the frenet at the bottom right, where i think you have your profile located in fact points down and right. so your cutout is angled to the frenet at the starting point.

the frenet at the upper left points up and left.

your slot has maintained it orientation:
-draw a line that bisects your profile in the picture shown below.
-this line will be an axis of symmetry for the cut into the cylinder.
-the cylinder is angled compared to this symmetry axis, so your cut looks off. but it is symmetric in the plane of the path, and frenet aligned.

frenet is not the solution here, because the path is not sufficiently related to the cylinder.

edit: more specifically, being frenet to the path has no relation to aligning one's slot to the main axis of the cylinder.
Post Reply