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.
Using a closed loop sketch as path for opSweep
mortezaPourmohamadi
Member Posts: 9 ✭
Hi,
I'm trying to use a sketch inside FS as a path for the opSweep function.
It works fine when the sketch contains a few connected lines, but it throws an error as soon as it becomes a closed-loop (e.g. a rectangular path).
Any idea how it can be resolved?
@opSweep: SWEEP_PATH_FAILED
onshape/std/geomOperations.fs (const opSweep)
onshape/std/feature.fs (defineFeature)
Case Carcass (const plyBody)
I'm trying to use a sketch inside FS as a path for the opSweep function.
It works fine when the sketch contains a few connected lines, but it throws an error as soon as it becomes a closed-loop (e.g. a rectangular path).
Any idea how it can be resolved?
var path1 = newSketch(context, id + "path1", {
"sketchPlane" : qCreatedBy(makeId("Front"), EntityType.FACE)
});
skRectangle(path1, "rectangle1", {
"firstCorner" : vector(0, 0) * inch,
"secondCorner" : vector(10, 10) * inch
});
// Create sketch entities here
skSolve(path1);
var profile1 = newSketch(context, id + "profile1", {
"sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE)
});
skCircle(profile1, "circle1", {
"center" : vector(0, 0) * inch,
"radius" : 0.5 * inch
});
// Create sketch entities here
skSolve(profile1);
opSweep(context, id + "sweep1", { // @opSweep: SWEEP_SELECT_PATH
"bodytype" : ToolBodyType.SOLID,
"operationType" : NewBodyOperationType.NEW,
"profiles" : qCreatedBy(id + "profile1", EntityType.FACE),
"path" : qCreatedBy(id + "path1", EntityType.EDGE)
});
and the error message:
and the error message:
Tagged:
0
Best Answer
-
Jacob_Corder Member Posts: 137 PRO@mortezaPourmohamadi
Did you try Kontstantins solution? When sketches are solved, the entites become wire bodies. It is also true that multiple edges are created as Konstantin stated above.
for the profile you could use
sketchEntityQuery(id+"profile1", EntityType.EDGE, "circle1");
or
qAdjacent(qCreatedBy(id+"profile1",EntityType.FACE),AdjacencyType.EDGE,EntityType.EDGE)
for the path if it is closed, qAdjacent(qCreatedBy(id+"path1",EntityType.FACE),AdjacencyType.EDGE,EntityType.EDGE)
or
sketchEntityQuery(id+"path1", EntityType.EDGE, "rectangle1");
2
Answers
This didn't solve the issue, though. There is no BODY in the "path1" sketch, so the resulting WIRE and EDGE list would be empty.
Did you try Kontstantins solution? When sketches are solved, the entites become wire bodies. It is also true that multiple edges are created as Konstantin stated above.
for the profile you could use
sketchEntityQuery(id+"profile1", EntityType.EDGE, "circle1");
or
qAdjacent(qCreatedBy(id+"profile1",EntityType.FACE),AdjacencyType.EDGE,EntityType.EDGE)
for the path if it is closed, qAdjacent(qCreatedBy(id+"path1",EntityType.FACE),AdjacencyType.EDGE,EntityType.EDGE)
or
sketchEntityQuery(id+"path1", EntityType.EDGE, "rectangle1");
This worked beautifully!