Reply

Problem in using FindBrokenLinks and RedefineLinks functions in RevisionManager

[ Edited ]

 

Hi,

I have a simple SolidEdge assembly  which  has two child parts . This assembly is modeled using virutal component method.The assembly sketches drive the  child component dimensions.When I rename the root assembly , the link between the child and parent is lost.When I update the sketch values in root assembly they are not reflecting in the child components. I fixed the broken links using RevisionManager interactively. I need the same thing to be done using the SolidEdge API.

I tried it using the FindBrokenLinks() function in RevisionManager.But the function is crashing.Please check the code and help me out.

I am using SolidEdge V18.

The code is as follows:

void SEMgr::UpdateLinks(CString ReplaceCmpt)

{

    HRESULT hres=S_OK;

 

   IRMgrAppPtr pREApp;

 

   bool initOK = false;

 

   hres = CoInitialize(NULL);

 

   if(SUCCEEDED(hres))

    initOK = true;

 

 

   if (FAILED(pREApp.GetActiveObject("RevisionManager.Application")))

   {

 

    HRESULT hr = pREApp.CreateInstance("RevisionManager.Application");

    if(FAILED(hr))

    {

     ::MessageBox(0,"Failed to create an instance of Solid Edge",0,0);

     return ;

    }

 

    CString DtlLog = "D:\\Detailoutput.txt";

    CString SummLog = "D:\\Summoutput.txt";

 

    _variant_t DtlLogFile;

    VariantInit(&DtlLogFile);

    DtlLogFile.vt = VT_BSTR;

    DtlLogFile.bstrVal = DtlLog.AllocSysString();

 

    _variant_t SummLogFile;

    VariantInit(&SummLogFile);

    SummLogFile.vt = VT_BSTR;

    SummLogFile.bstrVal = SummLog.AllocSysString();

 

    _variant_t bProcessAssem;

    VariantInit(&bProcessAssem);

    bProcessAssem.vt = VT_BOOL;

    bProcessAssem.boolVal = true;

 

    _variant_t bProcessPart;

    VariantInit(&bProcessPart);

    bProcessPart.vt = VT_BOOL;

    bProcessPart.boolVal = true;

 

    //To set the list of files to be processed

 

    CComBSTR bstrInputFile(ReplaceCmpt);

    CComSafeArray FilesList;

    FilesList.Add(bstrInputFile);

 

    VARIANT InputFileList;

    VariantInit(&InputFileList);

    InputFileList.vt=VT_ARRAY;

    InputFileList.parray = FilesList;

 

    _variant_t bProcessOthers;

    VariantInit(&bProcessOthers);

    bProcessOthers.vt = VT_BOOL;

    bProcessOthers.boolVal = false;

 

 

    pREApp->FindBrokenLinks(InputFileList,

     "",

     bProcessOthers,

     bProcessAssem,

     bProcessOthers,

     bProcessPart,

     bProcessOthers,

     bProcessOthers,

     &DtlLogFile,

     &SummLogFile

     );

 

 

    FilesList.Destroy();

 

   }

 

 

}

 

 

Posted by: Shafi Shaik
Post date: 9/3/2009 2:11:11 AM

1 REPLY

RE: Problem in using FindBrokenLinks and RedefineLinks functions in RevisionManager

[ Edited ]

 

Hi

I have fixed the problem by using the GetLinkedDocuments() and using the SetPath() functions.

 

Posted by: Shafi Shaik
Post date: 9/6/2009 7:11:22 PM