I wrote a post processor to post out of HSMWorks to a Trak TRL 1440EX. This was actually the first time that I had used Javascript. /** Author: Michael Sobrepera Usage: Post processor for TRAK TRL 1440 EX -> should work with any ELX controller Version: .01 Date: 3-Nov-2014 */ description = "ELX Post"; vendor = "M. Sobrepera"; vendorUrl = ""; legal = "use it as you like, share original and modifications with everyone free of charge or burden; You assume complete responsibility for any damages caused by use of this file"; certificationLevel = 2; extension = ".cam"; setCodePage("ansi"); programNameIsInteger = true; capabilites = CAPABILITY_TURNING; allowedCircularPlanes = undefined; // allow any circular motion var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4), forceSign:true, forceDecimal:true,trimLeadZero:true,trim:true}); var xFormat = createFormat({ decimals:(unit == MM ? 3 : 4), forceSign:true, forceDecimal:true,trimLeadZero:true,trim:true,scale:2}); //TRAK Runs on diameter, not radius, HSM outputs radius. var xModal = createModal({prefix: " X"}, xFormat); var zModal = createModal({prefix: " Z"}, xyzFormat); var iOutput = createVariable({prefix: " I",force:true},xyzFormat); var kOutput = createVariable({prefix: " K",force:true},xyzFormat); var feedFormat = createFormat({decimals:2}); var mFormat = createFormat({decimals:0}); var gFormat = createFormat({decimals:0}); var feedModal = createVariable({prefix:" F"}, feedFormat); var mOutput = createFormat({prefix:"M", decimals:0}, mFormat); var gOutput = createFormat({prefix: "G", decimals:0}, gFormat); //might need to make tool number modal var toolFormat = createFormat({width:2, zeropad: true}); var toolModal = createModal({prefix: " T"},toolFormat); var speedFormat = createFormat({}); var speedModal = createModal({prefix: "(RPM: ",suffix:")"},speedFormat); var blockNumber = 0; /** Writes the specified block.*/ function writeBlock(block) { writeln(blockNumber + SP + block); ++blockNumber; } function writeBlockComment(block) { writeln("( "+block+" )"); } function resetModals(){ xModal.reset(); zModal.reset(); speedModal.reset(); toolModal.reset(); } function resetXZ(){ xModal.reset(); zModal.reset(); } function onOpen(){ resetModals(); writeBlock(gOutput.format(40)) //Sets the cutter to center (keeps trak control from calculating radius compensation) //set working units if(unit==MM){ writeBlock(gOutput.format(21)); } else{ writeBlock(gOutput.format(20)); } } function onComment(comment){ writeBlockComment(comment); } function onSection(){ if (currentSection.feedMode == FEED_PER_REVOLUTION) { feedFormat.setScale(tool.spindleRPM); feedModal = createModal({prefix:" F"}, feedFormat) } else { feedFormat.setScale(1); feedModal = createModal({prefix:" F"}, feedFormat) } if (hasParameter("operation-comment")) { var comment = getParameter("operation-comment"); if (comment) { writeBlockComment(comment); } } var newTool = toolModal.format(tool.number); var newSpeed = speedModal.format(tool.spindleRPM); if(newTool||newSpeed){ writeBlock(newTool+SP+mOutput.format(6)+newSpeed); //goes home, kills spindle, change tool request } resetXZ(); } function onRapid(x,y,z){ var out = xModal.format(x) + zModal.format(z); if(out){ writeBlock(gOutput.format(0)+out); } } function onLinear(x,y,z,feed){ var out = xModal.format(x) + zModal.format(z); if(out){ writeBlock(gOutput.format(1)+out+feedModal.format(feed)); } } function onCircular(clockwise, cx, cy, cz, x, y, z, feedrate){ //I and K are incremental from center // clockwise is opposite of normal var ends = xModal.format(x)+zModal.format(z); var current = getCurrentPosition(); var centers = iOutput.format(cx-current.getX())+kOutput.format(cz-current.getZ()); if(ends&&clockwise){ writeBlock(gOutput.format(3)+ends+centers); } else if(ends&&!clockwise){ writeBlock(gOutput.format(2)+ends+centers); } } function onSpindleSpeed(spindleSpeed){ onSection(); } function onClose(){ writeBlock(mOutput.format(6)); //kill spindle, go home writeBlock("%"); //end of file marker }