Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File saving issue in NXOpen external program in NX 7.5

Status
Not open for further replies.

SelvarajC

New member
Nov 27, 2014
26
0
0
IN
Hi All,
I have created a NXOpen external program to open a part file and execute some operations and save as in another file name. This application is getting error in one particular system. The error is it could not able to save as or save the opened part file if folder length is more than 130 characters. It is saving if folder length less than 130 characters. when I try in interactive mode (File > Execute > NXOpen) it is saving fine if more than 130 character also. I am using maximum 24 character including extension for file name.
NXOpen.NXException: Internal error: memory access violation - This is the exception i am getting when i run the external program.

Here I have three questions.
1. Why only that particular system is getting this error.
2. Application saves the file when I run in interactive mode if folder length is more than 130 characters. Why external application gets fail?
3. Is it related to windows issue?


Thanks,
Selvaraj C
NX Automation Engineer.
 
Replies continue below

Recommended for you

I don't know if this is what you are running into, but I found this in the API reference docs:

uf_cfi.html said:
The following are the restrictions on the length of various items:

File Names are limited to UF_CFI_MAX_FILE_NAME_NCHARS characters
File Extensions are limited to 4 characters
Directory specifications are limited to MAX_FSPEC_NCHARS
characters
Full file specifications are limited to MAX_FSPEC_NCHARS
characters

Also, this:

uf_cfi_types.html said:
*/
/***************************************************************************
* Limit definitions
*
* UF_CFI_MAX_FILE_NAME_LEN, UF_CFI_MAX_FILE_NAME_SIZE, UF_CFI_MAX_PATH_NAME_LEN,
* UF_CFI_MAX_PATH_NAME_SIZE are all being deprecated because NX is moving to
* support multibyte characters. User written programs should start using the
* new definitions for file specifications and simple file names:
* CFI_MAX_FILE_NAME_BUFSIZE
* MAX_FSPEC_BUFSIZE should be used for buffer allocations and memory
* allocations, e.g. char my_fspec[MAX_FSPEC_BUFSIZE];
* CFI_MAX_FILE_NAME_NCHARS
* MAX_FSPEC_NCHARS should be used to limit the number of characters
* in a buffer. NX code will enforce these limits.
*
* MAX_FSPEC_BUFSIZE and MAX_FSPEC_NCHARS are defined in uf_defs.h.
*
* New routines have been added which will help in this transition:
* UF_TEXT_count_characters() will count the number of characters in a
* buffer.
* UF_TEXT_terminate_chars() will terminate a C string after the given
* number of characters.
*/

www.nxjournaling.com
 
You don't say what version of NX you are using, but I found for my NX8.5 installation that [tt]MAX_FSPEC_SIZE[/tt] is set to 256, so 130 characters should not be a problem.
Not sure what language you are developing in either, but are you sure you have declared the variable holding the save-as file specification large enough to hold your 130+ character path?


Graham Inchley, Systems Developer, Sandvik Coromant. HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX6.0.5.3 MP5
Testing: NX8.5.3.3 MP4 64bit | NX9.0.2.5
 
Status
Not open for further replies.
Back
Top