10 Replies Latest reply on Feb 20, 2016 11:33 PM by Simone Padovan

    How to Select a Face Programmatically? (SelectByID2 does not work the way I expected)

    Raul Aguilar

      I am trying to select a face programmatically by calling the SelectByID2 method and passing the coordinates, like this:

       

      boolstatus = swDoc.Extension.SelectByID2("", "FACE", 3.1882410297802153, 2.2859999999998593, -0.021997412278324191, false, 0, Nothing, 0)

       

      That seems to work fine. However, my objective is to get the face UV Bounds. To do that I thought I could do this:

       

      SelectionCount = swSelMgr.GetSelectedObjectCount2(-1)

      face = swSelMgr.GetSelectedObject6(1,-1)

      uvBounds = face.GetUVBounds()

       

      UminFace = uvBounds(0)

      UmaxFace = uvBounds(1)

      VminFace = uvBounds(2)

      VmaxFace = uvBounds(3)

       

      The problem is that when I do this, SelectionCount is zero. If I manually select the face instead of using the SelectByID2 method, then everything works as expected. I thought that using the SelectByID2 method would be the same as manually selecting the face, but obviously I am wrong. Can somebody please explain why the SelectByID2 method does not work in this case? Is there another way to programmatically select the face so that swSelMgr knows that the face has been selected?

       

      Thanks in advance for any help you can give me.