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.
Useful Sketch Arc Midpoint Function
NeilCooke
Moderator, Onshape Employees Posts: 5,688
In case anybody needs one...
skArc requires start, mid, and endpoint to create a sketch arc.
skArc requires start, mid, and endpoint to create a sketch arc.
function getArcMidpoint(center is Vector, start is Vector, end is Vector) returns Vector
{
// need to convert 2D vectors back to 3D
const center3D = vector(center[0], center[1], 0 * meter);
const start3D = vector(start[0], start[1], 0 * meter);
const end3D = vector(end[0], end[1], 0 * meter);
const angle = angleBetween(center3D - start3D, center3D - end3D) / 2;
start = center - start;
var ca = cos(angle); // in radians
var sa = sin(angle);
return center - vector(ca * start[0] - sa * start[1], sa * start[0] + ca * start[1]);
}
Senior Director, Technical Services, EMEAI
2
Comments