3 Replies Latest reply on Apr 28, 2014 7:22 PM by Artem Taturevych

    Using GetComponentByName() incorrectly?

    Robert Owens

      I am in an assembly and am trying to select a top-level subassembly. I do not know why the following code does not return a IComponent2 object.

       

      CComPtr<IComponent2> swComp;

      CComPtr<IAssemblyDoc> swAsm;

      swAsm = swModel; //swModel previously defined and pointing to assembly via swApp->IActivateDoc3()

      std::cout << swComp << std::endl;   // 0x000000

      swAsm->GetComponentByName(L"HYDRAULICJACK1Z-1, &swComp);

      std::cout << swComp << std::endl;   // 0x000000

       

      The name of the component is HYDRAULICJACK1Z.

       

      Am I overlooking something? This follows the example in the API help.