Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Define the correct tangent!
fau_team
Member Posts: 2 PRO
I am trying to generate an ellipse with a fixed minor axis length and a vertical major axis, the length of which can be solved so that the ellipse fulfills the following constraints: it is coincident with the first point of a spline, tangent to the spline in that point, and tangent to a circle in its outer (convex) side, i.e., in the vicinity of the spline. The problem is that there are at least two tangents that satisfy the given constraints, and the solver defines the one that is not in my interest (the concave side of the circle), resulting in much larger minor and major axes. The correct length of the major axis should be about twice the length of the fixed minor axis, as attempted in the attached code snippet using the ConstraintType.RADIUS. The attached screenshot shows the correct ellipse (the left involute spline) drawn manually in the UI and the large ellipse generated in the Feature Script.
skPoint(sketchGear1Circles, "RinvStart", { "position" : RightinvolutePoints2d[0] });
skConstraint(sketchGear1Circles, "fix1", { "constraintType" : ConstraintType.FIX, "localFirst" : "RinvStart" });
skConstraint(sketchGear1Circles, "fix2", { "constraintType" : ConstraintType.FIX, "localFirst" : "RootCircle1" });
skConstraint(sketchGear1Circles, "fix3", { "constraintType" : ConstraintType.FIX, "localFirst" : "RightinvoluteSpline" });
skConstraint(sketchGear1Circles, "fix4", { "constraintType" : ConstraintType.FIX, "localFirst" : "LeftinvoluteSpline" });
const minorEllipseRadius = 0.5 * millimeter;
skEllipse(sketchGear1Circles, "Rellipse", { "majorRadius" : m * millimeter, "minorRadius" : minorEllipseRadius });
skConstraint(sketchGear1Circles, "fixMinorRadius", { "constraintType" : ConstraintType.RADIUS, "localFirst" : "Rellipse", "value" : minorEllipseRadius });
skConstraint(sketchGear1Circles, "tangent1", { "constraintType" : ConstraintType.TANGENT, "localFirst" : "Rellipse", "localSecond" : "RightinvoluteSpline" });
skConstraint(sketchGear1Circles, "tangent3", { "constraintType" : ConstraintType.TANGENT, "localFirst" : "Rellipse", "localSecond" : "RootCircle1" });
skConstraint(sketchGear1Circles, "vertical1", { "constraintType" : ConstraintType.VERTICAL, "localFirst" : "Rellipse" });
Comments
I always try to solve this kind of thing geometrically instead of with sketch constraints (and I've successfully avoided using constraints in FS so far). If you need constraints, can you trim the circle into an arc to encourage it to choose the nearer one? (not sure if that will help). Alternatively, I think the solver will often snap to the nearest thing, so check that your ellipse is as close to the right size to begin with as possible. I'm guessing here.
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com
Thanks, Evan. I've tried many alternatives, but there's been no success. Solving the thing geometrically remains the only reliable option. I'm trying both with the trochoid and the ellipse to see what comes out.
Cheers!