AnsweredAssumed Answered

Align Axes on CoordinateSystem C#

Question asked by David King on Apr 19, 2018
Latest reply on Apr 19, 2018 by David King

I’m working on Solidworks 2014 and am trying to make a mate between a component and a coordinate system within an assembly.


The manual way to do it is to select the origin on the component and the coordinate system and click mate, then ensure Align Axes is selected.


When I create the mate programmatically in C# after selection (using 1 as the mark) does not select Align Axes:

int error;

swModel.OOGetAssemblyDoc().AddMate4((int) swMateType_e.swMateCOINCIDENT, -1, false, 0, 0, 0, 0, 0, 0, 0, 0, false, true, out error);

if ((swAddMateError_e)error != swAddMateError_e.swAddMateError_NoError) {

     throw new Exception("Failed to add mate.  swAddMateError_e: " + (swAddMateError_e)error);



Any version of the align type:





or switching flip does not select align axes.


I tried to change the mate type to coordinate system however it gives an invalid selection error.


The documentation does not help with this:


I tried recording a macro while doing it manually however it didn’t produce something that worked while playing it back.


Does anyone know how to select the Align Axes box on mate programmatically.


Align Axes.png