Greetings!
I have problems with add mate for Face2 and Feature, because Face2 don' have Select() method.
I work with model of shaft:
Here my code:
public void doProcessSelection()
{
SelectionMgr selector = assembly.SelectionManager;
int quantity = selector.GetSelectedObjectCount();
Debug.WriteLine("selected {0} surface", quantity);
for (int i = 1; i <= quantity; ++i)
{
try
{
Face2 face = (Face2)selector.GetSelectedObject6(i, -1);
Feature feature = (Feature)face.GetFeature();
Surface surface = (Surface)face.GetSurface();
planeBase = planeBase == null && surface.IsPlane() ? face : planeBase;
firstCylinderBase = firstCylinderBase == null && surface.IsCylinder() ? face : firstCylinderBase;
secondCilinderBase = secondCilinderBase == null && surface.IsCylinder() ? face : secondCilinderBase;
}
catch (Exception ex)
{
Debug.WriteLine("process selected faces error: {0}. \n\tstack trace: {1}", ex.Message, ex.StackTrace);
};
}
Debug.WriteLine("processing select of user ... ok");
}
When doProcessSelection() is finishes work, variable planeBase will be referenced on the plane(1).
Plane (2), she have a name, i found using references geometry:
Feature feature = planeLocator.Component.FeatureByName("mouting-plane");
feature.Select(true);
But Face2 don't have Select() method.
How I can make AddMate for this entities?
Advance thanks for help!
SolidworksApi macros