1 Reply Latest reply on Nov 20, 2015 4:24 PM by Dmitry Zamoshnikov

    swSelectType_e blank entries in third column

    John Alexander

      2012 SOLIDWORKS API Help - swSelectType_e

       

      In the documentation, under "Remarks", the third column lists the value returned by getselectedobject3(). There are several selection types for which that column is blank (and several where the second and fourth columns are also blank). Is this meant to communicate that those methods cannot be used to return that particular selection type?

       

      Also, if so many selection types actually return an iFeature object, why not just make that a selection type of its own and let the developer use iFeature.GetTypeName2 from there? The way it is implemented now, if you want to check for selected iFeature objects generically, you have to include every possible iFeature in the bunch.

        • Re: swSelectType_e blank entries in third column
          Dmitry Zamoshnikov

          I still have to check what I'm selecting.  I think it's required if you want select only certain features through filtering (face, body, line, point, etc...)

           

          Here's what I'm doing with it:

           

                 public Component2 SelectedComponent()

                  {

                      Component2 swCom;

           

           

                      // make sure we're selecting components

                      // this is required so I can check if it's a component or a face.

                      // without this I couldn't calculate lengths, or get custom info

                      swSelectType_e selType =

                          (swSelectType_e)mSwSelMgr.GetSelectedObjectType3(1, -1);

           

           

                      // are the components selected from the feature manager tree?  Are faces selected

                      // from the assembly?

                      if (selType == swSelectType_e.swSelFACES)

                      {

                          // a face is an entity.  need to convert it to a component

                          Entity swEntity = (Entity)mSwSelMgr.GetSelectedObject6(1, -1);

                          swCom = (Component2)swEntity.GetComponent();

                      }

                      else // no need to convert to a component

                          swCom = (Component2)mSwSelMgr.GetSelectedObject6(1, -1);

           

          ....