Overview
The Generate class creates a string description of a process seen by an Adaptive object. To generate a G-code program, select the machine style and then traverse a STEP-NC process, stopping at each event, and print the string returned by the FormatEvent() function. It is easy to substitute your own logic for tool changes, program start, etc. Simply watch for the event and emit your own codes instead of the ones returned by the Generate object.
There are several built-in styles: G-Code for Fanuc, Haas, Heidenhain, Okuma, Siemens style controls, five axis via TCP with IJK, AC, BC, or AB moves, Renishaw and native probing cycles, as well as other languages like APT, DMIS, or CRCL. Call SetStyle() to start with a base style and modify many different aspects of the output.
You can provide your own behavior for parts of the code generation with the SetEventFn(), SetTypeFn(), and SetOtherFn() hooks. Formatting functions use an Adaptive object that holds the position in the process, and a GenerateState object that keeps the current commanded state of machine tool axes and modal variables.
Examples
The simple example below reads a STEP-NC file and
calls ExportCNCFile() to print Haas-style
codes for the entire process to the program.nc
file.
static void Main(string[] args) { Finder finder = new Finder(); Generate gen = new Generate(); // Read a STEP-NC file finder.Open238(datafile.stpnc); gen.SetStyle(haas); // set HAAS as desired style gen.ExportCNCFile(program.nc); // export codes }
The example below replaces ExportCNCFile() with its own loop with the Adaptive cursor for more control over the output. It also creates Haas-style codes, but prints them to the console and adds some customization for the start of the program and tool changes. The tool change logic uses one of the utility functions provided by the class to print an informative tool change comment, but substitutes its own logic for the change.
This example uses the .NET API, a version using the Node API is in the following section
static String my_proj_start(Generate gen, GenerateState gs, Adaptive cur) { String ret = gen.FormatComment(gs,My great program); ret += gen.FormatBlock(gs,*** My program start logic here ***); return ret; } static String my_tool_change(Generate gen, GenerateState gs, Adaptive cur) { // print tool description and follow with our logic String ret = gen.FormatOther(gs,cur,tool-comment); ret += gen.FormatBlock(gs,*** My tool change logic here ***); return ret; } static void Main(string[] args) { Finder finder = new Finder(); Adaptive cur = new Adaptive(); Generate gen = new Generate(); GenerateState gs = new GenerateState(); // Read a STEP-NC file finder.OpenProject(datafile.stpnc); // Start traversing the process within the file. cur.StartProject(); cur.SetWantedAll(true); gen.SetStyle(haas); gen.SetUnitSystem(cur); gen.SetEventFn(Adaptive.CtlEvent.PROJECT_START, my_proj_start); gen.SetEventFn(Adaptive.CtlEvent.TOOL_CHANGE, my_tool_change); while (cur.Next() != Adaptive.CtlEvent.DONE) { Console.Write(gen.FormatEvent(gs,cur)); } }
When run against a sample process, the program generates the following. The custom program start and tool change portions are highlighted.
(MY GREAT PROGRAM) *** My program start logic here *** (WORKINGSTEP: LINE 33 WS 1) (TOOL CHANGE: TOOL 1) ( DIAMETER: 25.4MM) ( CORNER RADIUS: 0.508MM) ( TAPER: 0DEG) ( TIP ANGLE: 0DEG) *** My tool change logic here *** M3S2000 M08 G0X0.Y0.Z-2.54 X-184.15Y143.51Z-55.88 Z-80.772 G1X-152.4F1016. X152.4 Y124.46 X-152.4 [ ... and so on ... ]
If we change the style string from haas
to heidenhain
, our program will produce different output:
; My great program *** My program start logic here *** ; Workingstep: line 33 WS 1 ; TOOL CHANGE: TOOL 1 ; diameter: 25.4mm ; corner radius: 0.508mm ; taper: 0deg ; tip angle: 0deg *** My tool change logic here *** N1 S2000 M3 N2 M08 N3 G0 X0 Y0 Z-2.54 A0 C0 N4 X-184.15 Y143.51 Z-55.88 N5 Z-80.772 N6 G1 X-152.4 F1016 N7 X152.4 N8 Y124.46 N9 X-152.4 [ ... and so on ... ]
Example in Node
The example shown above can also use the Node.js binding:
const stp = require('../build/Release/StepNode'); const apt = new stp.AptStepMaker(); const finder = new stp.Finder(); const ctl = new stp.Adaptive(); const gen = new stp.Generate(); const genstate = new stp.GenerateState(); function main(argv) { // Read a STEP-NC file finder.OpenProject("datafile.stpnc"); // Start traversing the process within the file. ctl.StartProject(); ctl.SetWantedAll(true); gen.SetStyle("haas"); gen.SetUnitSystem(ctl); while (ctl.Next() != stp.CtlEvent.DONE) { switch (ctl.Event()) { case stp.CtlEvent.PROJECT_START: // print a comment and follow with our logic // process.stdout.write(gen.FormatComment(genstate,"My great program")); process.stdout.write("My program start logic here\n"); break; case stp.CtlEvent.TOOL_CHANGE: // print a description of the tool and follow with our logic process.stdout.write(gen.FormatOther(genstate,ctl,"tool-comment")); process.stdout.write("My tool change logic here\n"); break; default: process.stdout.write(gen.FormatEvent(genstate,ctl)); break; } } return 0; } process.exit(main(process.argv));
Updating Older Code
Earlier versions of the API had separate functions G-code output as part of the APT class. Replace the ExportAs<fmt> functions with the Generate class SetStyle() and ExportCNCFile() functions as below:
Generate fmt = new Generate(); '' Instead of apt.ExportAsHaas("filename.nc") '' use this: fmt.SetStyle(haas); fmt.ExportCNCFile(filename.nc); OLD FUNCTION NEW STYLE ExportAsAPT --> SetStyle(apt) ExportAsDmisCNC --> SetStyle(dmis-cnc) ExportAsDmisManual --> SetStyle(dmis-manual) ExportAsESAB --> SetStyle(esab-cut) ExportAsFanuc --> SetStyle(fanuc) ExportAsHaas --> SetStyle(haas) ExportAsHeidenhainAC --> SetStyle(heidenhain-ac) ExportAsHeidenhainBC --> SetStyle(heidenhain-bc) ExportAsMDSI --> SetStyle(mdsi) ExportAsOkuma --> SetStyle(okuma) ExportAsSiemens --> SetStyle(siemens) ExportCNC --> use the same format string
Instead of the APT SetCNC<param> and GetCNC<param> functions, use the following functions on the Generate class to control those parameters. Add the calls after the SetStyle() to override the default values for that particular style.
SetCNCexportComments --> SetTraceComments SetCNCexportExecDisabled --> APT SetExecutableIsEnabled(false) SetCNCexportExecEnabled --> APT SetExecutableIsEnabled(true) SetCNCexportInsertStopAfterWorkingstep --> SetStopAfterWorkingstep SetCNCexportIsTracking --> no longer used SetCNCexportMatrixOff --> SetUseXform(false) SetCNCexportMatrixOn --> SetUseXform(true) plus SetDstXform SetCNCexportNumberOfDigits --> SetDigits, SetAngleDigits, SetFeedDigits, SetIJKDigits, and SetSpindleDigits SetCNCexportProgramNum --> SetProgramNumber SetCNCexportSpeedOverride --> SetUseSpeedOverride SetCNCexportToolOpts --> SetUseToolConstChip SetCNCexportTraceability --> no longer used SetCNCexportUnits --> SetProgramUnit SetCNCexportUsingBlocknumbers --> SetUseBlocknums SetCNCexportUsingTCP --> SetUseTCP SetCNCexportWorkoffset --> SetWorkOffsetFrame GetCNCexportExecForBlock --> no longer used GetCNCexportExecForBlockNval --> no longer used GetCNCexportExecIsEnabled --> APT GetExecutableIsEnabled GetCNCexportToolpathForBlock --> no longer used GetCNCexportToolpathForBlockNval --> no longer used GetCNCexportToolpathParamForBlock --> no longer used GetCNCexportToolpathParamForBlockNval --> no longer used
The following functions remain in the APT interface because they set additional temporary information on the process rather than code generation parameters. As such, they may be renamed in the future.
GetCNCexportActualFlutes SetCNCexportActualFlutes SetCNCexportExecSpeedprofileActive GetCNCexportExecSpeedprofileActive
CatNumber()
System::String^ CatNumber( System::String^ s, double num ); System::String^ CatNumber( System::String^ s, double num, System::Int64 max_digits, System::Int64 min_digits ); string CatNumber( string s, double num int max_digits, (optional) int min_digits (optional) );
The CatNumber() function formats a floating point number as a string with a given maximum and minimum digits of precision. The result is concatenated to the end of the supplied string object and returned from the function.
CNC systems usually have a maximum number of digits, but some may also require a minimum number. A minimum digits value of -1 removes the trailing decimal point for integer values. If this is 0, the decimal point is retained.
If no max/min digits are given, the function uses the values from GetDigits() and GetMinDigits().
input 1.234567 max=5, min=-1 => 1.23457 max=2, min=-1 => 1.23 input 1.2 max=5, min=-1 => 1.2 max=2, min=0 => 1.2 max=2, min=2 => 1.20 input 1 max=5, min=-1 => 1 max=2, min=0 => 1. max=2, min=2 => 1.00
CatNumberAsAngle()
System::String^ CatNumberAsAngle( System::String^ s, double num );
The CatNumberAsAngle() function is a wrapper around CatNumber() that formats an angle value with the GetAngleDigits() and GetAngleMinDigits() precision values.
CatNumberAsFeed()
System::String^ CatNumberAsFeed( System::String^ s, double num );
The CatNumberAsFeed() function is a wrapper around CatNumber() that formats a feedrate value with the GetFeedDigits() and GetFeedMinDigits() precision values.
CatNumberAsIJK()
System::String^ CatNumberAsIJK( System::String^ s, double num );
The CatNumberAsIJK() function is a wrapper around CatNumber() that formats an IJK direction component value with the GetIJKDigits() and GetIJKMinDigits() precision values.
CatNumberAsSpindle()
System::String^ CatNumberAsSpindle( System::String^ s, double num );
The CatNumberAsSpindle() function is a wrapper around CatNumber() that formats a spindle speed value with the GetSpindleDigits() and GetSpindleMinDigits() precision values.
CatParam()
System::String^ CatParam( System::String^ s, System::String^ param ); System::String^ CatParam( System::String^ s, System::String^ param, double num ); System::String^ CatParam( System::String^ s, System::String^ param, double num, System::Int64 max_digits, System::Int64 min_digits ); string CatParam( System::String^ s, System::String^ param double num, (optional) System::Int64 max_digits, (optional) System::Int64 min_digits (optional) );
The CatParam() function appends a string for a parameter name and possibly a formatted number, separated by whitespace if the GetUseWhitespace() preference is true. This function is simply a more concise way equivalent to add optional whitespace, add the parameter string, and then a number formatted with CatNumber().
CatParamAsAngle()
System::String^ CatParamAsAngle( System::String^ s, System::String^ param, double num );
The CatParamAsAngle() function is a wrapper around CatParam() that formats an angle value with the GetAngleDigits() and GetAngleMinDigits() precision values.
CatParamAsFeed()
System::String^ CatParamAsFeed( System::String^ s, System::String^ param, double num );
The CatParamAsFeed() function is a wrapper around CatParam() that formats a feedrate value with the GetFeedDigits() and GetFeedMinDigits() precision values.
CatParamAsIJK()
System::String^ CatParamAsIJK( System::String^ s, System::String^ param, double num );
The CatParamAsIJK() function is a wrapper around CatParam() that formats an IJK direction component value with the GetIJKDigits() and GetIJKMinDigits() precision values.
CatParamAsSpindle()
System::String^ CatParamAsSpindle( System::String^ s, System::String^ param, double num );
The CatParamAsSpindle() function is a wrapper around CatParam() that formats a spindle speed value with the GetSpindleDigits() and GetSpindleMinDigits() precision values.
CatRequiredSpace()
System::String^ CatRequiredSpace (System::String^ s); string CatRequiredSpace (string s);
The CatRequiredSpace() function is a low-level function used to construct formatted text. It appends whitespace to the end of a string if the original string is not empty. This function is used for separating parameters when whitespace is always required.
CatSpace()
System::String^ CatSpace (System::String^ s); string CatSpace (string s);
The CatSpace() function is a low-level function used to construct formatted text. It appends whitespace to the end of a string if the original string is not empty and if the GetUseWhitespace() flag is true. This function is used to separate parameters that may or may not have space between them, like coordinates in a G-code block.
ExportCNCFile()
System::Boolean ExportCNCFile ( System::String^ filename );
The ExportCNCFile() function is a simple wrapper that writes a file containing the output returned by FormatEvent() for the contents of the current STEP-NC file. The output will be generated for all enabled executables using the current format settings of the Generate object. The function returns true if the file was exported successfully.
The sample program at the top of this page shows an alternative way of making codes, where you handle the loop yourself for customized output.
FormatBlock()
System::String^ FormatBlock( GenerateState^ vars, System::String^ str ); string FormatBlock( GenerateState vars, string str );
The FormatBlock() function is a low-level function used to construct formatted text. This takes a string, adds a newline, and prepends a block number (eg. "N1234") if the GetUseBlocknums() flag is true. The block number is given by vars.GetNextBlocknum(). The function returns the resulting string.
FormatBlockNonum()
System::String^ FormatBlockNonum( GenerateState^ vars, System::String^ str ); string FormatBlockNonum( GenerateState vars, string str );
The FormatBlockNonum() function is a low-level function used to construct formatted text. This takes a string and adds a newline. It is used for things that must never have a block number. The function returns the resulting string.
FormatComment()
System::String^ FormatComment( GenerateState^ vars, System::String^ str ); System::String^ FormatComment( GenerateState^ vars, System::String^ header, System::String^ str ); string FormatComment( GenerateState vars, string header, string str (optional) );
The FormatComment() function is a low-level function that encodes the input string as a comment in the manner appropriate for the output style. If two strings are given, they are concatenated with a colon separator as "header: str". The function returns an empty string if an empty input string is given.
The comment formatting may convert the strings to uppercase, strip unsupported characters, and wrap the string with delimiters.
FormatEvent()
System::String^ FormatEvent( GenerateState^ vars, Adaptive^ cursor ); string FormatEvent( GenerateState vars, Adaptive cursor );
The FormatEvent() function is the main process formatting function. This examines the most recent Event() in the cursor and calls one or more formatting functions to build a string that represents it. The function may return an empty string if nothing is needed.
Usually the cursor position is not changed, but sometimes formatting will advance the cursor. For example, when starting a probing operation, the formatting may iterate over the entire operation and return all of the moves necessary for the approach, touch and retract of the probe. The "vars" object is updated.
You can provide your own formatting function for an event with SetEventFn().
Finder finder = new Finder(); Adaptive ctl = new Adaptive(); Generate fmt = new Generate(); GenerateState vars = new GenerateState(); // Read a STEP-NC file finder.OpenProject(sample.stpnc); // Start traversing the process within the file. ctl.StartProject(); ctl.SetWantedAll(true); fmt.SetStyle(okuma); fmt.SetUnitSystem(ctl); while (ctl.Next() != Adaptive.CtlEvent.DONE) { Console.Write(fmt.FormatEvent(vars,ctl)); }
FormatMoveXYZ()
System::String^ FormatMoveXYZ( GenerateState^ vars, Adaptive^ cursor, double x, double y, double z ); string FormatMoveXYZ( GenerateState vars, Adaptive cursor, double x, double y, double z ); string FormatMoveXYZ_IJK( GenerateState vars, Adaptive cursor, double[3] xyz );
The FormatMoveXYZ() function returns a move command as if processing a MOVE event, but the given position is supplied by the caller rather than taken from a toolpath curve. The tool axis is not changed - use FormatMoveXYZ_IJK() to change the tool direction.
The position is given in program units and "vars" is updated. The position is used exactly as passed in, no destination transform is applied. The feed rate is not changed.
The function may return an empty string if no move is needed.
The coordinates can be provided as separate values or as an array.
FormatMoveXYZ_IJK()
System::String^ FormatMoveXYZ_IJK( GenerateState^ vars, Adaptive^ cursor, double x, double y, double z, double i, double j, double k ); string FormatMoveXYZ_IJK( GenerateState vars, Adaptive cursor, double x, double y, double z, double i, double j, double k ); string FormatMoveXYZ_IJK( GenerateState vars, Adaptive cursor, double[3] xyz, double[3] ijk );
The FormatMoveXYZ_IJK() function returns a move command as if processing a MOVE event, but the given position and tool axis direction is supplied by the caller rather than taken from a toolpath curve.
The position is given in program units and "vars" is updated. The position is used exactly as passed in, no destination transform is applied. The feed rate is not changed.
The function may return an empty string if no move is needed.
The coordinates and direction vectors can be provided as separate values or as a pair of arrays.
FormatOther()
System::String^ FormatOther( GenerateState^ vars, Adaptive^ cursor, System::String^ name ); string FormatOther( GenerateState vars, Adaptive cursor, string name );
The FormatOther() function keeps a dictionary of functions used by FormatEvent() to construct parts of the result text from the active state of the "cursor" and "vars" objects. The functions update "vars" as necessary and may advance the cursor. The function may return an empty string if no move is needed.
In our earlier example we called the "tool-comment" function. A partial list of available functions is shown below:
- "coolant"
- Turns flood, mist, or through-spindle coolant on or off as necessary based on the coolant state held by "vars" and the state of GetMoveIsCoolant(), GetMoveIsMistCoolant(), and GetMoveIsThruCoolant(). Calls "coolant-off" if needed to turn everything off. Called by the toolpath start event handling.
- "coolant-off"
- Turns off all coolant. Called by the tool change and program end event handling.
- "filename"
- Returns the name of the STEP-NC file as a comment. Usually called by the program start event handling.
- "move-contact"
- This is called by the MOVE event handling. If the cursor is currently traversing a cutter contact toolpath, this function examines the tool axis, movement direction, and surface normal direction. If it determines that the tool is contacting left or right, it will return the result of calling "refpoint-left" or "refpoint-right" respectively.
- "move-feed"
- This is called by the MOVE event handling. It examines the GetMoveFeed() and any speed override settings and if the feedrate has changed, it returns a new feed command. Depending on the value of GetFeedIsStandalone(), this is either returned on a separate line or appended to the end of the move command.
- "move-ijk"
- This is called by the MOVE event handling. It examines the tool axis direction returned by GetOutDirZ() and formats the tool axis portion of the movement command. This function may be set to versions that Format the direction as Fanic TCP IJK components, Siemens TRAORI A3/B3/C3 components, or AC/BC/AB angles for use with Okuma or Heidenhain TCP modes. It returns null if the tool axis has not changed from the last known direction held by "vars". The WCS tool axis is used, which has all setup and toolpath transforms applied. In addition the GetDstXform() transform is applied if required by GetUseXform().
- "move-xyz"
- This is called by the MOVE event handling. It examines the tool position returned by GetOutXYZ() and formats the position portion of the movement command. This function returns null if the tool axis has not changed from the last known direction held by "vars". The WCS position is used, which has all setup and toolpath transforms applied. In addition the GetDstXform() transform is applied if required by GetUseXform().
- "ncfun-exchange-pallet"
- This is called by the EXEC_NCFUN event handling for an "exchange pallet" NC function.
- "ncfun-extended"
- This is called by the EXEC_NCFUN event handling for an "extended nc-function" NC function.
- "ncfun-index-pallet"
- This is called by the EXEC_NCFUN event handling for an "index pallet" NC function.
- "ncfun-index-table"
- This is called by the EXEC_NCFUN event handling for an "index table" NC function.
- "ncfun-message"
- This is called by the EXEC_NCFUN event handling for a "message" NC function.
- "ncfun-optional-stop"
- This is called by the EXEC_NCFUN event handling for an "optional stop" NC function. It is also called durning the workingstep end event handling if required by GetStopAfterWorkingstep().
- "ncfun-stop"
- This is called by the EXEC_NCFUN event handling for an "stop" NC function.
- "op-approach-paths"
- This advances the cursor through the toolpaths in an operation until it finds a toolpath that is not marked as an "approach" path and "required". It returns all formatted MOVE events that it iterated over. This is used when processing an operation of type OP_PROBE to command the probe approach.
- "op-lift-paths"
- This advances the cursor through the toolpaths in an operation until it is finished or finds a toolpath that is not marked as an "lift" path and "required". It returns all formatted MOVE events that it iterated over. This is used when processing an operation of type OP_PROBE to command the probe departure after measurement.
- "probe-comments"
- This is used when processing an operation of type OP_PROBE. It returns a series of comments that describe the start, end, direction, and expected value of a probe.
- "probe-datums"
- This is only used during DMIS output to declare workpiece datums at the start of a program.
- "refpoint-center"
- This is called when processing the toolpath start event for a cutter loCation toolpath. By default, it adds a "G40" to the next move if previously in cutter contact mode. If needed, it registers the G40 as a prefix for the next move with vars.AddMovePrefix() and calls vars.SetRefpointCenter();
- "refpoint-contact"
- This is called when processing the toolpath start event for a cutter contact toolpath. By default, it and calls vars.SetRefpointContact()
- "refpoint-left"
- This is called by "move-contact" after it has determined where the cutter is in contact. If currently not vars.IsRefpointLeft(), the function calls vars.SetRefpointLeft() and returns "G41".
- "refpoint-right"
- This is called by "move-contact" after it has determined where the cutter is in contact. If currently not vars.IsRefpointRight(), the function calls vars.SetRefpointRight() and returns "G42".
- "spindle"
- Returns codes to turn the spindle on or off as necessary based on the value of GetMoveSpindle(). The spindle is Set to counter clockwise if the number is positive, clockwise if the number is negative, or "spindle-off" is called if the number is zero. Called by the toolpath start event handling.
- "spindle-off"
- Returns codes to turn off the spindle. Called by the tool change and program end event handling.
- "tap-first"
- This us called when processing an operation of type OP_TAP. It returns the starting portion of the tapping.
- "tap-last"
- This us called when processing an operation of type OP_TAP. It returns the concluding portion of the tapping.
- "tap-point"
- This us called when processing an operation of type OP_TAP. It is called with a GetPosEnd() position for each loCation that must be tapped.
- "timestamp"
- Returns the current time in ISO date format as a comment. Usually called by the program start event handling.
- "tool-comment"
- This is called by the tool change event handling to build a series of comments describing the parameters of the new tool.
- "workoffset"
- This is called by the project start event handling to declare the work offset frame requested by GetWorkOffsetFrame().
- "workplan-probe-end"
- This is called by the workplan start event handling to add additional commands at the beginning of workplans that contain OP_PROBE operations.
- "workplan-probe-start"
- This is called by the workplan end event handling to add additional commands at the completion of workplans that contain OP_PROBE operations.
FormatRapidXYZ()
System::String^ FormatRapidXYZ( GenerateState^ vars, Adaptive^ cursor, double x, double y, double z ); string FormatRapidXYZ( GenerateState vars, Adaptive cursor, double x, double y, double z ); string FormatRapidXYZ_IJK( GenerateState vars, Adaptive cursor, double[3] xyz );
The FormatRapidXYZ() function returns a move command as if processing a MOVE event at rapid feed, but the given position is supplied by the caller rather than taken from a toolpath curve. The tool axis is not changed - use FormatRapidXYZ_IJK() to change the tool direction.
The position is given in program units and "vars" is updated. The position is used exactly as passed in, no destination transform is applied. The feed rate will return to its previous value on the next move.
The function may return an empty string if no move is needed.
The coordinates can be provided as separate values or as an array.
FormatRapidXYZ_IJK()
System::String^ FormatRapidXYZ_IJK( GenerateState^ vars, Adaptive^ cursor, double x, double y, double z, double i, double j, double k ); string FormatRapidXYZ_IJK( GenerateState vars, Adaptive cursor, double x, double y, double z, double i, double j, double k ); string FormatRapidXYZ_IJK( GenerateState vars, Adaptive cursor, double[3] xyz, double[3] ijk );
The FormatRapidXYZ_IJK() function returns a move command as if processing a MOVE event at rapid feed, but the given position and tool axis direction is supplied by the caller rather than taken from a toolpath curve.
The position is given in program units and "vars" is updated. The position is used exactly as passed in, no destination transform is applied. The feed rate will return to its previous value on the next move.
The function may return an empty string if no move is needed.
The coordinates and direction vectors can be provided as separate values or as a pair of arrays.
FormatType()
System::String^ FormatType ( GenerateState^ vars, Adaptive^ cursor ); string FormatType ( GenerateState vars, Adaptive cursor );
The FormatType() function calls a formatting function based on the CtlType returned by the GetActiveType() of the process cursor. Typically this is done for MOVE and OPERATION_START events. The function may return an empty string if nothing is needed or no formatting function is registered for a particular type.
GetAngleDigits()
System::Int64 GetAngleDigits(); int GetAngleDigits();
The GetAngleDigits() function returns the maximum digits of precision used when formatting angle values. This is typically defined by the output format but may be changed to different values using the SetAngleDigits() function. The GetAngleMinDigits() function controls how many digits are always used and whether the trailing decimal point is left on integer values.
GetAngleMinDigits()
System::Int64 GetAngleMinDigits(); int GetAngleMinDigits();
The GetAngleMinDigits() function returns the minimum number of decimal digits that will be used for angle value. If this value is zero, integer values will have a trailing decimal point, if negative the decimal point will be stripped. See CatNumber() for examples.
GetBlocknumLimit()
System::Int64 GetBlocknumLimit(); int GetBlocknumLimit();
The GetBlocknumLimit() function returns the upper limit of block numbers for a style, or zero if there is no limit. When numbering is turned on, the block numbers will wrap around if they reach the limit. The GenerateState GetLastBlocknum() function returns the last assigned number.
GetChordTolerance()
double GetChordTolerance();
The GetChordTolerance() function returns the chordal tolerance used to break arcs and helixes into line segments when the GetLinearizeAllCurves() flag is set. This is the maximum distance that the line segment is allowed to be from the original mathematical curve. The default is 0.001 and can be changed by SetChordTolerance()
GetDigits()
System::Int64 GetDigits(); int GetDigits();
The GetDigits() function returns the maximum digits of precision used when formatting coordinate values. This is typically defined by the output format but may be changed to different values using the SetDigits() function depending on whether output is in inch, mm, etc. The GetMinDigits() function controls how many digits are always used and whether the trailing decimal point is left on integer values
GetDstXform()
array<double>^ GetDstXform() double[16] GetDstXform()
The GetDstXform() function returns a pointer to a sixteen element array of doubles containing a destination transform for the output coordinates. This transform is only applied if GetUseXform() is true. The SetDstXform() function changes the destination transform.
When outputting moves, the Adaptive will apply all setup and toolpath transforms to get the coordinates into the WCS. This destination transform is applied afterwards to modify the output for probing results or a machine-specific transform.
GetDstXformIsLeft()
System::Boolean GetDstXformIsLeft(); bool GetDstXformIsLeft();
The GetDstXformIsLeft() function returns true if the transform returned by GetDstXform() uses a left-handed coordinate system. Any transform derived from STEP data will, by definition, only use a right-handed coordinate system.
A left-handed transform, might be used by some machines, like a left-handed lathe. This will also reverse the direction of circular motion and spindle rotation.
GetFeedDigits()
System::Int64 GetFeedDigits(); int GetFeedDigits();
The GetFeedDigits() function returns the maximum digits of precision used when formatting feedrate values. This is typically defined by the output format but may be changed to different values using the SetFeedDigits() function. The GetFeedMinDigits() function controls how many digits are always used and whether the trailing decimal point is left on integer values.
GetFeedIsStandalone()
System::Boolean GetFeedIsStandalone(); bool GetFeedIsStandalone();
The GetFeedIsStandalone() function returns true if feedrate changes should be formatted on a separate line and false if they should be appended to the end of the move command to which they apply. Use SetFeedStandalone() and SetFeedInline() to change this value.
GetFeedMinDigits()
System::Int64 GetFeedMinDigits(); int GetFeedMinDigits();
The GetFeedMinDigits() function returns the minimum number of decimal digits that will be used for feedrate value. If this value is zero, integer values will have a trailing decimal point, if negative the decimal point will be stripped. See CatNumber() for examples.
GetFeedUnit()
RoseUnit GetFeedUnit()
The GetFeedUnit() function returns the velocity unit used for feed rate values.
This value will be set to inch/min or millimeter/min by SetUnitSystem() depending on whether GetLenUnit() is Set to inch or MM. The value may be also be changed with the SetLenUnit() function.
GetFileExt()
System::String^ GetFileExt(); string GetFileExt();
The GetFileExt() function returns the preferred filename extension for the configured Format. The values set by the pre-defined styles include the dot separator. For example, ".nc", ".min", etc. This value can be used by the caller to construct a filename.
GetIJKDigits()
System::Int64 GetIJKDigits(); int GetIJKDigits();
The GetIJKDigits() function returns the maximum digits of precision used when formatting IJK direction components. This is typically defined by the output format but may be changed to different values using the SetIJKDigits() function. The GetIJKMinDigits() function controls how many digits are always used and whether the trailing decimal point is left on integer values.
GetIJKMinDigits()
System::Int64 GetIJKMinDigits(); int GetIJKMinDigits();
The GetIJKMinDigits() function returns the minimum number of decimal digits that will be used for IJK direction components. If this value is zero, integer values will have a trailing decimal point, if negative the decimal point will be stripped. See CatNumber() for examples.
GetLenUnit()
RoseUnit GetLenUnit()
The GetLenUnit() function returns the length unit used for all coordinate values and for the G70/G71-style units declaration that may appear at the start of a program.
This value is usually initialized from the GetProgramUnit() and process data by SetUnitSystem() but may be manually changed with the SetLenUnit() function.
If the program unit has a value of AS-IS roseunit_as_is, the length unit will be a more specific value of INCH/MM found by looking at the toolpath units used by the process. Otherwise the two values will be the same.
GetLinearizeAllCurves()
System::Boolean GetLinearizeAllCurves();
The GetLinearizeAllCurves() function returns a boolean flag indicating how arcs and helixes will be treated in the output. If true, the output functions will break arcs and helixes into a series of linear moves. The number of segments is controlled by the GetChordTolerance() value.
The default is false, and arcs and helixes are output using the circular interpolation appropriate to the format, like "G2" or "G3" codes. This may be changed by SetLinearizeAllCurves()
GetMinDigits()
System::Int64 GetMinDigits(); int GetMinDigits();
The GetMinDigits() function returns the minimum number of decimal digits that will be used for coordinate value. If this value is zero, integer values will have a trailing decimal point, if negative the decimal point will be stripped. See CatNumber() for examples.
GetMoveIsModal()
System::Boolean GetMoveIsModal();
The GetMoveIsModal() function returns a boolean value
indicating if the movement mode (typically G0
or G1
) is only specified once at the start of a series of
similar commands (true, modal) or whether it must be specified for
each move, regardless of whether the moves are the same type (false,
non-modal).
The default is true. The SetMoveIsModal() function changes this value.
# codes where GetMoveIsModal = true G1 X0. Y0. Z0. F20. Y3. X1. Y0. X2. # codes where GetMoveIsModal = false G1 X0. Y0. Z0. F20. G1 Y3. G1 X1. G1 Y0. G1 X2.
GetOutArcAxis()
void GetOutArcAxis( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %i, [System::Runtime::InteropServices::Out] double %j, [System::Runtime::InteropServices::Out] double %k, Adaptive::CtlPos p ); double[3] GetOutArcAxis( Adaptive cursor, CtlPos p );
The GetOutArcAxis() function is a convenience wrapper for Adaptive::GetArcAxis() that applies the destination transform to the value if needed.
The values are copied into the return parameters.
The values are returned as a three element array.
GetOutArcCenter()
void GetOutArcCenter( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %x, [System::Runtime::InteropServices::Out] double %y, [System::Runtime::InteropServices::Out] double %z, Adaptive::CtlPos p, RoseUnit u ); void GetOutArcCenter( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %x, [System::Runtime::InteropServices::Out] double %y, [System::Runtime::InteropServices::Out] double %z, Adaptive::CtlPos p ); double[3] GetOutArcCenter( Adaptive cursor, CtlPos p, RoseUnit u (optional) );
The GetOutArcCenter() function is a convenience wrapper for Adaptive::GetArcCenter() that applies the destination transform to the value if needed. If a length unit is given, the coordinates will be converted to that unit.
The values are copied into the return parameters.
The values are returned as a three element array.
GetOutDirMove()
System::Boolean GetOutDirMove( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %i, [System::Runtime::InteropServices::Out] double %j, [System::Runtime::InteropServices::Out] double %k, Adaptive::CtlPos p ); double[3] GetOutDirMove( Adaptive cursor, CtlPos p );
The GetOutDirMove() function is a convenience wrapper for Adaptive::GetPosDirMove() that applies the destination transform to the value if needed.
If the value is present, the function will return true and the values are copied into the return parameters.
If the value is present, it is returned as a three element array, otherwise the function returns undefined.
GetOutDirSnorm()
System::Boolean GetOutDirSnorm( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %i, [System::Runtime::InteropServices::Out] double %j, [System::Runtime::InteropServices::Out] double %k, Adaptive::CtlPos p ); double[3] GetOutDirSnorm( Adaptive cursor, CtlPos p );
The GetOutDirSnorm() function is a convenience wrapper for Adaptive::GetPosDirSnorm() that applies the destination transform to the value if needed.
If the value is present, the function will return true and the values are copied into the return parameters.
If the value is present, it is returned as a three element array, otherwise the function returns undefined.
GetOutDirX()
void GetOutDirX( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %i, [System::Runtime::InteropServices::Out] double %j, [System::Runtime::InteropServices::Out] double %k, Adaptive::CtlPos p ); double[3] GetOutDirX( Adaptive cursor, CtlPos p );
The GetOutDirX() function is a convenience wrapper for Adaptive::GetPosDirX() that calls GetPosDefaultDirX() if no tool reference direction is defined, and then applies the destination transform to the value if needed.
The values are copied into the return parameters.
The values are returned as a three element array.
GetOutDirZ()
void GetOutDirZ( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %i, [System::Runtime::InteropServices::Out] double %j, [System::Runtime::InteropServices::Out] double %k, Adaptive::CtlPos p ); double[3] GetOutDirZ( Adaptive cursor, CtlPos p );
The GetOutDirZ() function is a convenience wrapper for Adaptive::GetPosDirZ() that calls GetPosDefaultDirZ() if no tool axis direction is defined, and then applies the destination transform to the value if needed.
The values are copied into the return parameters.
The values are returned as a three element array.
GetOutXYZ()
void GetOutXYZ( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %x, [System::Runtime::InteropServices::Out] double %y, [System::Runtime::InteropServices::Out] double %z, Adaptive::CtlPos p, RoseUnit u ); void GetOutXYZ( Adaptive^ cursor, [System::Runtime::InteropServices::Out] double %x, [System::Runtime::InteropServices::Out] double %y, [System::Runtime::InteropServices::Out] double %z, Adaptive::CtlPos p ); double[3] GetOutXYZ( Adaptive cursor, CtlPos p, RoseUnit u (optional) );
The GetOutXYZ() function is a convenience wrapper for Adaptive::GetPosXYZ() that applies the destination transform to the value if needed.
The values are copied into the return parameters.
The values are returned as a three element array.
GetOutXformedDir()
void GetOutXformedDir( [System::Runtime::InteropServices::Out] double %ret_i, [System::Runtime::InteropServices::Out] double %ret_j, [System::Runtime::InteropServices::Out] double %ret_k, double in_i, double in_j, double in_k ); double[3] GetOutXformedDir( double in_i, double in_j, double in_k ); double[3] GetOutXformedDir( double[3] in_ijk );
The GetOutXformedDir() function is a convenience wrapper that applies the destination transform to a direction vector if needed.
The direction vectors can be provided as separate values or as a pair of arrays.
GetOutXformedPoint()
void GetOutXformedPoint( [System::Runtime::InteropServices::Out] double %ret_x, [System::Runtime::InteropServices::Out] double %ret_y, [System::Runtime::InteropServices::Out] double %ret_z, double in_x, double in_y, double in_z ); double[3] GetOutXformedPoint( double in_x, double in_y, double in_z ); double[3] GetOutXformedPoint( double[3] in_xyz );
The GetOutXformedPoint() function is a convenience wrapper that applies the destination transform to a coordinate position if needed.
The coordinates can be provided as separate values or as a pair of arrays.
GetProgramNumber()
System::Int64 GetProgramNumber(); int GetProgramNumber();
The GetProgramNumber() function returns the preferred number that should be used for the program when generating Fanuc-like codes. Use SetProgramNumber() to change this value.
GetProgramUnit()
RoseUnit GetProgramUnit()
The GetProgramUnit() function returns the preferred unit system that should be used for generating output. Call SetProgramUnit() to change this.
The INCH value roseunit_in implies lengths in inches, feeds in inches per minute, and spindle speeds in RPM. The MILLIMETER value roseunit_mm implies lengths in mm, feeds in mm per minute, and spindle speeds in RPM.
Calling SetUnitSystem() before beginning to set the actual units for length, feed, and spindle based on your preference. If the program unit is AS-IS roseunit_as_is, this will search for the first toolpath units seen and set the unit system from that.
GetSpindleDigits()
System::Int64 GetSpindleDigits(); int GetSpindleDigits();
The GetSpindleDigits() function returns the maximum digits of precision used when formatting spindle speed values. This is typically defined by the output format but may be changed to different values using the SetSpindleDigits() function. The GetSpindleMinDigits() function controls how many digits are always used and whether the trailing decimal point is left on integer values.
GetSpindleMinDigits()
System::Int64 GetSpindleMinDigits(); int GetSpindleMinDigits();
The GetSpindleMinDigits() function returns the minimum number of decimal digits that will be used for spindle speed values. If this value is zero, integer values will have a trailing decimal point, if negative the decimal point will be stripped. See CatNumber() for examples.
GetSpindleUnit()
RoseUnit GetSpindleUnit()
The GetSpindleUnit() function returns the angular velocity unit used for spindle speed values.
This value will be set to revolution/min by SetUnitSystem(). The value may be also be changed with the SetSpindleUnit() function.
GetStopAfterWorkingstep()
System::Boolean GetStopAfterWorkingstep(); bool GetStopAfterWorkingstep();
The GetStopAfterWorkingstep() function returns true if the workingstep end event handling should insert an optional stop code into the output. Call SetStopAfterWorkingstep() to change this value.
GetSupressX/Y/Zpos()
System::Boolean GetSupressXpos(); System::Boolean GetSupressYpos(); System::Boolean GetSupressZpos(); bool GetSupressXpos(); bool GetSupressYpos(); bool GetSupressZpos();
The GetSupressX/Y/Zpos() functions return a flag for each axis. When true, the move formatting code supresses all mention of that axis. This can be used to suppress the Z axis, for example, for 2D output. It is used to suppress the Y axis for lathe output. You can change these values with the SetSupressX/Y/Zpos functions.
GetTraceComments()
TraceComments GetTraceComments(); enum class TraceComments { none = 0, workplan = 1, // before each workplan workingstep = 2, // before each workingstep toolpath = 3, // before each toolpath point = 4, // at each point. all = 5 // all possible comments. }; string GetTraceComments();
The GetTraceComments() function returns an enum value that controls where descriptive comments are placed in the output. The levels go from less descriptive to more detailed, with one including the comments of the previous level. The default value is before each workingstep. Call SetTraceComments() to change this.
The Node version of this function uses string names for each commenting level rather than an enum. The recognized strings are "none", "all", "workplan", "workingstep", "toolpath", or "point".
GetUseBlocknums()
System::Boolean GetUseBlocknums(); bool GetUseBlocknums();
The GetUseBlocknums() function returns true if individual commands in the output should be preceedded by a "N" number. The FormatBlock function looks at this setting and prepends the number if needed.
This setting can be changed for most styles by SetUseBlocknums(). Some output styles, like "heidenhain", force this value to true because they require block numbers.
fmt.FormatBlock(vars,HELLO WORLD); // with GetUseBlocknums() false => HELLO WORLD fmt.FormatBlock(vars,HELLO WORLD); // with GetUseBlocknums() true => N1234 HELLO WORLD
GetUseSpeedOverride()
System::Boolean GetUseSpeedOverride();
The GetUseSpeedOverride() function returns true if speed profile curves in the data will be used to continuously modify the feed rates over the course of a toolpath. These override speeds are computed by a feed speed optimizer instead of the base speeds stored in the STEP-NC data.
A value of false means that the speed profile curve is ignored and toolpaths will use the base feed over its entire length.
A speed profile curve is a one dimensional curve that gives a ratio (value 0 to 1 or more) that is multiplied by the base feedrate to give the feed at each point in the toolpath. The curve has same parameterization as the toolpath, which usually means it is a polyline with the same number of points.
The SetUseSpeedOverride() function is used to control this behavior.
GetUseTCP()
System::Boolean GetUseTCP();
The GetUseTCP() function returns true if five-axis moves will be generated using TCP codes. This is a legacy function and should be replaced by separate code generation styles. The SetUseTCP() function changes this value.
GetUseToolConstChip()
System::Boolean GetUseToolConstChip();
The GetUseToolConstChip() function returns true if codes will be generated using a constant chip load optimization when a tool has a different actual flute count than the planned one.
The SetUseToolConstChip() function is used to control this behavior.
GetUseWhitespace()
System::Boolean GetUseWhitespace(); bool GetUseWhitespace();
The GetUseWhitespace() function returns true if parameters assembled by the CatParam() function should be separated by space characters. The CatSpace() also appends a space to non-empty inputs if this value is true. This setting can be changed by SetUseWhitespace().
RoseStringObject ret =G1; fmt.CatParam(ret,X, 1.23); fmt.CatParam(ret,Y, 4.56); fmt.CatParam(ret,Z, 7.89); => G1X1.23Y4.56Z7.89 // with GetUseWhitespace() false => G1 X1.23 Y4.56 Z7.89 // with GetUseWhitespace() true
GetUseXform()
System::Boolean GetUseXform(); bool GetUseXform();
The GetUseXform() function returns true if the destination transform given by GetDstXform() should be applied to all coordinates and directions. This value can be changed by SetUseXform() and affects the behavior of all of the "GetOut" prefixed functions.
GetWorkOffsetFrame()
System::Int64 GetWorkOffsetFrame(); int GetWorkOffsetFrame();
The GetWorkOffsetFrame() function returns the preferred number of the work offset frame that should be selected by the project start event handling. The actual command may change from style to style, but typical usage is "G54" for frame #1, "G55" for frame #2, etc. This value can be changed by the SetWorkOffsetFrame() function.
IsFormattedIJK()
System::Boolean IsFormattedIJK( double i1, double j1, double k1, double i2, double j2, double k2 ); bool IsFormattedIJK( double i1, double j1, double k1, double i2, double j2, double k2 ); bool IsFormattedIJK( double[3] ijk1, double[3] ijk2, );
The IsFormattedIJK() function returns true if the two direction vectors are equal when formatted to the digits of precision given by the GetDigits() value.
The direction vectors can be provided as separate values or as a pair of arrays.
IsFormattedNumber()
System::Boolean IsFormattedNumber( double num1, double num2 ); System::Boolean IsFormattedNumber( double num1, double num2, System::Int64 max_digits ); bool IsFormattedNumber( double num1, double num2, int max_digits (optional) );
The IsFormattedNumber() function returns true if the two numbers equal when formatted to the digits of precision given by the GetDigits() value. A different Formatting specification can be passed in as an optional parameter.
IsFormattedXYZ()
System::Boolean IsFormattedXYZ( double x1, double y1, double z1, double x2, double y2, double z2 ); bool IsFormattedXYZ( double x1, double y1, double z1, double x2, double y2, double z2 ); bool IsFormattedXYZ( double[3] xyz1, double[3] xyz2 );
The IsFormattedXYZ() function returns true if the two coordinates are equal when formatted to the digits of precision given by the GetDigits() value.
The coordinates can be provided as separate values or as a pair of arrays.
Reset()
void Reset();
The Reset() function restores the Generate object to default settings for all values, including user preferences like GetWorkOffsetFrame(), GetProgramUnits(), etc.
SetAngleDigits()
void SetAngleDigits (System::Int64 d); void SetAngleDigits (int d);
The SetAngleDigits() function sets the maximum digits of precision used when formatting angle values. See GetAngleDigits() for discussion.
SetAngleMinDigits()
void SetAngleMinDigits (System::Int64 d); void SetAngleMinDigits (int d);
The SetAngleMinDigits() function sets the minimum number of digits of precision used when formatting angle values. See GetAngleMinDigits() for discussion.
SetBlocknumLimit()
void SetBlocknumLimit (System::Int64 max); void SetBlocknumLimit (int d);
The SetBlocknumLimit() function sets the upper limit of block numbers for a Format. Set to zero to indicate no limit. See GetBlocknumLimit() for more discussion on this use.
SetChordTolerance()
void SetChordTolerance(double val);
The SetChordTolerance() function changes the chordal tolerance used to break arcs and helixes into line segments when the GetLinearizeAllCurves() flag is true. This is the maximum distance that the line segment is allowed to be from the original mathematical curve.
SetDigits()
void SetDigits (System::Int64 d); void SetDigits (int d);
The SetDigits() function sets the maximum digits of precision used when formatting coordinate values. You can control the precision of other values with SetAngleDigits(), SetFeedDigits(), SetIJKDigits(), and SetSpindleDigits(). See GetDigits() for more discussion.
SetDstXform()
void SetDstXform( array<double>^ xf ); void SetDstXform( double[16] xf );
The SetDstXform() function sets the destination transform for the output coordinates. The input must be a sixteen element array of doubles. See GetDstXform() for more discussion.
SetEventFn()
void SetEventFn( CtlEvent e, GenerateFn fn ); # Where the callback function has the form: System::String GenerateFn( Generate gen, GenerateState gs, Adaptive cur );
The SetEventFn() function associates a callback function to
be used when FormatEvent() is called for a
given event. The callback function is passed an argument list
with Generate
, GenerateState,
and Adaptive objects, and should return a
string containing codes, or String::Empty
.
The SetStyle() function assigns builtin callbacks for a given kind of output. You can replace these with your own variations or different builtins.
SetFeedDigits()
void SetFeedDigits (System::Int64 d); void SetFeedDigits (int d);
The SetFeedDigits() function sets the maximum digits of precision used when formatting feedrate values. See GetFeedDigits() for discussion.
SetFeedInline()
void SetFeedInline();
The SetFeedInline() function sets the value returned by GetFeedIsStandalone() to false. This means that feedrate changes should be appended to the end of the move command to which they apply.
SetFeedMinDigits()
void SetFeedMinDigits (System::Int64 d); void SetFeedMinDigits (int d);
The SetFeedMinDigits() function sets the minimum number of digits of precision used when formatting feedrate values. See GetFeedMinDigits() for discussion.
SetFeedStandalone()
void SetFeedStandalone();
The SetFeedStandalone() function sets the value returned by GetFeedIsStandalone() to true. This means that feedrate changes should be formatted on a separate line preceeding the move command to which they apply.
SetFeedUnit()
void SetFeedUnit (RoseUnit u);
The SetFeedUnit() function changes the linear velocity unit used for feed rate values. This value will be overwritten every time SetUnitSystem() is called. See GetFeedUnit() for more discussion.
SetFileExt()
void SetFileExt (System::String^ s); void SetFileExt (string s);
The SetFileExt() function the preferred filename extension for the configured Format. See GetFileExt() for more discussion.
SetIJKDigits()
void SetIJKDigits (System::Int64 d); void SetIJKDigits (int d);
The SetIJKDigits() function sets the maximum digits of precision used when formatting IJK values. See GetIJKDigits() for discussion.
SetIJKMinDigits()
void SetIJKMinDigits (System::Int64 d); void SetIJKMinDigits (int d);
The SetIJKMinDigits() function sets the minimum number of digits of precision used when formatting IJK values. See GetIJKMinDigits() for discussion.
SetLenUnit()
void SetLenUnit (RoseUnit u);
The SetLenUnit() function changes the length unit used for all coordinate values. This value will be overwritten every time SetUnitSystem() is called. See GetLenUnit() for more discussion.
SetLinearizeAllCurves()
void SetLinearizeAllCurves(System::Boolean yn)
The SetLinearizeAllCurves() function changes a boolean flag indicating how arcs and helixes will be treated in the output.
If true, the output functions will break arcs and helixes into a series of linear moves. The number of segments is controlled by the GetChordTolerance() value.
If false, and arcs and helixes are output using the circular interpolation appropriate to the format, like "G2" or "G3" codes. See GetLinearizeAllCurves() for more information.
SetMinDigits()
void SetMinDigits (System::Int64 d); void SetMinDigits (int d);
The SetMinDigits() function sets the minimum number of digits of precision used when formatting feedrate values. See GetMinDigits() for discussion.
SetMoveIsModal()
void SetMoveIsModal(System::Boolean yn)
The SetMoveIsModal() function changes a boolean flag
indicating if the movement mode (typically G0
or G1
) is only specified once at the start of a series of
similar commands (true, modal) or whether it must be specified for
each move, regardless of whether the moves are the same type (false,
non-modal). See GetMoveIsModal() for
more information.
SetOtherFn()
void SetOtherFn(
System::String nm,
GenerateFn fn
);
# Where the callback function has the form:
System::String GenerateFn(
Generate gen,
GenerateState gs,
Adaptive cur
);
The SetOtherFn() function associates a function with a given name in a dictionary of callbacks kept by the Generate object and used by the FormatOther() function. You are free to replace the function for a given name or add functions with your own unique names. The names used by the builtin styles are documented with FormatOther().
The callback function is passed an argument list
with Generate
, GenerateState,
and Adaptive objects, and should return a
string containing codes, or String::Empty
.
The SetStyle() function assigns builtin callbacks for a given kind of output. You can replace these with your own variations or different builtins.
SetProgramNumber()
void SetProgramNumber (System::Int64 d); void SetProgramNumber (int d);
The SetProgramNumber() function sets the program number used for the program when generating Fanuc-like codes. See GetProgramNumber() for more discussion.
SetProgramUnit()
void SetProgramUnit (RoseUnit u);
The SetProgramUnit() function Sets the preferred unit system that should be used for generating output.
The MILLIMETER value RoseUnit.mm always creates with lengths in mm, feeds in mm per minute, and spindle speeds in RPM. Values are converted as needed.
The INCH value RoseUnit.inch creates with lengths in inches, feeds in inches per minute, and spindle speeds in RPM. Values are converted as needed.
The AS-IS value RoseUnit.as_is creates with the unit system (MM or INCH) that is present in the file.
Generate fmt = new Generate(); fmt.SetStyle(haas); fmt.SetProgramUnit(RoseUnit.mm) '' use millimeters OR fmt.SetProgramUnit(RoseUnit.inch) '' use inches OR fmt.SetProgramUnit(RoseUnit.as_is) '' use units from the file fmt.ExportCNCFile(filename.nc);
SetSpindleDigits()
void SetSpindleDigits (System::Int64 d); void SetSpindleDigits (int d);
The SetSpindleDigits() function sets the maximum digits of precision used when formatting spindle speed values. See GetSpindleDigits() for discussion.
SetSpindleMinDigits()
void SetSpindleMinDigits (System::Int64 d); void SetSpindleMinDigits (int d);
The SetSpindleMinDigits() function sets the minimum number of digits of precision used when formatting spindle speed values. See GetSpindleMinDigits() for discussion.
SetSpindleUnit()
void SetSpindleUnit (RoseUnit u);
The SetSpindleUnit() function changes the angular velocity unit used for spindle speed values. This value will be overwritten every time SetUnitSystem() is called. See GetSpindleUnit() for more discussion.
SetStopAfterWorkingstep()
void SetStopAfterWorkingstep (System::Boolean yn); void SetStopAfterWorkingstep (bool yn);
The SetStopAfterWorkingstep() function sets a flag that controls whether the workingstep end event handling inserts an optional stop code into the output at the end of each workingstep.
This is independent of the any STEP-NC stop or optional stop NC functions that may already be in the code and gives the operator more control when testing a program on a new machine.
See GetStopAfterWorkingstep() for more discussion.
SetStyle()
System::Boolean SetStyle (System::String^ name); bool SetStyle (string name);
The SetStyle() function configures the Generate object to the built-in style with a given name. The function returns true if the style was found and false otherwise.
A full list of built-in style are documented in the lower-level STEP-NC Control Library.
Most styles begin by calling Reset() so any prior settings will be lost.
Adaptive ctl; Generate fmt; GenerateState vars; ctl.StartProject(); ctl.SetWantedAll(true); fmt.SetStyle(haas); fmt.SetUnitSystem(ctl); while (ctl.Next() != Adaptive.CtlEvent.DONE) { Console.Write(fmt.FormatEvent(vars,ctl)); } // generate again, but as okuma codes ctl.StartProject(); fmt.SetStyle(okuma); // Set desired style as Okuma fmt.SetUnitSystem(ctl); vars.Reset(); // clear vars while (ctl.Next() != Adaptive.CtlEvent.DONE) { Console.Write(fmt.FormatEvent(vars,ctl)); }
SetSupressX/Y/Zpos()
void SetSupressXpos (System::Boolean yn); void SetSupressYpos (System::Boolean yn); void SetSupressZpos (System::Boolean yn); void SetSupressXpos (bool yn); void SetSupressYpos (bool yn); void SetSupressZpos (bool yn);
The SetSupressX/Y/Zpos() functions set a flag that supresses mention of particular axis. This may be useful for 2D output, lathes, etc. See GetSupressX/Y/Zpos for more details.
SetTraceComments()
void SetTraceComments (TraceComments t); void SetTraceComments (string t);
The SetTraceComments() function sets an enum value that controls where descriptive comments are placed in the output. See GetTraceComments() for a description of the values and their effect.
The Node version of this function uses string names for each commenting level rather than an enum. The recognized strings are "none", "all", "workplan", "workingstep", "toolpath", or "point".
SetTypeFn()
void SetTypeFn(self, CtlType t, GenerateFn fn ); # Where the callback function has the form: System::String GenerateFn( Generate gen, GenerateState gs, Adaptive cur );
The SetTypeFn() function associates a callback function to
be used when FormatType() is called for a
given type of STEP-NC element. The callback function is passed an
argument list
with Generate
, GenerateState,
and Adaptive objects, and should return a
string containing codes, or String::Empty
.
The SetStyle() function assigns builtin callbacks for a given kind of output. You can replace these with your own variations or different builtins.
SetUnitSystem()
void SetUnitSystem (Adaptive^ ctl); void SetUnitSystem (Adaptive ctl);
The SetUnitSystem() function sets the system of length, feed, and spindle speed units. These are set to match to match the program unit preference. If this is AS-IS, the function will use the supplied cursor to find the length units used by the toolpaths process, and set the unit system accordingly. The unit system values are returned by the GetLenUnit(), GetFeedUnit() and GetSpindleUnit() functions.
SetUseBlocknums()
void SetUseBlocknums (System::Boolean yn); void SetUseBlocknums (bool yn);
The SetUseBlocknums() function sets a flag that indicates whether the FormatBlock function should prefix every line with a "N" number. See GetUseBlocknums() for more discussion.
SetUseSpeedOverride()
void SetUseSpeedOverride (System::Boolean yn);
The SetUseSpeedOverride() function controls whether speed profile curves in the data will be used to continuously modify the feed rates over the course of a toolpath. See GetUseSpeedOverride() for more discussion.
SetUseTCP()
void SetUseTCP (System::Boolean yn);
The SetUseTCP() function controls whether five-axis moves will be generated using TCP codes. This is a legacy function and should be replaced by separate code generation styles. See GetUseTCP() for more discussion.
SetUseToolConstChip()
void SetUseToolConstChip (System::Boolean yn);
The SetUseToolConstChip() function controls whether codes will be generated using a constant chip load optimization when a tool has a different actual flute count than the planned one. See GetUseToolConstChip() for more discussion.
SetUseWhitespace()
void SetUseWhitespace (System::Boolean yn); void SetUseWhitespace (bool yn);
The SetUseWhitespace() function sets a flag that indicates whether numeric parameters should be separated by space characters in the output. See GetUseWhitespace() for more discussion and examples.
SetUseXform()
void SetUseXform (System::Boolean yn); void SetUseXform (bool yn);
The SetUseXform() function sets a flag that indicates whether the destination transform given by GetDstXform() should be applied to all coordinates and directions. This affects the behavior of all of the "GetOut" prefixed functions. You can query this value with the GetUseXform() function and you can set the destination transform with SetDstXform().
SetWorkOffsetFrame()
void SetWorkOffsetFrame (System::Int64 d); void SetWorkOffsetFrame (int d);
The SetWorkOffsetFrame() function sets the preferred number of the work offset frame that should be selected by the project start event handling. A value of -1 means "as-is", do not change any offset settings. See GetWorkOffsetFrame() for more discussion.