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.
Implicit mate connectors in custom features
kevin_o_toole_1
Onshape Employees, Developers, HDM Posts: 565
By now you might have seen the Improvements to Onshape - March 1st, 2019 post, which mentions, among other things, a new ability to mate connectors on the fly inside a feature dialog:
I thought I would also mention to the FeatureScript forum that this new functionality works just as well in custom features!
For example, the @maximilian_schommer 's recent LaserIt feature has a "reference frame" parameter. His feature code hasn't changed, but as of today, that same feature now allows you to select/edit the mate connector on the fly, without creating a separate Mate Connector feature:
Since LaserIt's "Reference frame" only allows mate connectors, the mate connector selection mode is always on:
Another recent example is @MBartlett21 's improvements to @Jake_Rosenfeld 's Calculate bounds feature:
Notably, the feature's "Reorient X-axis" option is no longer necessary! The user now has full control of that axis by directly editing the implicit mate connector itself. This means it's now much easier to write any custom features like this, since a single query parameter can provide the full interface necessary to control every aspect of that coordinate system.
And since the "Mate connector or face for coordinate system" parameter also allows selecting things other than mate connectors, this parameter has a "Select mate connectors" button you can press to stop selecting geometry and start inferring mate connectors on that geometry:
The "Select mate connectors" button will be added to any query parameter allowing BodyType.MATE_CONNECTOR, QueryCompoundFilter.ALLOWS_AXIS, or QueryCompoundFilter.ALLOWS_POINT. It works just as well for single selections and for multiple. If you want to disable this functionality, you can add the new UIHint.PREVENT_CREATING_NEW_MATE_CONNECTORS to your query parameter.
Happy FeatureScripting!
I thought I would also mention to the FeatureScript forum that this new functionality works just as well in custom features!
For example, the @maximilian_schommer 's recent LaserIt feature has a "reference frame" parameter. His feature code hasn't changed, but as of today, that same feature now allows you to select/edit the mate connector on the fly, without creating a separate Mate Connector feature:
Since LaserIt's "Reference frame" only allows mate connectors, the mate connector selection mode is always on:
annotation { "Name" : "Reference Frame", "Filter" : BodyType.MATE_CONNECTOR, "MaxNumberOfPicks" : 1 } definition.referenceFrame is Query;
Notably, the feature's "Reorient X-axis" option is no longer necessary! The user now has full control of that axis by directly editing the implicit mate connector itself. This means it's now much easier to write any custom features like this, since a single query parameter can provide the full interface necessary to control every aspect of that coordinate system.
And since the "Mate connector or face for coordinate system" parameter also allows selecting things other than mate connectors, this parameter has a "Select mate connectors" button you can press to stop selecting geometry and start inferring mate connectors on that geometry:
annotation { "Name" : "Mate connector or face for coordinate system", "Filter" : BodyType.MATE_CONNECTOR || GeometryType.PLANE, "MaxNumberOfPicks" : 1 } definition.mateConnector is Query;
Happy FeatureScripting!
3
Comments
Why do you have to release updates on a Friday? This is work so I have to resist playing with it over the weekend... 😀
Cheers, Owen.
HWM-Water Ltd
@owen_sparks
I have just released an update to the Calculate Bounds feature that allows it to calculate the minimum bounds of 3d parts.
I have also changed the UI a lot (with help from @Jake_Rosenfeld )
You can no longer select faces to use as coordinate systems.
IR for AS/NZS 1100
HWM-Water Ltd
HWM-Water Ltd
If you keep on commenting on it, it will stay up the top, even without pinning
IR for AS/NZS 1100
HWM-Water Ltd
HWM-Water Ltd
HWM-Water Ltd