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.
Sketch on Mate Connector
nlazzara
Member Posts: 4 PRO
I'm working on a featurescript that takes a mate connector as an input, makes a sketch on a plane that is orthogonal to the mate connector, and revolves the sketch. My question is, if I create a mate connector with opMateConnector, how do I later query it for use in other functions like newSketchOnPlane? (for context of the code snippet, upperMC is an evMateConnector of the input mate connector)
opMateConnector(context, id + "mateConnector1", {
"coordSystem" : upperMC
});
opTransform(context, id + "transform3", {
"bodies" : qCreatedBy(id + "mateConnector1", EntityType.BODY),
"transform" : rotationAround(line(upperMC.origin, upperMC.xAxis), 90 * degree)
});
var newSketchMC = evMateConnector(context, {
"mateConnector" : qCreatedBy(id + "transform3", EntityType.BODY)
});
const sketchUpperID = id + "upperBore";
const upperBore = newSketchOnPlane(context, id + "sketch1", {
"sketchPlane" : qUnion([newSketchMC])
});
0
Comments
Do you need the MC in the final feature? You could just apply the transform to upperMC cSys, then use plane(cSys).
Otherwise, try:
var newSketchMC = evMateConnector(context, { "mateConnector" : qCreatedBy(id + "mateConnector1", EntityType.BODY) }); const sketchUpperID = id + "upperBore"; const upperBore = newSketchOnPlane(context, id + "sketch1", { "sketchPlane" : plane(newSketchMC) });Thanks Neil! That did the trick. Still getting my head around selecting/querying things that I create within featurescripts.