Showing results for 
Search instead for 
Do you mean 
Reply

AccessViolation in NXOpen.dll

[ Edited ]

Hallo everybody,

 

I am having a problem with NX Open C# I cannot resolve.

I am using VS 2012 Ultimate and .Net Framework 4.0. When I try to save a CLS-File using

 

workPart.CAMSetup.OutputClsf(objects1, "CLSF_STANDARD", "C:\\Users\\me\\test.cls", NXOpen.CAM.CAMSetup.OutputUnits.Metric);

 

I get "An unhandled exception of type 'System.AccessViolationException' occurred in NXOpen.dll"

 

Any ideas on that?

4 REPLIES

Re: AccessViolation in NXOpen.dll

First step would be to look in the syslog, and find out what happened before the AccessViolationException.

 

Alternatively, put your code in a Try/Catch block, and run it in debug mode, so that you can see the details of the exception (the call stack, specifically).

 

Possible causes of the problem:

(1) There's something wrong with "objects1".

(2) You don't have permission to create a file in the folder C:\users\me

山田
yamada

Re: AccessViolation in NXOpen.dll


Ingfu wrote:

workPart.CAMSetup.OutputClsf(objects1, "CLSF_STANDARD", "C:\\Users\\me\\test.cls", NXOpen.CAM.CAMSetup.OutputUnits.Metric);


Why do you use double backslashes?

they are not needed in C# on Windows.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: AccessViolation in NXOpen.dll

I think the double backslashes *are* needed in C#.

 

You can either write "C:\\Users\\me\\test.cls".

 

Or you can write @"C:\Users\me\test.cls".

 

In VB, you can just write "C:\Users\me\test.cls", but this won't work in C#. You'll get an "unrecognized escape sequence" error.

山田
yamada

Re: AccessViolation in NXOpen.dll

Sorry, forgot that this is still C with it's specialities Smiley Happy

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community