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:
<p>public void doProcessSelection()</p><p> {</p><p> SelectionMgr selector = assembly.SelectionManager;</p><p> int quantity = selector.GetSelectedObjectCount();</p><p> Debug.WriteLine("selected {0} surface", quantity);</p><p> for (int i = 1; i <= quantity; ++i)</p><p> {</p><p> try</p><p> {</p><p> Face2 face = (Face2)selector.GetSelectedObject6(i, -1);</p><p> Feature feature = (Feature)face.GetFeature();</p><p> Surface surface = (Surface)face.GetSurface();</p><p> planeBase = planeBase == null && surface.IsPlane() ? face : planeBase;</p><p> firstCylinderBase = firstCylinderBase == null && surface.IsCylinder() ? face : firstCylinderBase;</p><p> secondCilinderBase = secondCilinderBase == null && surface.IsCylinder() ? face : secondCilinderBase;</p><p> }</p><p> catch (Exception ex)</p><p> {</p><p> Debug.WriteLine("process selected faces error: {0}. \\n\\tstack trace: {1}", ex.Message, ex.StackTrace);</p><p> };</p><p> }</p><p> Debug.WriteLine("processing select of user ... ok");</p><p> }</p>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:
<p>Feature feature = planeLocator.Component.FeatureByName("mouting-plane");</p><p>feature.Select(true);</p>But Face2 don't have Select() method.
How I can make AddMate for this entities?
Advance thanks for help!
SolidworksApi macros