Вы находитесь на странице: 1из 17

////////////////////////////////////////////////////////////////////////////////////////////////////////

CONSTANTS
////////////////////////////////////////////////////////////////////////////////////////////////////////

//// Entity types///////////////////////////////

//Point:
mc_pointtype
//Line:
mc_linetype
// Arc:
mc_arctype
// Rectangle:
mc_recttype

//// Entity ‘bit’ flags///////////////////////////////

//Entity is ‘alive’ (not deleted)?:


mc_alive
//Entity is part of the system group?:
mc_group
//Entity is currently selected?:
mc_selected
//Entity is part of the system result?:
mc_result
//Entity is only temporary?:
mc_temporary
//Entity is blanked?
mc_blanked

//// Milling tool types///////////////////////////////

// tool has a flat end


mctool_flat
// tool has a spherical end
mctool_ball
// tool has a “bull-nose” (non-zero corner radius)
mctool_bull

//// Drilling tool types

// a center drill
mctool_centerdrill
// a spot drill
mctool_spotdrill
// a standard drill
mctool_drill
// a left handed tap
mctool_lhtap
// a right handed tap
mctool_rhtap
// a reaming tool
mctool_reamer
// a boring bar
mctool_boringbar
// a counterbore tool
mctool_counterbore
// a countersink tool
mctool_countersink

//// Others ////////////////////////////////////////

// current system tolerance – two reals less than this close together are identical
mc_tol
// current chaining tolerace – chaining will jump gaps that are smaller than this
mc_chaintol
// SIM number
mc_simnumber
// is the current Mastercam session in Metric (millimeter) mode?
mc_metric

// Cutter Compensation Flags


mcCUTTER_COMP_OFF
mcCUTTER_COMP_LEFT
mcCUTTER_COMP_RIGHT

// Pocketing Style Flags


mcPOCKET_ZIGZAG
mcPOCKET_ONEWAY
mcPOCKET_CONSTOVERLAPSPIRAL
mcPOCKET_PARSPIRAL
mcPOCKET_PARSPIRAL_CLEANCORNERS
mcPOCKET_TRUESPIRAL

// -- MarkWindow Input
mcWINDOW_INSIDE
mcWINDOW_INSIDE_INTR
mcWINDOW_INTERSECT
mcWINDOW_OUT_INTR
mcWINDOW_OUT
// Entity Construction
mcCONSTRUCTION_COLOR_CURRENT
mcCONSTRUCTION_LEVEL_CURRENT

// message box returns


mcMSG_CANCEL
mcMSG_NO
mcMSG_YES

// chaining constants
mcCHAIN_UNCLEAR
mcCHAIN_CW
mcCHAIN_CCW
mcCHAIN_ALL_NUMBERED_LEVELS
mcCHAIN_ALL_NAMED_LEVELS

// colors
mcCOLOR_BLACK
mcCOLOR_DARKBLUE
mcCOLOR_GREEN
mcCOLOR_TEAL
mcCOLOR_DARKRED
mcCOLOR_PURPLE
mcCOLOR_BROWN
mcCOLOR_LIGHTGREY
mcCOLOR_DARKGREY
mcCOLOR_BLUE
mcCOLOR_LIGHTGREEN
mcCOLOR_LIGHTBLUE
mcCOLOR_RED
mcCOLOR_MAGENTA
mcCOLOR_YELLOW
mcCOLOR_WHITE

// operation results
mcOPERATION_INVALID

////////////////////////////////////////////////////////////////////////////////////////////////////////
CLASSES
////////////////////////////////////////////////////////////////////////////////////////////////////////
//Class to hold a Point's X, Y, Z co-ordinates
McPt
McPt.X = Point’s X co-ordinate
McPt.Y = Point’s Y co-ordinate
McPt.Z = Point’s Z co-ordinate
//Class to hold a Line's endpoints X, Y, Z co-ordinates
McLn
McLn.X1 = Line’s startpoint X co-ordinate
McLn.Y1 = Line’s startpoint Y co-ordinate
McLn.Z1 = Line’s startpoint Z co-ordinate
McLn.X2 = Line’s endpoint X co-ordinate
McLn.Y2 = Line’s endpoint Y co-ordinate
McLn.Z2 = Line’s endpoint Z co-ordinate

//Class to hold an arc's center point X,Y,Z co-ordinates, radius, and start & sweep angles
McAr
McAr.X = Arc’s centerpoint X co-ordinate
McAr.Y = Arc’s centerpoint Y co-ordinate
McAr.Z = Arc’s centerpoint Z co-ordinate
McAr.R = Arc’s radius
McAr.SA = Arc’s start angle in degrees
McAr.SW = Arc’s sweep angle in degrees
McAr.View = Arc’s view number

//Class to hold a Rectangle’s cornerpoints and Z co-ordinate


McRe
McRe.X1 = Rectangle’s startpoint X co-ordinate
McRe.Y1 = Rectangle’s startpoint Y co-ordinate
McRe.X2 = Rectangle’s endpoint X co-ordinate
McRe.Y2 = Rectangle’s endpoint Y co-ordinate
McRe.Z = Rectangle’s Z co-ordinate

////////////////////////////////////////////////////////////////////////////////////////////////////////
FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////////////

//// Script debugging utilities //////////////////////////////////////

// pop up a window with a string and an integer value


Void ShowValue(
String, (Input: the string to place before integer value)
Integer (Input: the integer value to display)
)

// pop up a window with a string and a real (or double prec.) value
Void ShowDouble(
String, (Input: the string to place before real value)
Real (Input: the real value to display)
)
// pop up a window with a string
Void ShowString(
String (Input: the string to display)
)

//// Prompt area message functions ///////////////////////////////////

// erase the Mastercam prompt area at the bottom of the Mastercam window
Void ClearPromptLines()

// erase the menu area


Void ClearMenu()

// erase menu area & prompt area


Void ClearMenuAndPrompts()

// write a string to the prompt area


Void WriteString(
String (Input: the string to display)
)

// write an integer to the prompt area


Void WriteNumber(
Integer (Input: the integer to display)
)

// write a real (double prec.) to the prompt area


Void WriteValue(
Real (Input: the real number to display)
)

//// Simple Input functions ///////////////////////////////////////

// ask for a point location


Bool askPoint(
McPt (Output: the point)
)

// ask for an angle in degrees – note that the passed value will be the default value
Bool askAngle(
Real (Input/Output: the angle)
)

// ask for an integer number – note that the passed value will be the default value
Bool askNumber(
String, (Input: Prompt area text)
Integer, (Input: Lower bound on number)
Integer, (Input: Upper bound on number)
Integer (Input/Output: the number)
)

// ask for a real (or double prec.) number – note that the passed value will be the default
value
Bool askValue(
String, (Input: Prompt area text)
Real, (Input: Lower bound on number)
Real, (Input: Upper bound on number)
Real (Input/Output: the real number)
)

// ask for a color – note that the passed value will be the default value
Bool askColor(
Integer (Input/Output: the color number)
)

// ask for a level – note that the passed value will be the default value
Bool askLevel(
Integer (Input/Output: the level number)
)

// ask a ‘Yes/No’ question


Bool askYesNo(
String (Input: question being asked)
)

// ask a ‘Yes/No/Cancel’ question and return one of the ‘MessageBox’ constants


Integer askYesNoCancel
(
String (Input: question being asked)
)

//// Entity Prompt/Inquiry functions ///////////////////////////////////////

// ask for an entity and make it the 'current active' entity


Bool AskForEntity(
String, (Input: Prompt area text)
Integer (Input: entity Ids “or”ed together)
)

// set the current active entity based on an entity's eptr


Bool SetEntityFromEptr(
Integer (Input: entity’s pointer)
)

// get the eptr of the current active entity


Integer GetEntityEptr()

// get the type of the current active entity


Integer GetEntityType()

// get the color of the current active entity


Integer GetEntityColor()

// set the color of the current active entity


Void SetEntityColor(integer)

// get the level of the current active entity


Integer GetEntityLevel()

// get the 'bits'of the current active entity


Integer GetEntityBits()

//get the co-ordinates of a point entity


Bool GetPointData(
Integer (Input: entity’s pointer, or -1 for current entity
McPt, (Outut: the point data)
)
//get the co-ordinate’s of a line entity
Bool GetLineData(
Integer (Input: entity’s pointer, or -1 for current entity
McLn, (Outut: the line data)
)
//get the co-ordinate’s of an arc entity
Bool GetArcData(
Integer (Input: entity’s pointer, or -1 for current entity
McAr, (Outut: the arc data)
)
//get the co-ordinate’s of a rectangle
Bool GetRectangleData(
Integer (Input: entity’s pointer, or -1 for current entity
McRe, (Outut: the rectangle data)
)

// unselect the current active entity


Void UnselectEntity()

// window select a bunch of entities and set their select bits


Bool MarkWindow(
String, (Input: Prompt area text)
Integer, (Input: allowable entity types added+ together)
Integer (Input: see the ‘MarkWindow’ flags above)
)
// select all entities
Void SelectAll()

// unselect all selected entities


Void UnselectAll()

//// Chaining functions //////////////////////////////////////////////

// prompt the user to indicate one or more chains &


// make the 1st entity on the 1st chain the current active entity
Bool AskForChain(
String, (Input: Prompt area text)
)

// make the 1st entity on the 1st chain the current active entity
Bool RewindChains()

// make the next entity on the current chain the current active entity
Bool MoveForwardOnChain()

// make the 1st entity on the next chain the current active entity
Bool MoveToNextChain()

// release all the current chain data


Void FreeChains()

// prompt for a file (dwg/dxf/mc9/mc8/mc7) file and chain the geometry


Bool GetChainFromFile(
String, (Input: file name)
Bool (Input: use input string as a default and prompt for a file)
)

// chain everything possible in the current part


Bool ChainAll(
Bool, (Input : only generate closed chains?)
Bool , (Input: only find chains at Z=0?)
Integer, (Input: only find chains on this level? Use
mcCHAIN_ALL_NUMBERED_LEVELS for all levels)
String (Input: only find chains on this level? Use
mcCHAIN_ALL_NAMED_LEVELS for all levels)
)
// remove the current chain from the current list of chains
// return false if the last chain had been un-linked – i.e. there is no current chain
Bool UnlinkCurrentChain()

// is the current chain clockwise, Counter-clockwise, or is it unclear


// (see the chaining constants above)
Integer IsChainClockwise()

// ask if the current chain is closed


Bool IsChainClosed()

// ask if the current chain is flat


Bool IsChainFlat()

// if the current chain is flat, get it’s depth


Real FlatChainDepth()

// if the current chain is flat, get it’s view number


Integer FlatChainViewNumber()

//// Database Search functions ///////////////////////////////////////

// initialize for database searching


// selPtn is a combination of selection bits
// (i.e. to only see selected entities, say mc_SELECTED
// for All entities, say mc_ALIVE)
// entMask is a combination of entity types to loop through
Bool StartDBSearch(
Integer, (Input: entity bits “or”ed together)
Integer (Input: entity Ids “or”ed together)
)

// get the first or next entity in the database and make it the current active entity
Bool NextDBSearch()

//// Entity creation functions ///////////////////////////////////////

// create a Mastercam Point given an McPt class


Bool CreatePoint(
McPt, (Input: the point data)
integer, (Input: color number, or mcCONSTRUCTION_COLOR_CURRENT)
integer (Input: level number, or mcCONSTRUCTION_LEVEL_CURRENT)
)

// create a Mastercam Line given an McLn class


Bool CreateLine(
McLn, (Input: the line data)
integer, (Input: color number, or mcCONSTRUCTION_COLOR_CURRENT)
integer (Input: level number or mcCONSTRUCTION_COLOR_CURRENT)
)

// create a Mastercam Arc given an McAr class


Bool CreateArc(
McAr, (Input: the arc data)
integer, (Input: color number, or mcCONSTRUCTION_COLOR_CURRENT)
integer (Input: level number, or mcCONSTRUCTION_COLOR_CURRENT)
)

// create a Mastercam Rectangle given an McRe class


Bool CreateRectangle(
McRe, (Input: the rectangle data)
integer, (Input: color number, or mcCONSTRUCTION_COLOR_CURRENT)
integer (Input: level number, or mcCONSTRUCTION_COLOR_CURRENT)
)

//// Excel read/write functions ///////////////////////////////////////

// open an Excel file


Bool OpenExcelFile(
String (Input: the file name)
)

// close the open Excel file


Void CloseExcelFile()

// save an Excel file


Void SaveExcelFile(
String (Input: the file name)
)

// write a string to an excel file cell


Void WriteExcelString(
String, (Input: the cell label)
String (Input: the string to place in the cell)
)

// write an integer string to an excel file cell


Void WriteExcelNumber(
String, (Input: the cell label)
Integer (Input: the number to place in the cell)
)

// write a real (or double prec.) value to an excel file cell


Void WriteExcelValue(
String, (Input: the cell label)
Real (Input: the real value to place in the cell)
)

// read a string from an excel file cell


Bool AskExcelString(
String, (Input: the cell label)
String (Output: the string from that cell)
)

// read an integer number from an excel file cell


Bool AskExcelNumber(
String, (Input: the cell label),
Integer (Output: the number from that cell)
)

// read a real (or double prec.) value from an excel file


Bool AskExcelValue(
String, (Input: the cell label)
Real (Output: the real value from that cell)
)

//// Utilities /////////////////////////////////////////////////////////////////

// prompt for a file name


Bool AskForFileName(
String, (Input: Default file name)
String, (Input: file access mode “r” = read, “w” = write, “t” = text, “b” = binary)
String (Output: the file name)
)

// get the name of the current Mastercam part


String GetCurrentFileName()

// set the name of the current Mastercam part


Void SetCurrentFileName(
String (Input: new file name)
)
// get the path of the current Mastercam directory
String GetPath()
// get the path to the current script
String GetPathOfThisScript()

// repaint the screen


Void RepaintScreen(
Bool (input: fit the screen to it’s contents?)
)

// get the name of a certain level, given its number


String GetLevelName(
Integer (Input: level number)
)

// get the number of a certain level, given it’s name


Integer GetLevelNumberFromName(
String (Input: level name)
)

// set the current construction level by entering it’s name


Bool SetLevelByName (
String (Input: name of level to become current construction level)
)

// set the current construction level by entering it’s number


Bool SetLevelByNumber (
Integer (Input: number of level to become current construction level)
)

// import a DXF (or DWG) file into the current Mastercam session
Void ReadDXF(
String (Input: the file name)
)

// save the current Mastercam file


Void SaveMC(
Bool (Input: save the current screen image inside the file?)
)

// save the current Mastercam file


Bool SaveMCAs(
String, (Input: the file name)
Bool (Input: save the current screen image inside the file?)
)

// open a Mastercam file


Bool openMC(
String (Input: the path and name of the Mastercam file name)
)

// reinitialize the database and/or the OpMgr so it’s empty


Void NewMC(
Bool (Input: Only initialize the operation manager?)
)

// launch an EXE and optionally wait for it to come back


Void ShellAndWait(
String, (Input: path and name of executable)
Bool (Input: wait for it to return??)
)

// send the current graphics screen to a metafile


Bool DoMetafile(
String (Input: name of output EMF File)
)

//// General Toolpath generation functions ///////////////////////////////////////

// initialize the depths/planes of a toolpath to reasonable defaults


Void InitParameters()

// clear the current parameter defaults


Void ClearParameters()

// intialize the Clearance plane of a toolpath


Void SetClearancePlane(
Bool, (Input: clearance plane is turned on?)
Bool, (Input: clearance plane height is incremental?)
Real (Input: clearance plane height)
)

// intialize the Retract plane of a toolpath


Void SetRetractPlane(
Bool, (Input: retract plane is turned on?)
Bool, (Input: retract plane height is incremental?)
Real (Input: retract plane height)
)

// intialize the Top-of-stock plane of a toolpath


Void SetTopOfStock(
Bool, (Input: top of stock height is incremental?)
Real (Input: top of stock height)
)
// initialize the depth of a toolpath
Void SetDepth(
Bool, (Input: depth is incremental?)
Real (Input: depth)
)

Void SetPlaneNormal(
Real, (Input: X co-ordinate of tool plane normal vector)
Real, (Input: Y co-ordinate of tool plane normal vector)
Real (Input: Z co-ordinate of tool plane normal vector)
)

// regenerate an existing operation


Bool RegenOp(
Integer (Input: operation ID #)
)

// display the chain manager with the chains of an existing operation


Void RunChainManager(
Integer (Input: operation ID #)
)

// display the point manager with the points of an existing drill operation
Void RunPointManager(
Integer (Input: operation ID #)
)

// display the parameter screen for an operation


Void EditOperationParameters(
Integer (Input: operation ID #)
)

// display the chain/point/surface manager an existing operation


// which manager will appear depends on the operation type
Void EditOperationGeometry(
Integer (Input: operation ID #)
)

// make a Contour operation using the current chains and some tool dimensions
// if you don’t call one or more of the depth/plane initialization functions, reasonable
// defaults will be used
// this function returns an operation ID # or mcOPERATION_INVALID
Integer MakeContour(
String, (Input: operation comment)
Real, (Input: tool diameter – or use 0 and just search on tool # & rad)
Real, (Input: tool corner radius if tool type is mcTOOL_BULL
- or use 0 and just search on tool dia & #)
Integer, (Input: tool number – or use 0 and just search on tool dia & rad)
Integer, (Input: see Mill tool types)
Integer (Input: see Cutter compensation flags above)
)

// make a Contour operation using the current chains and a specific tool ID
// if you don’t call one or more of the depth/plane initialization functions, reasonable
// defaults will be used
// this function returns an operation ID # or mcOPERATION_INVALID
Integer MakeContourWithKnownTool(
String, (Input: operation comment)
Integer (Input: tool ID)
Integer (Input: see Cutter compensation flags above)
)

// make a Pocket operation using the current chains and some tool dimensions
// if you don’t call one or more of the depth/plane initialization functions, reasonable
// defaults will be used
// this function returns an operation ID # or mcOPERATION_INVALID
Integer MakePocket(
String, (Input: operation comment)
Real, (Input: tool diameter – or use 0 and just search on tool # & rad)
Real, (Input: tool corner radius if tool type is mcTOOL_BULL
- or use 0 and just search on tool dia & #)
Integer, (Input: tool number – or use 0 and just search on tool dia & rad)
Integer, (Input: see Mill tool types)
Integer (Input: see {Pocket styles)
Real, (Input: step over value)
)

// make a Pocket operation using the current chains and a specific tool ID
// if you don’t call one or more of the depth/plane initialization functions, reasonable
// defaults will be used
// this function returns an operation ID # or mcOPERATION_INVALID
Integer MakePocketWithKnownTool(
String, (Input: operation comment)
Integer (Input: tool ID)
Integer (Input: see Pocket styles)
Real, (Input: step over value)
)

// to add a point to the drill point list


Void AddDrillPoint (
Real, (Input: X co-ordinate of point to add to current drill point list)
Real, (Input: X co-ordinate of point to add to current drill point list)
Real (Input: X co-ordinate of point to add to current drill point list)
)

// to add a point to the drill point list, specifying a drill depth for this point
Void AddDrillPointToDepth (
Real, (Input: X co-ordinate of point to add to current drill point list)
Real, (Input: X co-ordinate of point to add to current drill point list)
Real, (Input: X co-ordinate of point to add to current drill point list)
Real (Input: depth to drill to)
)

// to wipe out the current drill point list


Void ZeroPts()

// set the drilling jump height for any points to added after this call
Void SetDrillJumpHeight(
Real (Input: Drilling “jump” height)
)

// set the drilling break through depth for any points to added after this call
Void SetDrillBreakThrough (
Real (Input: Drilling break through distance)
)

// make a Drill operation using the current point(s) and some tool dimensions
// if you don’t call one or more of the depth/plane initialization functions, reasonable
// defaults will be used
// this function returns an operation ID # or mcOPERATION_INVALID
Integer MakeDrill(
String, (Input: operation comment)
Real, (Input: tool diameter – or use 0 and just search on tool # & tipangle)
Real, (Input: tool tip angle)
Integer, (Input: tool number – or use 0 and just search on tool dia & tipangle)
Integer (Input: See Drilling tool types above)
)

// make a Drill operation using the current point(s) and a known tool ID
// if you don’t call one or more of the depth/plane initialization functions, reasonable
// defaults will be used
// this function returns an operation ID # or mcOPERATION_INVALID
Integer MakeDrillWithKnownTool(
String, (Input: operation comment)
Integer (Input: tool ID)
)
// let the user define a new tool with a dialog
// this function returns a tool ID #
Integer DefineNewTool(
Bool drillTool (Input: will it be a drilling tool?)
)

// let the user edit an existing tool


Void EditTool(
Integer (Input: tool ID #)
)

// get the diameter of a tool


Real GetToolDiameter(
Integer (Input: tool ID #)
)

// get the corner radius of a tool


Real GetToolCornerRadius(
Integer (Input: tool ID #)
)

// get the tool number of a tool


Integer GetToolNumber(
Integer (Input: tool ID #)
)

// get the type of a tool (see the milling and drilling tool types)
Integer GetToolType(
Integer (Input: tool ID #)
)

Вам также может понравиться