Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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_1kevin_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:
annotation { "Name" : "Reference Frame", "Filter" : BodyType.MATE_CONNECTOR, "MaxNumberOfPicks" : 1 }
definition.referenceFrame is Query;

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:
annotation { "Name" : "Mate connector or face for coordinate system", "Filter" : BodyType.MATE_CONNECTOR || GeometryType.PLANE, "MaxNumberOfPicks" : 1 }
definition.mateConnector is Query;

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!

Comments

  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    That's all rather good. Thank you.
    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.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    @kevin_o_toole_1
    @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.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Would it be worth pinning this topic for a while?
    O.S.

    Business Systems and Configuration Controller
    HWM-Water Ltd
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    I just pinned to the top of the FeatureScript category, that should be good enough :smile:

  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Thanks. O.S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    @owen_sparks
    If you keep on commenting on it, it will stay up the top, even without pinning :)
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    That
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Seems
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Like a lot of work 
    Business Systems and Configuration Controller
    HWM-Water Ltd
Sign In or Register to comment.