Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

ST10 SDK Application,Documents.Add() broken...

Creator
Creator

Our company has recently upgraded from ST9 to ST10 and C# code which previously worked is no longer working..  even the sample code found here for the SE Framework gives the error.. 

 

https://docs.plm.automation.siemens.com/docs/se/109/api/SolidEdgeFramework~Documents~Add.html

 

When it his the Add() method, a message in SE popus up "Cannot access file" and then C# throws an "Access Denied" excepton.

 

System.Runtime.InteropServices.COMException (0x80030005): Access Denied. (Exception from HRESULT: 0x80030005 (STG_E_ACCESSDENIED))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at SolidEdgeFramework.Documents.Add(Object ProgID, Object TemplateDoc)

 

Thanks,

Matt

7 REPLIES 7

Re: ST10 SDK Application,Documents.Add() broken...

Gears Phenom Gears Phenom
Gears Phenom

@MattG

 

I can confirm this works in SE2019.   I do not have a ST10 Environment to test.

 

Do you have the latest MP for ST10?

Matt Johnson
Solid Edge Certified Professional
Solid Edge 2019 (SEEC) - Production
NX12 (Tc Integration)
Teamcenter 10.1.7

Re: ST10 SDK Application,Documents.Add() broken...

Creator
Creator

Hi Matt, thanks for the quick reply. 

We are on MP12, which I believe is the latest service pack. 

Re: ST10 SDK Application,Documents.Add() broken...

Gears Phenom Gears Phenom
Gears Phenom

@MattG

 

I have another thought that is not API related. 

Note the last line in the error "SolidEdgeFramework.Documents.Add(Object ProgID, Object TemplateDoc)"

So the Add method has 2 overrides...  ProjID and Template... 

And you say that SE throws "Cannot access file" error.

This leads me to think your templates are not defined. 

Be sure to define both the "Edit Create Options"  and the "Set Default Templates"

templates.png

 

Matt Johnson
Solid Edge Certified Professional
Solid Edge 2019 (SEEC) - Production
NX12 (Tc Integration)
Teamcenter 10.1.7

Re: ST10 SDK Application,Documents.Add() broken...

Gears Phenom Gears Phenom
Gears Phenom

@MattG

 

any follow up on this?  did you get it working? 

Matt Johnson
Solid Edge Certified Professional
Solid Edge 2019 (SEEC) - Production
NX12 (Tc Integration)
Teamcenter 10.1.7

Re: ST10 SDK Application,Documents.Add() broken...

Creator
Creator

Hi Matt, sorry I was pulled off to another project and haven't had time to try this yet. I'm hoping to get to it this afternoon. Will definitely let you know how it goes.


Thanks,

Matt

 

Re: ST10 SDK Application,Documents.Add() broken...

Creator
Creator

@Johnson_BigMatt wrote:

@MattG

 

any follow up on this?  did you get it working? 


 

Hey Matt, I finally had a chance to check this out. Unfortunately everything looks correct in the templates.

 

Attached are screenshots of my configuration. I am unable to control most of it as it is setup by the DE department.  Keep in mind I am just a developer, not an engineer Smiley Happy 


Even if I create a brand new Assembly, using the 'Normal.asy' from the templates, and I point directly to the template, it now actually creates a new assemble file and then throws the cannot access file error. 

 

Snippet

refAssyDoc = (sea.AssemblyDocument)documents.Add(ProgId.AssemblyDocument, @"S:\Solid Edge ST10\Custom\Template\Normal\normal.asm");

 

It might help to know what it is we're attempting, and keep in mind that this worked fine in ST9, but my guess is there's a better way... 

 

The C# app grabs the currently open Assembly and creates two new Assembly files, one for Reference Parts and one for Non-Reference parts, moving the appropriate parts to each one.  (iterating through all of the occurrences etc)

 

It then saves each doc as a JT file:

 

Snippet

refAssyDoc.SaveAsJT(String.Format("{0}\\Ref_Parts.JT", diDestPath));
nonRefAssyDoc.SaveAsJT(String.Format("{0}\\BOM_Parts.JT", diDestPath));

 

Thanks a lot, again for all your help,

 

Matt

 

 

 

 

Re: ST10 SDK Application,Documents.Add() broken...

Creator
Creator

 Hi Matt, I replied about an hour ago but doesn't look like it has posted yet..  Regardless, I have a new update since.. I discovered that if I run the code and force a new document to be added using the templates on my machine: 

ie. C:\Program Files\Solid Edge ST10\Template\ANSI Inch\ANSI Ince Assemble.asm, that it works perfectly.  So, I've sent another notice to the DE in charge of SolidEgde to see if they can check my authority to the custom templates on the network. 

 

Thanks again for everything. I'll let you know how it turns out.

 

Matt