1 Reply Latest reply on Nov 19, 2015 7:56 AM by Ivana Kolin

    how to get the part by seleced face

    文泉 邹

      I select a face in solidworks,and get it by SelectionManager,how can i get the part which the face belong to??


      Dim swSelmgr As SelectionMgr

      dim aee as object

      dim part as partdoc

      swSelmgr = iSwApp.ActiveDoc.SelectionManager

      aee = swSelmgr.GetSelectedObject6(1, -1)


        • Re: how to get the part by seleced face
          Ivana Kolin
          Option Explicit
          Sub main()
          Dim swApp As SldWorks.SldWorks
          Dim swMod As SldWorks.ModelDoc2
          Dim selMod As SldWorks.ModelDoc2
          Dim partDoc As SldWorks.partDoc
          Dim swSelmgr As SelectionMgr
          Dim swComp As SldWorks.Component2
          Set swApp = Application.SldWorks
          Set swMod = swApp.ActiveDoc
          Set swSelmgr = swMod.SelectionManager
          Set swComp = swSelmgr.GetSelectedObjectsComponent4(1, -1)
          Set selMod = swComp.GetModelDoc2
          Set partDoc = selMod
          End Sub