Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
2. Need support? Ask a question to our Community Support category.
3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
4. 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.

# Get Lines of a Sketch and angle between 2 lines with coincident vertice.

Member, Developers Posts: 37 ✭✭
I couldn't find an evLine that works with an sketch.

var sketch1 = newSketchOnPlane(context, id + "sketch1", {
"sketchPlane" : newPlane
});

skRectangle(sketch1, "rectangle1", {
"firstCorner" : vector(-1/2,-1/2) * inch,
"secondCorner" : vector(1/2, 1/2) * inch
});

I want to implement something like an sketchFillet and it will fillet all vertices in any closed polygon. Given the radius and the angle between two lines I can calculate the rest.
Tagged:

• Member, Developers Posts: 953 ✭✭✭✭
The answer I typically see from OS is that there is little you can do with sketches via FeatureScript. The best you can do is just lay out lines and arcs with predefined endpoints and sizes based on math that you've already worked out in your code. Now, if you want to make life easier by implementing a custom sketch filleting function that you can use within your featurescript, I can see how that would be handy. As for measuring angles, you can easily work that out in your code since you know the location of the 3 vertices.

For vertices A,B,C, with C being the center:

`angle = atan(A[1] - C[1], A[0] - C[0]) - atan(B[1] - C[1], B[0] - C[0]);`
• Member, Developers Posts: 37 ✭✭
But only with points I can't differ edges from diagonals. If I could makes a for each line in sketch loop I could do the rest. But I could not find the correct query.
• Member, Developers Posts: 953 ✭✭✭✭
How are you generating the sketch lines? If you're using skRectangle, then you already know the angle is 90deg. Not to mention you would already have all the XY info from firstCorner and secondCorner. If you're using skLineSegment, then you already have all the point information because it's required to use the function anyway. What is the scenario where you can't extract the point information?
• Onshape Employees Posts: 531
@emerson_bottero
I don't think one can write a sketchFillet tool in FeatureScript.
It is fairly easy to write a feature which accepts a face and produces a surface with geometry of this face with filleted corners.

• Member, Developers Posts: 953 ✭✭✭✭
@lana, you can't write a sketchFillet featurescript, but you can write a function internal to a Featurescript. Although, at this point I'm still not clear what exactly @emerson_bottero is trying to accomplish ¯\_(ツ)_/¯
• Onshape Employees Posts: 531
Feature script does not have any means of querying sketch or geometry of its entities. From FS point of view the geometry of sketch is not specified until skSolve() is called. After that query qGeometry(qBodyType(qCreatedBy(sketchId, EntityType.EDGE), BodyType.WIRE), GeometryType.LINE) would give you all the lines in sketch

• Member, Developers Posts: 37 ✭✭
mahir said:
@lana, you can't write a sketchFillet featurescript, but you can write a function internal to a Featurescript. Although, at this point I'm still not clear what exactly @emerson_bottero is trying to accomplish ¯\_(ツ)_/¯
@mahir I want a function, as you said. I'm trying to make a feature to extrude a sketch with I can controle easily the dimension and shapes, I will try wath @lana sujested, but can I change the sketch after the skSolve() call?

• Member, Developers Posts: 953 ✭✭✭✭
Yep, what @lana said. If your intention is to simplify sketches for extrusions and apply fillets later, then using opFillet on model edges is the way to go. Once you have 3D geometry to work with, you can now leverage the vast library of queries to select and process the specific corners you want to fillet.