Cancel
Showing results for 
Search instead for 
Did you mean: 

SolidEdgeTCE::GetPDMCachePath() issue

Creator
Creator

Using C++ (Visual Studio 2017), ST10 MP3

 

I'm trying to get the path to the SE/TC cache, as follows:

 

SolidEdgeFramework::SolidEdgeTCEPtr tCE = m_pApp->GetSolidEdgeTCE();

// some other code that uses tCE without any trouble

BSTR * bCachePath = NULL;
tCE->GetPDMCachePath(bCachePath);
// this causes an access violation

// also tried
BSTR bCachePath;
tCE->GetPDMCachePath(&bCachePath);
// access violation again

tCE is definitely valid, as I successfully use it to download a file immediately before this call. I'm probably doing something stupid here Smiley Happy Any ideas?

 

3 REPLIES

Re: SolidEdgeTCE::GetPDMCachePath() issue

Creator
Creator

Of course, I can get that info from the active document...

 

SolidEdgeDocumentPtr theDoc = m_pApp->ActiveDocument;
theDoc->Activate();
std::wstring cachePath = theDoc->Path + L"\\";
// works great!

Would be nice to know where I'm going wrong with the other method, all the same...

Re: SolidEdgeTCE::GetPDMCachePath() issue

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Try to use it this way. The string pointer must point to a NULL address to be allocated locally, otherwise SE assumes an existing buffer and tries to fill it.

BSTR bCachePath = NULL;
tCE->GetPDMCachePath(&bCachePath);
Highlighted

Re: SolidEdgeTCE::GetPDMCachePath() issue

Creator
Creator

I knew I was doing something stupid! Thanks for your help!