Overview

The StepncSystem class controls administrative aspects of the STEP-NC DLL, like error reporting and license key checking. All state data is held within the library, the instance itelf does not hold any state data.

Error Messages and Tracing

You can control how the STEP-NC DLL notifies you about an error or other status information. The four different "Report" functions change how it displays the message. The default is ReportMessagebox(), which displays a pop-up dialog box. ReportConsole() tries to allocate a Console and prints the message whil ReportPrintf() does the same, but assumes a Console is attached to the process. Finally the ReportHold() mode does not print anything, but accumulates the messages in a string that you can handle yourself.

The STEP-NC DLL can emit a trace file that records each function as it is called. The function name is listed, sometimes with parameter values. This trace file is useful when trying to understand problems in deeply nested code, and in GUI applications where a simple status printout is not easy to do.

To enable the trace file, set the STEPNC_TRACEFILE environment variable to the name of a file.

set STEPNC_TRACEFILE=c:\dev\stepnc_log.txt

The contents of the file will look something like this:

CALL: AptStepMaker#1::Reset();
RET: CALL
CALL: AptStepMaker#1::FirstPathStartPoint(/*x*/ 0, /*y*/ 0, /*z*/ 0);
RET: CALL
CALL: AptStepMaker#1::DoExportUnvalidatedTolerances();
RET: CALL
CALL: GeomView#6::SetActiveWorkingStep(/*eid*/ 0);
RET: CALL
CALL: GeomView#6::SetActiveWorkingStep(/*eid*/ 0);
RET: CALL
CALL: Finder#2::Reset();
RET: CALL
CALL: AptStepMaker#1::Reset();
RET: CALL
CALL: AptStepMaker#1::NewProject(/*project_name*/ New Project);
RET: CALL
CALL: Finder#2::OpenProject(/*file_name*/ New Project);
RET: CALL
CALL: AptStepMaker#1::DefaultToInches();
RET: CALL

ClearMessageLog()

void ClearMessageLog ();

The ClearMessageLog() function clears the string containing accumulated error messages. This is only useful when cacheing of the messages is turned on with the ReportHold option.

FormatFile()

void FormatFile (
	System::String^ in_name,
	System::String^ out_name
	);

The FormatFile() is a simple utility function for analyzing data sets. It reads a STEP file from "in_name", recognizes and annotates any Application Objects with comments, and writes the result to "out_name". This function is the opposite of StripFile. The data is annotated in the same manner as the APT SaveAsModules() and Finder SaveAsModules()

GetKeyCompany()

static System::String^ GetKeyCompany ();

The GetKeyCompany() function examines the license key and returns the company name that the key was issued to.

GetKeyOwner()

static System::String^ GetKeyOwner ();

The GetKeyOwner() function examines the license key and returns the owner name that the key was issued to.

GetKeyPresent()

static System::Boolean GetKeyPresent ();

The GetKeyPresent() function returns true if a valid license key was found.

GetMessageLog()

System::String^ GetMessageLog ();

The GetMessageLog() function returns a string containing accumulated error messages. This is only useful when cacheing of the messages is turned on with the ReportHold option. The accumulated messages should be cleared after processing with the ClearMessageLog function.

ReportConsole()

void ReportConsole();

The ReportConsole() function changes the error reporting behavior of the DLL so that it tries to allocate a console for the application and print the message to that as with ReportPrintf.

ReportHold()

void ReportHold();

The ReportHold() function changes the error reporting behavior of the DLL to accumulate all error messages in a buffer. The GetMessageLog function returns the contents of this buffer and the ClearMessageLog function clears the buffer.

ReportMessagebox()

void ReportMessagebox ();

The ReportMessagebox() function changes the error reporting behavior of the DLL so that it displays each error messages in a Windows Error dialog box.

ReportPrintf()

void ReportPrintf ();

The ReportPrintf() function changes the error reporting behavior of the DLL so that it prints all error messages to stdout. Note that Windows forms applications may not have a console attached, so these messages will not be seen.

ReportSystemMessages()

void ReportSystemMessages (
	System::Boolean yn
	);

The ReportSystemMessages() function controls the display of lower-level system messages. When false, only high level API messages are displayed.

ReportWinconsole()

void ReportWinconsole ();

The ReportWinconsole() function changes the error reporting behavior of the DLL so that it tries to load a rose_log DLL and use the error reporting capabilities in that library to display messages.

SetKeyString()

static void SetKeyString(System::String^ value);

The SetKeyString() function specifies an encoded license string through an API call rather than finding the key in the registry or a file.

SetKeyFloatID()

static void SetKeyFloatID(System::String^ app_name);

The SetKeyFloatID() function switches to floating network license enforcement for enterprise applications. The DLL will look for a FlexNet license server with the "steptool" daemon and attempt to checkout a license for the given application name. This is a static function on the class, so it is called as follows:

STEPNCLib.StepncSystem.GetKeyCompany(appname)

Floating licenses are currently supported only on the Windows 64bit version of the STEP-NC DLL.

StripFile()

void StripFile (
	System::String^ in_name,
	System::String^ out_name
	);

The StripFile() function reads a STEP file from "in_name", removes any Application Object comments, and writes the result to "out_name". This function is the opposite of FormatFile. The data is formatted in the same manner as the APT SaveAsP21() and Finder SaveAsP21() functions.