3 Replies Latest reply on Mar 27, 2013 4:06 AM by Wang Zhiwie

    Trouble Getting mate info (GetSupplementalfaces)

    Wayne Maiuri

      Has anyone out there tried using the getSupplementFaces call on Mate2?  I can't seem to get it to work.


      I am not sure if it is the right way to do what I am trying to do.  I would like to get the names of the entities the selected mate is attached to.



      Part1 1 has a coincidental mate between

          Part1s Front Plane

          Assy1s Front Plane


      How do I return the names of these entities.


      Any help would be greatly appreciated.


      In advance thank you very much!

        • Re: Trouble Getting mate info (GetSupplementalfaces)
          Keith Rice



          I was curious about this, too, and contacted SolidWorks.


          This method does not work right now. There is an SPR out for it: SPR 664841.


          In the mean time you have to do the following to use the following alternative method to get the faces used by mates:


          1.Traverse the feature tree and gets the mates

          2. From mates gets the MateEntity.

          3. From MateEntity get the references , and set these reference to the Entity object.

          4. And Set this Entity object to the Face2 object .


          Attached is a macro and sample file that SolidWorks Corp supplied me with that accomplishes these steps.



          Video Tutorials for the SolidWorks API

            • Re: Trouble Getting mate info (GetSupplementalfaces)
              Mohammad Shaheer Zubairi

              Hi Keith,



              Thank you for sharing the code.


              First of all, I tried it and got the names of the components in each of the mates. For instance, Concentric1 between Part 1 and Part 2. However, the code above doesn't output the features in the mate (e.g. Face1_part1 and Face2_part2). One can see these features by right clicking on individual mates.



              Secondly, in my assembly, the final mate is between Top Plane of the assembly and Top Plane of part2. The code outputs me the name of assembly and the name part2 by using  swMate.MateEntity(0).ReferenceComponent.Name2 and swMate.MateEntity(1).ReferenceComponent.Name2, respectively. However, it gives the InvalidCastExpection error at swFace = swEntity line. Any idea what's happening there? Is it because the mate is between planes and not faces?


              Any help would be much appreciated. I'd like to take the opportunity to thank you for giving me your valuable time.





            • Re: Trouble Getting mate info (GetSupplementalfaces)
              Wang Zhiwie


              I also met this problem,I can't find any way to solve this problem. I want your help to solve this problem.

              Any help would be much appreciated,

              In advance thank you very much!