Overview

The GenerateState class is a helper class for code generation with Generate. This class holds the last commanded positions, feed, speed, and so forth. The generator uses these values to avoid issuing duplicate moves to the same coordinates.

The GenerateState class is available in both .NET and Node environments. The documentation for the STEP-NC Control Library describes a lower level C++ version of this API, and includes more background discussion.

AddMoveComment()

void AddMoveComment (System::String^ f);		

void AddMoveComment (string f);				

The AddMoveComment() function appends an already-formatted comment to a string variable. These comments are returned by the GetMoveComment() function and prepended to the results of the next formatted MOVE event. The ClearMoveComment() function empties the string.

AddMovePrefix()

void AddMovePrefix (System::String^ f);			

void AddMovePrefix (string f);				

The AddMovePrefix() function appends some codes to a string variable. These codes are returned by the GetMovePrefix() function and prepended to the next move command. For example, a tool change event processing may add a "G43 H..." prefix to set tool offsets, which typically must be issued with the next G1 or G0 command. The ClearMovePrefix() function empties the string.

ClearCoolant()

void ClearCoolant();					 

The ClearCoolant() function sets all coolant-related variables to false. This includes GetCoolant(), GetCoolantMist(), and GetCoolantThru()

ClearFeed()

void ClearFeed();					 

The ClearFeed() function sets the GetFeed() value to ROSE_NULL_REAL.

ClearMoveComment()

void ClearMoveComment();				 

The ClearMoveComment() function sets the string returned by GetMoveComment() to a null string.

ClearMovePrefix()

void ClearMovePrefix();					 

The ClearMovePrefix() function sets the string returned by GetMovePrefix() to a null string.

ClearMovemode()

void ClearMovemode();					 

The ClearMovemode() function sets the GetMovemode() variable to -1.

ClearPosition()

void ClearPosition();					 

The ClearPosition() function sets all of the tool position and angle variables GetX/Y/Z/I/J/K/A/B/Cpos() to ROSE_NULL_REAL.

ClearProgramStats()

void ClearProgramStats();				 

The ClearProgramStats() function sets the variables initialized by SetProgramStats() to null or false. This includes GetProgramHas5axis() and GetProgramHasProbes().

ClearRefpoint()

void ClearRefpoint();					 

The ClearRefpoint() function clears any information about cutter contact direction and sets the reference point back to center, so IsRefpointCenter() is true.

ClearSpindle()

void ClearSpindle();					 

The ClearSpindle() function sets the GetSpindle() value to ROSE_NULL_REAL.

GetA/B/Cpos()

double GetApos();					 
double GetBpos();
double GetCpos();

The GetA/B/Cpos() functions return the last commanded value for the rotational axes. These are only set if the output style explicitly commands these axes. Some output styles tilt the tool by commanding an I/J/K direction vector, in which case these A/B/C values would remain null. These can be changed by the SetA/B/Cpos() functions.

GetCoolant()

System::Boolean GetCoolant();				

bool GetCoolant();					

The GetCoolant() function returns true if the last commanded state of flood coolant was on. The SetCoolant() function changes this value.

GetCoolantMist()

System::Boolean GetCoolantMist();			

bool GetCoolantMist();					

The GetCoolantMist() function returns true if the last commanded state of mist coolant was on. The SetCoolantMist() function changes this value.

GetCoolantThru()

System::Boolean GetCoolantThru();			

bool GetCoolantThru();					

The GetCoolantThru() function returns true if the last commanded state of through-spindle coolant was on. The SetCoolantThru() function changes this value.

GetFeed()

double GetFeed();					 

The GetFeed() function returns the last commanded numeric feedrate. The SetFeed() function changes this value. This is not affected by rapid moves, but the GetMovemode() function can be used to test whether the last commanded move was rapid motion.

GetI/J/Kpos()

double GetIpos();					 
double GetJpos();
double GetKpos();


void GetIJKpos(						
	[System::Runtime::InteropServices::Out] double %i,
	[System::Runtime::InteropServices::Out] double %j,
	[System::Runtime::InteropServices::Out] double %k
	);

double[3] GetIJKpos();					

The GetI/J/Kpos() functions return the last commanded value for the tool axis direction vector. The values may be ROSE_NULL_REAL if the axis has not yet been commanded. This is always set when the tool axis changes, even if the output styles commands the A/B/C axes. There are functions for each individual direction component and a group function that returns all of the components as a direction object. These can be changed by the SetI/J/Kpos() functions.

The GetIJKpos() function for .NET copies the values to three return parameters, while the Node version returns an array with the three values.

GetLastBlocknum()

System::Int64 GetLastBlocknum();			

int GetLastBlocknum();					

The GetLastBlocknum() function returns the last assigned block number. To increment or change the count, use GetNextBlocknum() or SetBlocknum()

GetMoveComment()

System::String^ GetMoveComment();			

string GetMoveComment();				

The GetMoveComment() function returns a string containing already-formatted comments that should be prepended to the results of the next formatted MOVE event. This is typically used for trace comments. See AddMoveComment() for more discussion.

GetMovePrefix()

System::String^ GetMovePrefix();			

string GetMovePrefix();					

The GetMovePrefix() function returns a string containing codes that should be prepended to the next move command. This is typically used for setting tool offsets. See AddMovePrefix() for more discussion.

GetMovemode()

System::Int64 GetMovemode();				

int GetMovemode();					

The GetMovemode() function returns a numeric value for the last commanded modal move state. There are many modal states on CNC controls, but this value is used to avoid duplicating G0/G1 codes when issuing a series of moves. This value is -1 when unknown, zero when in "G0" rapid motion, one in "G1" motion, 2 in "G2" circular interpolation, etc. The SetMovemode() function changes this value.

GetNextBlocknum()

System::Int64 GetNextBlocknum();			

int GetNextBlocknum();					

The GetNextBlocknum() function increments the block number counter and returns the new value. The GetLastBlocknum() function returns the value without incrementing it and SetBlocknum() assigns a new value.

GetNextProbeIndex()

System::Int64 GetNextProbeIndex();			

int GetNextProbeIndex();				

The GetNextProbeIndex() function increments the number of probing operations visited so far and returns the new value. The GetProbeIndex() function returns the value without incrementing and SetProbeIndex() assigns a new value.

GetOtherObj()

System::Int64 GetOtherObj(System::String^ nm);		

int GetOtherObj(string nm);				

The GetOtherObj() function returns an ID from a dictionary of STEP objects. This dictionary may be used by some formatting functions to keep information for future use. The SetOtherObj() assigns a value to the dictionary.

GetProbeCount()

System::Int64 GetProbeCount();				

int GetProbeCount();					

The GetProbeCount() function returns the number of probing operations found in the program. This does not count any disabled operations that would not be visited by the cursor. This value is computed by the SetProgramStats() function.

GetProbeIndex()

System::Int64 GetProbeIndex();				

int GetProbeIndex();					

The GetProbeIndex() function returns the number of probing operations visited so far. It is incremented by the GetNextProbeIndex() function and can be given a new value by the SetProbeIndex() function.

GetProgramHas5axis()

System::Boolean GetProgramHas5axis();			

bool GetProgramHas5axis();				

The GetProgramHas5axis() function returns true if any of the toolpaths in the program include a tool axis curve. This does not count any disabled operations that would not be visited by the cursor. This value is computed by the SetProgramStats() function.

GetProgramHasProbes()

System::Boolean GetProgramHasProbes();			

bool GetProgramHasProbes();				

The GetProgramHasProbes() function returns true if the program includes any probing operations. This does not count any disabled operations that would not be visited by the cursor. This value is computed by the SetProgramStats() function. This is equivalent to testing whether GetProbeCount() is greater than zero.

GetSpindle()

double GetSpindle();					 

The GetSpindle() function returns the last commanded spindle speed. The value is zero if the spindle was off, positive if the direction was counter clockwise, or negative if it is clockwise. The SetSpindle() function will change this value.

GetX/Y/Zpos()

double GetXpos();					 
double GetYpos();
double GetZpos();


void GetXYZpos(						
	[System::Runtime::InteropServices::Out] double %x,
	[System::Runtime::InteropServices::Out] double %y,
	[System::Runtime::InteropServices::Out] double %z
	);

double[3] GetXYZpos();					

The GetXpos() functions return the last commanded value for the tool position. The values may be ROSE_NULL_REAL if the position has not yet been commanded. There are functions for each individual axis and a group function that returns all of the components as a point object. These can be changed by the SetX/Y/Zpos() functions.

The GetXYZpos() function for .NET copies the values to three return parameters, while the Node version returns an array with the three values.

IsChangedIJKpos()

System::Boolean IsChangedIJKpos(			
	double i, double j, double k
	);


bool IsChangedIJKpos(					
	double i, double j, double k
	);

bool IsChangedIJKpos(
	double[3] ijk
	);

The IsChangedIJKpos() function compares the input direction with the last commanded tool axis direction and returns true if any of the components have changed. This does an epsilon comparison of the values using the default ROSE_EPSILON value. This is almost alwasys a stricter comparison than the IsFormattedIJK() comparison of the generator class.

IsChangedIJKposAssume3axis()

System::Boolean IsChangedIJKposAssume3axis(		
	double i, double j, double k
	);


bool IsChangedIJKposAssume3axis(			
	double i, double j, double k
	);

bool IsChangedIJKposAssume3axis(
	double[3] ijk
	);

The IsChangedIJKposAssume3axis() function returns true if any of the direction components have changed, but assumes that if the program does not have any 5-axis moves and the GetIJKpos() values are null, that they are equivalent to (0,0,1). As with IsChangedIJKpos(), this does an epsilon comparison of the values rather than the formatted comparison.

The direction components can be provided as separate values or as an array.

IsChangedXYZpos()

System::Boolean IsChangedXYZpos(			
	double x, double y, double z
	);


bool IsChangedXYZpos(					
	double x, double y, double z
	);

bool IsChangedXYZpos(
	double[3] xyz
	);

The IsChangedXYZpos() function returns true if any of the position components have changed. This does an epsilon comparison of the values using the default ROSE_EPSILON value. This is almost alwasys a stricter comparison than the IsFormattedXYZ() comparison of the generator class.

The coordinates can be provided as separate values or as an array.

IsRefpointCenter()

System::Boolean IsRefpointCenter();			

bool IsRefpointCenter();				

The IsRefpointCenter() function returns true if move commands are in reference to the tool center point. This is the default.

IsRefpointContact()

System::Boolean IsRefpointContact();			

bool IsRefpointRight();					

The IsRefpointContact() function returns true if move commands are in reference to the tool contact point. STEP-NC process data can provide a range of surface normals for cutter contact paths, but traditionally machines are only able to handle contact on the left or right side of the tool. Change this value by calling SetRefpointCenter() or SetRefpointContact().

IsRefpointLeft()

System::Boolean IsRefpointLeft();			

bool IsRefpointLeft();					

The IsRefpointLeft() function returns true if in contact mode and SetRefpointLeft() has been called.

IsRefpointRight()

System::Boolean IsRefpointRight();			

bool IsRefpointRight();					

The IsRefpointRight() function returns true if in contact mode and SetRefpointRight() has been called.

IsUnknownIJKpos()

System::Boolean IsUnknownIJKpos();			

bool IsUnknownIJKpos();					

The IsUnknownIJKpos() function returns true if all of the components of the last commanded tool axis direction are null.

IsUnknownXYZpos()

System::Boolean IsUnknownXYZpos();			

bool IsUnknownXYZpos();					

The IsUnknownXYZpos() function returns true if all of the components of the last commanded tool position are null.

Reset()

void Reset();						 

The Reset() function clears all variables and returns them to the default state.

SetA/B/Cpos()

void SetApos (double s);				 
void SetBpos (double s);
void SetCpos (double s);

The SetA/B/Cpos() functions set the last commanded value for the rotational axes. See GetA/B/Cpos() for more discussion.

SetBlocknum()

void SetBlocknum(System::Int64 num);			

void SetBlocknum(int num);				

The SetBlocknum() function sets the current number used when prepending a "N" prefix to lines. See GetLastBlocknum() for more discussion.

SetCoolant()

void SetCoolant (System::Boolean yn);			

void SetCoolant (bool yn);				

The SetCoolant() function sets the last commanded on/off state for flood coolant to the given value. See GetCoolant() for more discussion.

SetCoolantMist()

void SetCoolantMist (System::Boolean yn);		

void SetCoolantMist (bool yn);				

The SetCoolantMist() function sets the last commanded on/off state for mist coolant to the given value. See GetCoolantMist() for more discussion.

SetCoolantThru()

void SetCoolantThru (System::Boolean yn);		

void SetCoolantThru (bool yn);				

The SetCoolantThru() function sets the last commanded on/off state for through-spindle coolant to the given value. See GetCoolantThru() for more discussion.

SetFeed()

void SetFeed (double s);				 

The SetFeed() function sets the last commanded feedrate to the given value. See GetFeed() for more discussion.

SetI/J/Kpos()

void SetIpos (double s);				 
void SetJpos (double s);
void SetKpos (double s);
void SetIJKpos (double i, double j, double k);

void SetIJKpos (double[3] xyz);				

The SetI/J/Kpos() functions set the last commanded components for the tool axis direction vector. There are functions for each individual component and a group function that sets all of them from a direction object. See GetIJKpos for more discussion.

For SetIJKpos(), the direction components can be provided as separate values or as an array.

SetMovemode()

void SetMovemode (System::Int64 m);			

void SetMovemode (int m);				

The SetMovemode() function sets a numeric value for the last commanded modal move state - zero for G0, one for G1, etc. This value is used to avoid duplicating G0/G1 codes when issuing a series of moves. See GetMovemode() for more discussion.

SetOtherObj()

void SetOtherObj(					
	System::String^ nm,
	System::Int64 id
	);


void SetOtherObj(					
	string nm,
	int id
	);

The SetOtherObj() function adds an object value to a dictionary of STEP objects. This dictionary may be used by some formatting functions to keep information for future use. See GetOtherObj() for more discussion.

SetProbeCount()

void SetProbeCount(System::Int64 d);			

void SetProbeCount(int d);				

The SetProbeCount() function sets the count of probing operations found in the program. Normally, this value is computed and set by the SetProgramStats() function. See GetProbeCount() for more discussion.

SetProbeIndex()

void SetProbeIndex(System::Int64 d);			

void SetProbeIndex(int d);				

The SetProbeIndex() function sets the number of probing operations visited so far. It can be incremented by the nextProbeIndex() function. See GetProbeIndex() for more discussion.

SetProgramHas5axis()

void SetProgramHas5axis(System::Boolean yn);		

void SetProgramHas5axis(bool yn);			

The SetProgramHas5axis() function sets a flag indicating whether any five axis moves are found in the program. Normally, this value is computed and set by the SetProgramStats() function. See GetProgramHas5axis() for more discussion.

SetProgramStats()

void SetProgramStats(Adaptive^ ctl);			

void SetProgramStats(Adaptive ctl);			

The SetProgramStats() function scans the process being traversed by a cursor and sets some variables based on what the process holds. In particulary, the GetProgramHas5axis() and GetProbeCount() variables are set.

The input cursor is not changed in any way.

SetRefpointCenter()

void SetRefpointCenter();				 

The SetRefpointCenter() function sets the IsRefpointCenter() flag to true and IsRefpointContact() to false, indicating that commands are in reference to the tool center point.

SetRefpointContact()

void SetRefpointContact();				 

The SetRefpointContact() function sets the IsRefpointCenter() false to true and IsRefpointContact() to true, indicating that commands are in reference to the cutter contact point. A call to this function is expected to be followed by a call to SetRefpointLeft() or SetRefpointRight().

SetRefpointLeft()

void SetRefpointLeft();					 

The SetRefpointLeft() function sets the IsRefpointLeft() flag to true and IsRefpointRight() to false.

SetRefpointRight()

void SetRefpointRight();				 

The SetRefpointRight() function sets the IsRefpointLeft() flag to false and IsRefpointRight() to true.

SetSpindle()

void SetSpindle (double s);				 

The SetSpindle() function sets the last commanded spindle speed. The value is zero if the spindle was off, positive if the direction was counter clockwise, or negative if it is clockwise. See GetSpindle() for more discussion.

SetX/Y/Zpos()

void SetXpos (double s);				 
void SetYpos (double s);
void SetZpos (double s);
void SetXYZpos (double x, double y, double z);

void SetXYZpos (double[3] xyz);				

The SetX/Y/Zpos() functions set the last commanded value for the tool position. There are functions for each individual axis and a group function that sets all of the components from a point object. See GetX/Y/Zpos() for more discussion.

For SetXYZpos(), the coordinates can be provided as separate values or as an array.