Reply

OpenWithTemplate()

I have a C++ program that manages the full lifecycle of Edge instances. When it has an instance open, I am trying to get it to open ProE assemblies & parts to convert them to SE format (I successfully used an earlier version of this program to convert some old drawings that were in DWG format - I was able to do that using the Open() method).

 

To open these assemblies, I am trying to use the OpenWithTemplate() method.

 

SolidEdgeFramework::DocumentsPtr pDocs = m_pApplication->Documents;

SolidEdgeAssembly::AssemblyDocumentPtr pAssy = pDocs->OpenWithTemplate(_bstr_t(filePath), _bstr_t(_T("G:\\iso assembly.asm")));

 

This causes SE to throw an error about not being able to access the template. The indicated file has normal file attributes and permissions should allow access. I have tried a few ways of passing the template name to it, including a call to

 

SolidEdgeFramework::DocumentTypeConstants docType = SolidEdgeFramework::igAssemblyDocument;

CString tempName = GetTemplateFileName(&docType);

 

But this never returns.

 

Any ideas as to what's causing this behaviour? Cheers.

3 REPLIES

Re: OpenWithTemplate()

Nick,

I believe the specified template has to be just the pure file name of a Solid Edge file in the template folder (I.e. "Normal.par").
Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: OpenWithTemplate()

That's not what the documentation shows, and not what GetTemplateFileName() returns either (I realised that method pops up the template selection window, but was hidden behind something else so I didn't see it). But even when I use that method as the second argument in OpenWithTemplate(), it still says that the template was not found, couldn't be accessed, etc. I did try with just the plain filename as well though, and no good either.

 

Oddly, I can open an assembly using Open(), but of course it pops up the template selection window still.

Re: OpenWithTemplate()

Both methods work - SE was throwing me off with an innaccurrate error message. Problem was actually down to the name of the file to be opened, and not the template at all!