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.
Crash Course on opMateConnectors
Dylan_Stewart
Member, Developers Posts: 107 PRO
Hello everyone, I've got another question for you all.
I am trying to get the hang of the opMateConnector function... What I am trying to do is to create a sketch and then place 2 mate connectors on the sketch. One on the top left side and one on the top right side.
The code I have thus far, obviously doesn't work, but maybe one of you could help me out.
I am trying to get the hang of the opMateConnector function... What I am trying to do is to create a sketch and then place 2 mate connectors on the sketch. One on the top left side and one on the top right side.
The code I have thus far, obviously doesn't work, but maybe one of you could help me out.
FeatureScript 422; import(path : "onshape/std/geometry.fs", version : "422.0"); annotation { "Feature Type Name" : "Mate Connector" } export const mateConnectorTest = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Width" } isLength(definition.width, LENGTH_BOUNDS); annotation { "Name" : "Height" } isLength(definition.height, LENGTH_BOUNDS); } { var width = definition.width; var height = definition.height; var verticies = [ vector(0 * inch, 0 * inch), vector(0 * inch, height), vector(width, height), vector(width, 0 * inch) ]; var sketch1 = newSketch(context, id + "sketch1", { "sketchPlane" : qCreatedBy(makeId("Front"), EntityType.FACE) }); skLineSegment(sketch1, "line1", { "start" : verticies[0], "end" : verticies[1] }); skLineSegment(sketch1, "line2", { "start" : verticies[1], "end" : verticies[2] }); skLineSegment(sketch1, "line3", { "start" : verticies[2], "end" : verticies[3] }); skLineSegment(sketch1, "line4", { "start" : verticies[3], "end" : verticies[0] }); skSolve(sketch1); var origin = vector(0, 0, 0) * inch; var leftxaxis = vector(0, -1, 0) * inch; var leftzaxis = vector(1, 0, 0) * inch; var leftskplane = plane(origin, leftxaxis, leftzaxis); opMateConnector(context, id + "leftMateConnector1", { "coordSystem" : leftskplane, "owner" : qCreatedBy(id + "sketch1", EntityType.FACE) }); var rightxaxis = vector(0, 1, 0) * inch; var rightzaxis = vector(1, 0, 0) * inch; var rightskplane = plane(origin, rightxaxis, rightzaxis); opMateConnector(context, id + "rightMateConnector1", { "coordSystem" : rightskplane, "owner" : qCreatedBy(id + "sketch1", EntityType.FACE) }); });
Digital Engineering
0
Comments
The profile is just a cube.
https://cad.onshape.com/documents/f1a8ef47a7624f874d0e07ab/w/0b375ed6f9452e936eb73f20/e/f908b7a6816575518888532e
Mate Connector Pattern