Andrew
I've tried several variations on this and have been unable to get it to work.
I've attached my linuxcnc post processor, could you take a look and correct my errors?
Thanks
Jim
getting date time to work
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Indicate the post processor used.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Indicate the post processor used.
Attach drawing files and screenshots.
Post one question per topic.
getting date time to work
- Attachments
-
- LxcncIn.js
- (2.05 KiB) Downloaded 496 times
Re: getting date time to work
Code: Select all
// --> make sure to initialize the prototype _before_ attaching functions to it
// --> otherwise the functions are added to prototype and then prototype is initialized and the functions deleted
LxcncIn.prototype = new GCodeIN();
LxcncIn.prototype.writeFile = function(fileName) {
// init date / time variable:
var today = new Date();
this.dateTime = formatDate(today, "dd/MMM/yyyy hh:mm:ss");
// --> call writeFile from base class (not this class) to avoid recursion:
return GCodeIN.prototype.writeFile.call(this, fileName);
};
Use
Code: Select all
qDebug("message");
Code: Select all
EAction.handleUserMessage("message")
Re: getting date time to work
Andrew
I appreciate your explanations of how functions, prototypes, and initialization work but after several hours spent reading at http://eloquentjavascript.net/ I am still unable to get this function to work. And a age 71 I doubt I will ever get how this works
The third line in you example is the next to last line the post processor I attached. So I assumed that's where the code should go. But if I place the code anywhere below either of the last two lines in the LxcncIn.js post the post will not produce any gcode when executed. And if the code is place above the last two lines while it produces gcode it does not produce the date/time variable.
I am running 3.17.2.0 on Ubuntu 16.04 and also 3.17.3.1 on Centos 6.9 Is it possible for you to correct my post processor so that it works without my having to learn how opp? This version control feature is important to me and I would assume others. I am surprised that it is not a part of your code already.
Thanks
Jim
I appreciate your explanations of how functions, prototypes, and initialization work but after several hours spent reading at http://eloquentjavascript.net/ I am still unable to get this function to work. And a age 71 I doubt I will ever get how this works
The third line in you example is the next to last line the post processor I attached. So I assumed that's where the code should go. But if I place the code anywhere below either of the last two lines in the LxcncIn.js post the post will not produce any gcode when executed. And if the code is place above the last two lines while it produces gcode it does not produce the date/time variable.
I am running 3.17.2.0 on Ubuntu 16.04 and also 3.17.3.1 on Centos 6.9 Is it possible for you to correct my post processor so that it works without my having to learn how opp? This version control feature is important to me and I would assume others. I am surprised that it is not a part of your code already.
Thanks
Jim
Re: getting date time to work
I've attached the fixed post processor.
- Attachments
-
- LxcncIn.js
- (2.05 KiB) Downloaded 485 times
Re: getting date time to work
Andrew
Thank you. The post you sent was the same one I tried after your first response so I feel I am not quite as dumb and I did yesterday. The post fails the same way mine did. When the CamExport icon is pressed text appears in the message window but the gcode file does not get written.
If I comment out the lines after "LxcncIn.displayName = "Lxcnc [in]";" then it writes the gcode.
I have no idea why this happens but it is frustrating.
Would it be better to define the function that returns "dateTime" in GCodeBase.js ?
Thanks
Jim
Thank you. The post you sent was the same one I tried after your first response so I feel I am not quite as dumb and I did yesterday. The post fails the same way mine did. When the CamExport icon is pressed text appears in the message window but the gcode file does not get written.
Exporting offset path
Command: camexport
Generating toolpath "Profile 1"
Tool "1"
Purging toolpath block...
Copying source entities...
Identifying contours...
Contours identified: 1
open: 0
closed: 1
Computing nesting degrees...
Creating spatial index...
Adding entry points for contour 0:
2.607,3.105
Processing 1 contours
Processing contour 0
Contour orientation: Clockwise
Processing contour in single pass.
Starting at: 2.607,3.105
Creating new polyline for offsetting
Exporting offset path
If I comment out the lines after "LxcncIn.displayName = "Lxcnc [in]";" then it writes the gcode.
I have no idea why this happens but it is frustrating.
Would it be better to define the function that returns "dateTime" in GCodeBase.js ?
Thanks
Jim
Re: getting date time to work
Please find attached an updated version what should work with your version of QCAD/CAM.
- Attachments
-
- LxcncIn.js
- (2.08 KiB) Downloaded 504 times