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.
skArc/Constraint syntax and radius calculation error
dvir_henn
Member Posts: 2 ✭
Hi! So I'm trying to create a custom feature and i've found a problem where i try to create an arc using 'skArc' and later define it using 'skConstraint' with '"constraintType" : ConstraintType.RADIUS' but while the original points defined in "start" and "end" are correct in the part studio the "mid" point and therefore the radius aren't correct.
Here's part of my code:
'''
StartPoint = vector((Radius - Belt_Tooth_Depth / 2) * sin(angle / 2), (Radius - Belt_Tooth_Depth / 2) * cos(angle / 2));
EndPoint = StartPoint + vector(-1,1) * millimeter;
MidPoint = StartPoint + vector(-0.5,2) * millimeter;
skArc(FirstSketch, "RootArc", {
"start" : StartPoint,
"mid" :MidPoint,
"end" : EndPoint,
});
skConstraint(FirstSketch, "RootArcRadius", {
"constraintType" : ConstraintType.RADIUS,
"localFirst" : "RooArc",
"magnitude" : RootRadius
});
'''
Here is what I'm getting when the starting point (the lower one) is at (6.26905, 35.55357, 0.00) and the end point is at the right position relative the first point. the middle point of the arc is at (7.12068, 37.40520, 0.00) instead of the intended (5.76905, 37.55357, 0.00), also 'RootRadius' is supposed to be equal to 4.34 millimeter but is actually equal to 1.08065 millimeter.
Is there a reason this is happening and am I wrong in my syntax? Is there an easier way to achive what i want?

Comments
If you can, it's best to avoid adding constraints and calculate the values yourself. Does this function help?