Gear simulation

I’m trying to move these two gears with these two points(one point and one gear form a rigid body), it works, but somehow it’s super slow and sometimes crashes the rhino. Did I do something wrong?

GEAR_test.gh (735.2 KB)

1 Like

Hi @user2234

The solid collision in Kangaroo isn’t really suitable for this, but you could use curve collisions like here:

Hi @DanielPiker,

I downloaded this example, but I’m building a linkage and don’t know how to make the curve collide work with rigid body parts. So now I’m using extra linkage to work like gears. It will be much cleaner and easier to replace with gears(the black lines of gears show where I hope to place them). Would you please give me some hints on how to do that?

2022-08-11 20-50-42.2022-08-11 20_52_10

If you just want 2 parts with fixed centers to rotate equal and opposite amounts, I wouldn’t do it with collisions at all, but rather use the Transform goal with a reflection.
From points or rigid curves you can attach solid geometry to the output for display as 3d objects.
I’m not following the intent from your animation above though. I don’t understand which parts you want to keep fixed.

Thanks for the tip! and sorry for the confusion. basically, the following gif shows what I want to do for the gear part. Still, I’m struggling with applying it to the linkage to replace the part in the yellow circle
(it feels like there will be a recursive issue if I use the output plug into the linkage setup).
2022-08-12 16-51-05.2022-08-12 16_53_19

I use gear because I want to print out and build a prototype, and I hope to adjust the gear size and simulate to get the right movement(or rotatory angle) before sending it to a printer.
IMG_7994.2022-08-12 17_04_04

Gear_test2.gh (103.5 KB)
ghgear_0 (2).gha (53 KB)

1 Like

I’m trying to do this(gif), but now the gear is not functioning, just attached with the output. (I use a linkage to mimic the movement). I wonder if there is a way to use curve collide, meanwhile you can attach point to the curves to grab them or use the coincident component, same as what a rigid body can do.

2022-08-14 11-05-55.2022-08-14 11_09_41

figured it out, plug the frame from curve collide to the rigid body dose the trick. thank you very much for the help!
ezgif-3-d9fc50ade9

One more question. gear A now is the passive curve means if I grab pt(1) on the rigid body tie with Gear B, but it won’t drive gear A, it is a one way control, is that correct? Just curious, if there is way to make them mutual drive?

Yes - passive curves create a one way control - their position and orientation is an input, and cannot be affected by the solver.
If you need both curves to get moved by each other and other parts of the simulation they need both need to go into the C input.
Here’s an example with multiple active rigid curves attached to rigid bodies:


rigidbodycurvecollide.gh (32.9 KB)

I did also start a while ago on a sort of rotation-ratio goal that controls the relative rotation between a pair of rigid bodies directly. When we can assume perfect gears with zero backlash then I think it could be a lot simpler to do this way than through the curve collisions(which involves a lot of intersection checking so is fairly intensive). I didn’t get it fully working yet though.

2 Likes

Millions of thanks !! the Support component is fantastic which do the job of coplanar and coincident all at once. So many good functions need to be explored, I will keep learning.

" rotation-ratio goal " sounds great!! I actually looked for it in the Goals-Angle. look forward to see it happen in the future!

1 Like

Turns out I was already closer than I thought to getting this working! - here’s a new goal for gears that works directly on rigid body orientation angles, without using collisions:
newGearGoal.gh (52.2 KB)

6 Likes

It looks fantastic !!

I guess because I’m using Mac. it show up this message


and even if I relocate the .dll file, it still not working, it shows this error on the C# component

I’m using Rhino 7.

This is the reference path for the KangarooSolver.dll that ships with Rhino 7 on macOS:

/Applications/Rhino 7.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/ManagedPlugIns/GrasshopperPlugin.rhp/Components/KangarooSolver.dll

There’s no need to relocate anything.

On macOS, you also need the updated Grab component, GrabFixed that Daniel posted a while back, otherwise the viewport interaction with the gears won’t work. An official fix for Grab doesn’t seem to have shipped with an update yet.

newGearGoal-grabFix.gh (54.5 KB)

1 Like

I have had crashing problems with Kangaroo which were fixed by using a mesh of the object. I did have hopes for it.

Thank you, @diff-arch. That path works! And yes, I download the GrabFix a while ago, and it works well.

1 Like

Hi @DanielPiker
This looks good to create Linkage.
Ho to make this more precise?

linkage_test.gh (16.8 KB)

Hi @seghierkhaled
There’s no need to use the RigidPointSet/support goals for what is shown there.
You could do this sort of linkage simulation with Length/Anchor/AnchorXYZ
I’m not sure I understand the aim in this setup though. You have the point on the far right anchored, which means the one connected to it can only move along an arc without changing the length, but then you are trying to move it along a vertical line, which can only happen by stretching.
Here’s how to set up a 3 bar linkage with one end fixed and one end sliding:

linkageexample.gh (12.1 KB)

3 Likes

Thank you very much @DanielPiker
Very useful , can you add a tool like ground (if it is not already exist ) with plane base to limit minimum Y or Z to 0?
Like in this example the top point must not go under the cyan line

For keeping points above Z=0, there’s Floor
There isn’t a general goal for limiting in other dimensions or heights, but you can make a rectangle and use CurvePointCollide
linkageexample_rectangle.gh (14.1 KB)

by the way - what’s the customisation you have there for the radio buttons on the boolean inputs?

1 Like

Great thank you @DanielPiker , i will try it

This small radio button from PERSISTENT DATA EDITOR

Another question: Is it possible to move the point with a slider instead of Grab?

2 Likes