2 Replies Latest reply on Feb 18, 2017 7:12 AM by Voverrr Mironoff

    How to get name of face?

    Voverrr Mironoff


      I try to manually select the face of some component in assembly and then with API get the name or some another identifier of this face. Something like "faceone@partone"

      I want to write this identifier in the variable and then, after clearing selection, reselect this face, using this unique name.


      Also in the part template, I can previously name these two faces, which I will use further. But I can't find how to read this name from the part.


      Thank you.

        • Re: How to get name of face?
          Keith Rice

          Entities like faces, edges, and vertices don't have unique names pre-assigned to them (unlike features, bodies, components, and dimensions) so I would not try to use IModelDocExtension.SelectByID2 to select them, particularly not faces.


          If you're in a part, you can name an entity using IPartDoc::SetEntityName and then later re-access it using IPartDoc::GetEntityByName. If you're not in a part, you can use persistent IDs. You can also write a traversal function that finds exactly what entity you're looking for every time.


          Since you didn't give any details about the problem you're trying to solve, it's hard to give specific advice.



          SolidWorks API Training and Services

          • Re: How to get name of face?
            Voverrr Mironoff

            ok, maybe I move in the whole wrong way?

            I try to write the macro to create such slot in plywood parts.

            1. manually select faces or whole components/

            2. create 3d sketch along the line of intersections these faces: 4 (construction)line

            3. create the plane in the midpoint one of these lines/

            4. create rectangular sketch on this plane

            5. create the square hole from this sketch in the first component in one direction.

            6. create another hole in the second component in opposite direction.


            Probably already some macro exists to create such connections? Maybe some SolidWorks' operation useful for it?

            sorry for russian:


            as result: