Two types of constraints could meet this need. They can be found in the "Advanced constraints" submenu, which must be expanded below the "Standard constraints", there are:
The barrier constraint seems to be the perfect choice. In the first box you select the two sides of your nipple, in the second box you select the two sides of the oblong.
To complete, you will have to add a parallelism constraint between two faces to orient the face (the slide constraint does not do this)
And there you have it, all you have to do is enjoy your beautiful position:)
I've already tried with these 2 types of constraint but the problem is that the "nipple" has a rotational movement and the groove is just used to position this nipple to make the "blue" bolt tail translate from right to left (if you turn the handle to the right the bolt tail goes to the right and the same if I turn left)
In fact the handle is molded around the square on which the drive piece of the of the bolt is fixed so when I turn the handle it rotates the nipple which makes the of the bolt (blue piece of the question) to the right or left
In fact, there must be a point contact (or a distance) between a top of the nipple and the part that is to be translated.
But SolidWorks handles these constraints quite badly, so what I do :
Create two configurations, one closed and one open, because in general we don't need to see the movement, these are the two positions that interest us.
Or, a small variation. But I don't know if it's possible.
Create an axis that runs through the center of the nipple in the room. And in the assembly, put the slide constraint between the groove and the created axis (groove in the 1st box and axis in the second. If you reverse it won't work!)
So by rotating your handle, the groove will follow the movement. On the other hand, by staying centered on the axis and not with punctuals as it would be done in real life (although?)
So @.PL point constraint or distance doesn't work because I'm not perpendicular (less than 1 half degree ^^') if I don't find a solution I'll do 2 positions as you advised me.
@coin37coin I created a sketch to create an axis going through the center of the nipple but when I want to make my slide constraint it doesn't want to select the axis or even the sketch so I think I didn't understand how to make it =S
@gt 22: or could you explain to me how to make your ^^ (I've been working in design for a year and I've never had to use a cylindrical axis and I don't remember hearing about it in class ^^')