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.
Referencing a line from a sketch
arnaud_glacet673
Member Posts: 2 ✭
I just started using FeatureScript.
I am trying to create a revolve part by using a line from a sketch as my revolution axis.
How can I reference it? I tried to create a variable but no success.
Here is the code:
I am trying to create a revolve part by using a line from a sketch as my revolution axis.
How can I reference it? I tried to create a variable but no success.
Here is the code:
var sketch2 = newSketch(context, id + "sketch2", {
"sketchPlane" : definition.sPlane
});
skLineSegment(sketch2, "line3", {
"start" : vector(0, 0) * meter,
"end" : vector(0 ,0.1 ) * meter
});
skSolve(sketch2);
var section= qSketchRegion(id + "sketch1");
opRevolve(context, id + "revolve1", {
"entities" : section,
"axis" : line(vector(0, 0, 0) * meter, vector(0, 0, 0.1)*meter),
"angleForward" : 360 * degree
});
The problem is it only works if the selected plan is Right or Front. I would like to use the line created in sketch2.
Thank you
If I try to use: qCreatedBy(id + "sketch2",EntityType.EDGE) for the axis,I get an error:
The problem is it only works if the selected plan is Right or Front. I would like to use the line created in sketch2.
Thank you
If I try to use: qCreatedBy(id + "sketch2",EntityType.EDGE) for the axis,I get an error:
@opRevolve: Line should have an origin. |
0
Comments
In FeatureScript, the way to get information (like the position or direction) from the geometry you query is with evaluate functions. In your case, you could use either evLine or evAxis:
This should be a useful/common pattern in FS. You can see another example with more explanation on this step of the slot tutorial.
I definitely need to spend more time reading the doc.