1 Reply Latest reply on Dec 25, 2013 10:15 AM by Noam Yogev

    how to select and highlight a feature in tree, and in view, by ID??

    Noam Yogev

      Hi

       

      im creating an addin to solidworks, what i want is to find a feature in an opened part by ID, or name or any stringlike value.

      I'm looking for the right function:

       

      wanted scenario:

       

      supply id string

      feature will be highlighted in view

      feature will show selected in part tree explorer

       

      Thanks

        • Re: how to select and highlight a feature in tree, and in view, by ID??
          Noam Yogev

          ok, here's the result as I managed to solve it :

           

          internal void NavigateToObject(string p)

                  {     

                      ClearSWSelection();

                      ModelDoc2 swModel = mSWApplication.IActiveDoc2;                     

                      SelectionMgr slMgr = swModel.SelectionManager;                     

                      Feature feature = (Feature)slMgr.GetSelectedObject(1);         

                      swModel.Extension.SelectByID2(p, "BODYFEATURE", 0, 0, 0, false, 0, null, 0);           

                  }