GO2cam Javascript API
GO2SMachine Class Reference

Class to manage machining machine. More...

Inherits GO2SMachining.

Public Member Functions

 GO2SMachine ()
 Defaut constructor.
 
 GO2SMachine (String dir, String name)
 Create a machine object.
 
 GO2SMachine (String dir, String name, String ppPath, String ppStdFolder)
 
String GetCompatibleExtension ()
 
void GetExistingMachine ()
 
String GetName ()
 
String GetPP ()
 
String GetPPStdFolder ()
 
Boolean IsLoaded ()
 
void LoadFromFile (String dir, String name)
 
GO2SEnum::GO2SError RunPP (String dir, String name, Boolean forceQuiet=true, Boolean noParamWindow=false)
 
void SetPP (String ppPath)
 
void SetPPStdFolder (String path)
 

Detailed Description

Class to manage machining machine.

Constructor & Destructor Documentation

◆ GO2SMachine() [1/2]

GO2SMachine::GO2SMachine ( String dir,
String name )
inline

Create a machine object.

Parameters
[in]dirMachine file directory. If empty, the GO2cam machine directory will be used
[in]nameMachine file name

◆ GO2SMachine() [2/2]

GO2SMachine::GO2SMachine ( String dir,
String name,
String ppPath,
String ppStdFolder )
inline

Create a machine object with a custom post processor and ppstd directory applied immediately.

var mac = new GO2SMachine('', 'fanuc.mcf', 'C:/my_pps/custom.dpp', 'C:/GO2cam/bin/ppstd')
mac.RunPP('iso', 'output.iso')
GO2SMachine()
Defaut constructor.
Definition GO2SMachine.hpp:15
GO2SEnum::GO2SError RunPP(String dir, String name, Boolean forceQuiet=true, Boolean noParamWindow=false)
Parameters
[in]dirMachine file directory. If empty, the GO2cam machine directory will be used
[in]nameMachine file name
[in]ppPathFull path to the PP file (e.g. 'C:/my_pps/custom.dpp'). Empty to use the PP defined in the machine file.
[in]ppStdFolderFull path to the ppstd directory. Empty to use the default.

Member Function Documentation

◆ GetCompatibleExtension()

String GO2SMachine::GetCompatibleExtension ( )
Returns
the file extension (MCT, MCF, MCR ..) that can be used in the current environement (Milling, turning...etc.)
productNames = ["Milling", "Lathe", "VerticalLathe", "SwissTurn", "Edm",
"MultiPositioning", "Robot", "DocumentModel", "Drawing", "Symbol",
"Tooling", "Machine", "Operator", "MachineComponent", "Oem"]
let mac = new GO2SMachine()
let prod = GO2SInteract.GetProduct()
let prodName = productNames[prod] ?? "Unknown"
let ext = mac.GetCompatibleExtension()
console.log("GO2cam started in " + prodName + " -> compatible file extension: " + ext)
// Display: GO2cam started in Milling -> compatible file extension: MCF
Class to manage interactivity with GO2cam.
Definition GO2SInteract.hpp:10
String GetCompatibleExtension()
Version
2027

◆ GetExistingMachine()

void GO2SMachine::GetExistingMachine ( )

Read the existing machine in the current file If no machine is loaded, try to load the default machine

var mac = new GO2SMachine
if(mac.IsLoaded())
console.log(mac.GetName())
Class to manage machining machine.
Definition GO2SMachine.hpp:9
void GetExistingMachine()

◆ GetName()

String GO2SMachine::GetName ( )
Returns
the mane of the machine

◆ GetPP()

String GO2SMachine::GetPP ( )
inline
Returns
the post processor file set by SetPP(), or an empty string if RunPP() uses the PP defined in the machine file
Version
2027

◆ GetPPStdFolder()

String GO2SMachine::GetPPStdFolder ( )
inline
Returns
the standard PP library directory set by SetPPStdFolder(), or an empty string if RunPP() uses the default ppstd directory
Version
2027

◆ IsLoaded()

Boolean GO2SMachine::IsLoaded ( )
inline
Returns
if the machine is properly loaded and can be used

◆ LoadFromFile()

void GO2SMachine::LoadFromFile ( String dir,
String name )

Load a machine file on the current part

var mac = new GO2SMachine
mac.LoadFromFile('', 'fanuc.mcf')
if(mac.IsLoaded())
{
//use the machine
}
void LoadFromFile(String dir, String name)
Parameters
[in]dirMachine file directory. If empty, the GO2cam machine directory will be used
[in]nameMachine file name

◆ RunPP()

GO2SEnum::GO2SError GO2SMachine::RunPP ( String dir,
String name,
Boolean forceQuiet = true,
Boolean noParamWindow = false )

Starts the execution of the post processor defined in the machine file. If SetPP() and/or SetPPStdFolder() were called, those overrides are applied temporarily for the duration of this call.

var machine = new GO2SMachine('', 'fanuc.mcf')
if(machine.IsLoaded())
{
machine.RunPP('iso', 'my_pp.iso')
}
Boolean IsLoaded()
Definition GO2SMachine.hpp:69
Returns
GO2SError.success (0) if success, see GO2SError otherwise
Parameters
[in]dirISO file destination directory. If empty, the GO2cam iso directory will be used
[in]nameIso file name
[in]forceQuietVersion 6.12.204 : whether to display warnings and the end result
[in]noParamWindowVersion 6.13 : whether to display post probuilder and name choice

◆ SetPP()

void GO2SMachine::SetPP ( String ppPath)
inline

Override the post processor file used by RunPP(). Both the directory and the PP name are extracted from the given path and applied temporarily during RunPP(). Calling with an empty string resets to the PP defined in the machine file.

var machine = new GO2SMachine('', 'fanuc.mcf')
machine.SetPP('C:/my_pps/custom.dpp')
machine.RunPP('iso', 'output.iso')
void SetPP(String ppPath)
Definition GO2SMachine.hpp:105
Version
2027
Parameters
[in]ppPathFull path to the PP file (e.g. 'C:/my_pps/custom.dpp'). Empty to reset.

◆ SetPPStdFolder()

void GO2SMachine::SetPPStdFolder ( String path)
inline

Override the standard PP library directory used by RunPP(). Calling with an empty string resets to the default ppstd directory.

var machine = new GO2SMachine('', 'fanuc.mcf')
machine.SetPPStdFolder('C:/GO2cam/bin/ppstd')
machine.RunPP('iso', 'output.iso')
void SetPPStdFolder(String path)
Definition GO2SMachine.hpp:123
Version
2027
Parameters
[in]pathFull path to the ppstd directory. Empty to reset.