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.
Rotate Mate Connector Button in Featurescript UI
HuguesLessardWRI
Member Posts: 14 PRO
Is there a way to display and use the button shown on the picture below on the UI of a custom feature script to rotate a mate connector 90° increment?
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565Actually this is definitely possible. A simple example:
FeatureScript 1204; import(path : "onshape/std/geometry.fs", version : "1204.0"); export import(path : "onshape/std/mateconnectoraxistype.gen.fs", version : "1204.0"); annotation { "Feature Type Name" : "Rotate a thing" } export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Thing", "Filter" : EntityType.BODY } definition.thing is Query; annotation { "Name" : "QuadRotationDirection", "UIHint" : "MATE_CONNECTOR_AXIS_TYPE", "Default" : MateConnectorAxisType.PLUS_X } definition.quadRotationDirection is MateConnectorAxisType; } { const rotationAmount is ValueWithUnits = { MateConnectorAxisType.PLUS_X : 0 * degree, MateConnectorAxisType.PLUS_Y : 90 * degree, MateConnectorAxisType.MINUS_X : 180 * degree, MateConnectorAxisType.MINUS_Y : 270 * degree, }[definition.quadRotationDirection]; opTransform(context, id + "transform1", { "bodies" : definition.thing, "transform" : rotationAround(Z_AXIS, rotationAmount) }); });
Example document11
Answers
Example document