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.
opRevolve help, syntax
scott_walsh809
Member Posts: 2 ✭
I am very new learning FS. I am trying to have the user select a plane, enter a few numbers and get a revolve to a solid body. This code says "Cannot resolve entities", so something must be wrong with my entities query.
FeatureScript 432;
FeatureScript 432;
import(path : "onshape/std/geometry.fs", version : "432.0");
annotation { "Feature Type Name" : "Irevolve" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
annotation { "Name" : "My Query", "Filter" : GeometryType.PLANE, "MaxNumberOfPicks" : 1 }
definition.myPlane is Query;
annotation { "Name" : "Diameter 1" }
isLength(definition.inletID, LENGTH_BOUNDS);
annotation { "Name" : "Diameter 2" }
isLength(definition.outletID, LENGTH_BOUNDS);
annotation { "Name" : "Length" }
isLength(definition.HubLength, LENGTH_BOUNDS);
}
{
var thissketch = newSketch(context, id, { "sketchPlane" : definition.myPlane });
skLineSegment(thissketch, "InletPlaneLine", {
"start" : vector(0, 0) * inch,
"end" : vector(0 * inch, definition.inletID / 2)
});
skLineSegment(thissketch, "OutletPlaneLine", {
"start" : vector(definition.HubLength, 0 * inch),
"end" : vector(definition.HubLength, definition.outletID / 2)
});
skLineSegment(thissketch, "HubAxis", {
"start" : vector(0, 0) * inch,
"end" : vector(definition.HubLength, 0 * inch)
});
skLineSegment(thissketch, "HubContour", {
"start" : vector(0 * inch, definition.inletID / 2),
"end" : vector(definition.HubLength, definition.outletID / 2)
});
skSolve(thissketch);
// var sketchEdges = qSketchRegion(id + "thissketch", false);
var myCurves = qSketchRegion(id + "thissketch", true);
var myAxis = sketchEntityQuery(id + "thissketch", EntityType.EDGE, "HubAxis");
opRevolve(context, id + "revolve1", {
"entities" : myCurves,
"axis" : myAxis,
"angleForward" : 30 * degree
});
});
0
Comments
makes the queries resolve.
The second issue is that you're passing a query for an edge to opRevolve, when it takes a Line (at some point I hope to make operations more tolerant of things like that). To get the revolve to work, change the "axis" line to:
which will turn the edge into a line.
One suggestion for the future is to post a link to a version of your public document instead of copy/pasting text (that makes it easier for helpful folks on the forum to see the exact error).
Hope this helps!