Attempting to retrieve LetterPreferences from a Note in a console C# program causes exception

I am attempting to retireve certain metadata from Note objects in a part via a console C# application in NX 9.0.3.4 MP3, but all my attempts have failed, as these have thrown Memory Access Violation exceptions (or similar). The metadata which I'm trying to retrieve is: Text size (size), alignment (AlignmentPosition), and the font index (Cfw.Font).

This is what I've tried so far:

EditSettingsBuilder (Part.SettingsManager.CreateAnnotationSettingsBuilder)The program crashes when attempting to create the settings builder.

DraftingNoteBuilder (Part.Annotations.CreateDraftingNoteBuilder)The program crashes when attempting to create the drafting note builder.

AskObjectPreferences (UFDrf.AskObjectPreferences)The program crashes when this method is called.

LetteringPreferences (Note.GetLetteringPrefences())The program crashes when attempting to retrieve the lettering preferences.

Has anyone else had this issue? Is this a known issue (I haven't located anything in GTAC)? Is there a workaround?

I was dealing with some drafting stuff recently, and getting errors, only to realize I was trying to do something with a "displayable object" after I had a "UF_CALL(UF_DISP_set_display(UF_DISP_SUPPRESS_DISPLAY));"

When I moved the code after a "UF_CALL(UF_DISP_set_display(UF_DISP_UNSUPPRESS_DISPLAY));", it worked much better :-)

Maybe try to move the code to a function, and try to call that function in a DLL used in an interactcive session. Once it works there, then see if it works in "batch"?

Ken

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.

Production: NX10.0.3.5 MP16/TC11.2I'd rather be e-steamed than e-diseaseled

Re: Attempting to retrieve LetterPreferences from a Note in a console C# program causes exception

If you run a program in batch mode with no NX GUI, NX *should* still write to a log file. Run your program, then check the temp directory for the latest syslog file; perhaps it will provide some clues.

Beyond that, I agree with Ken. Get it working in interactive mode, then try it with batch mode.