AnsweredAssumed Answered

mate distance not working

Question asked by Vincent Sciaccaluga on May 14, 2020
Latest reply on May 19, 2020 by Vincent Sciaccaluga



i am currently trying to make a distance mate but without success. I have to mate a point (vertices) and a plane.The selection seems to work properly with SelectByID2 method but the mate does nothing afterwards.


it works good for the coincident mate with the same code structure and the selection between 2 planes.


Does anyone have an idea ? I followed the macro generated when I'm doing it myself manually...




public void SelectPointAndPlane(Point3D point, string plane)


            DocExtension.SelectByID2(plane, TemplateName.Plane, 0, 0, 0, true, 1, null, 0);

            DocExtension.SelectByID2("", TemplateName.Vertices, point.X, point.Y, point.Z, true, 1, null, 0);                       



private object[] PrepareMate()



            // Set the Entities To Mate

            object[] EntitiesToMate = new object[2];


            EntitiesToMate[0] = SelectionManager.GetSelectedObject6(1, -1);

            EntitiesToMate[1] = SelectionManager.GetSelectedObject6(2, -1);


            return EntitiesToMate;





public void CreateDistanceMate(double distance)



            // Create DistanceMateFeatureData

            IDistanceMateFeatureData MateData = DocAssembly.CreateMateData((int)swMateType_e.swMateDISTANCE);


            MateData.EntitiesToMate = PrepareMate();


            //// Set the Mate Alignment

            MateData.MateAlignment = 2;

            MateData.Distance = distance;

            MateData.FlipDimension = false;


            // Create the mate           

             FinalizeMate(MateData as IMateFeatureData);




private void FinalizeMate(IMateFeatureData currentMate)