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.
plane creation questioning
hervé_pipon
Member Posts: 60 ✭✭
Hello
My question :how can I create a normal plane, with an origin point specified on its normal line, and with a pierce point on another specified point.....
Let see on a drawing :
I created the circle0 with the following code :
And circle_1 with this code :
My problem is that I want the circle_1 center to be on the line id+1+"line" (but not on endpoint) , and that the corresponding plane pass through apex, and taht the circle will pierce apex
I don't know if i t's very clear
My question :how can I create a normal plane, with an origin point specified on its normal line, and with a pierce point on another specified point.....
Let see on a drawing :
I created the circle0 with the following code :
var R = definition.Radius; var Angle = definition.myAngle; var x0 = definition.Xcoord; var y0 = definition.Ycoord; var z0 = definition.Zcoord; const sphereCenter = vector(x0, y0, z0) ; const sphereRadius = R.value * meter ; const ApexPoint = vector(0 ,0 ,R.value ) * meter ; const FirstRadius = vector( sphereCenter + ApexPoint ); opFitSpline(context, id + "line_0" , { "points" : [ sphereCenter, ApexPoint ] }); // a vertical radius as reference var sketch = newSketch(context, id + "sketch", {"sketchPlane" : qCreatedBy(makeId("Front"), EntityType.FACE) }); skPoint(sketch, "apex" , { "position" : vector(x0, z0) + vector(0 ,R.value ) * meter }); skSolve(sketch); const sketchPlane_0 = plane(ApexPoint, FirstRadius); var sketchId = id + ("sketch_0" ~ 0); var sketch_0 = newSketchOnPlane(context, sketchId, { "sketchPlane" : sketchPlane_0 }); skCircle(sketch_0, "circle0", { "center" : vector(0, 0) * meter, "radius" : sphereRadius * sin(Angle) }); skPoint(sketch_0, "apex" , { "position" : vector(0,0) * meter }); skSolve(sketch_0);
And circle_1 with this code :
const endPointX = sphereCenter[0] + sphereRadius * sin(Angle) * cos(angleInDegrees); const endPointY = sphereCenter[1] + sphereRadius * sin(Angle) * sin(angleInDegrees); const endPointZ = sphereCenter[2] + sphereRadius * cos(Angle); const endPoint = vector(endPointX, endPointY, endPointZ); var newId = id + i + 1 + "line_" ; opFitSpline(context, newId, { "points" : [ sphereCenter, endPoint ] }); var plane_temp = plane(ApexPoint,endPoint); var sketchId = id + ("sketch" ~ i + 1); var sketch_loop = newSketchOnPlane(context, sketchId, { "sketchPlane" : plane_temp }); var newCircleId = "circle_" ~ (i + 1); skCircle(sketch_loop, newCircleId, { "radius" : sphereRadius * sin(Angle) }); var newPointId = "point_" ~ (i + 1); skPoint(sketch_loop, newPointId , { "position" : vector(0, 0) * meter});
My problem is that I want the circle_1 center to be on the line id+1+"line" (but not on endpoint) , and that the corresponding plane pass through apex, and taht the circle will pierce apex
I don't know if i t's very clear
Tagged:
0
Comments
I would like to find the right parameters for the function like :
See here from line 289:
https://cad.onshape.com/documents/12312312345abcabcabcdeff/w/a855e4161c814f2e9ab3698a/e/577e2aaf45a542f98d9343c7
The code is measuring the distance between the vertex and the line, which results in the "parameter" (0 to 1) where that minimum distance is measured along the line, then justs retrieves the tangent line and builds the plane from the vertex and normal. Simples.
I don't understand why
But it works
But how can I give a name to this plane ?
On planeDirection=vector(1, 1, 0), it turns out the plane(origin is Vector, normal is Vector, x is Vector) constructor normalizes the inputs, so all it needs is an origin and one or two dimensionless vectors.
Too bad, I wanted to avoid basing my Feature on measurements.