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.
FS sketch not forming on new plane
Nik_at_OSU
Member Posts: 2 EDU
Hi,
I'm trying to create a plane from 3 meshpoints and create a sketch on that plane. anyone know why it's not working?
Thank you all for your help,
Nik
I'm trying to create a plane from 3 meshpoints and create a sketch on that plane. anyone know why it's not working?
FeatureScript 2045;
import(path : "onshape/std/common.fs", version : "2045.0");
annotation { "Feature Type Name" : "Mesh Points to Sketch" }
export const MeshPointstoSketch = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define preconditions for the feature to activate
annotation { "Name" : "Mesh point 1", "Filter" : EntityType.VERTEX && AllowMeshGeometry.YES }
definition.meshPoint1 is Query;
// Define preconditions for the feature to activate
annotation { "Name" : "Mesh point 2", "Filter" : EntityType.VERTEX && AllowMeshGeometry.YES }
definition.meshPoint2 is Query;
// Define preconditions for the feature to activate
annotation { "Name" : "Mesh point 3", "Filter" : EntityType.VERTEX && AllowMeshGeometry.YES }
definition.meshPoint3 is Query;
}
{
// Define input parameters
const meshPoint1 = evVertexPoint(context, {
"vertex" : definition.meshPoint1
});
const meshPoint2 = evVertexPoint(context, {
"vertex" : definition.meshPoint2
});
const meshPoint3 = evVertexPoint(context, {
"vertex" : definition.meshPoint3
});
// Create a plane using the three mesh points
var _origin = (meshPoint1 + meshPoint2 + meshPoint3) / 3;
var _normal = cross((meshPoint3 - meshPoint1), (meshPoint2 - meshPoint1));
var Plane1 = opPlane(context, id + "Plane1", {
"plane" : plane(_origin, _normal),
});
var sketch1 = newSketch(context, id + "sketch1", {
"sketchPlane" : qCreatedBy(makeId("Plane1"), EntityType.FACE)
});
skLineSegment(sketch1, "line1", {
"start" : vector(0, 0) * inch,
"end" : vector(10, 10) * inch
});
skSolve(sketch1);
});
Thank you all for your help,
Nik
0
Comments