[solved] CAM output decimal places
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.
[solved] CAM output decimal places
My device only reads integers. How can I control the number of decimal places in CAM output?
Re: CAM output decimal places
This information applies to legacy CAM configuration files (in scripts/Cam/CamConfigurations).
Open the file "HPGL.js" and change:
to:
Alternatively, you can create your own configuration, base on HPGL.js (e.g. MyHPGL.js).
Open the file "HPGL.js" and change:
Code: Select all
this.decimals = 4;
Code: Select all
this.decimals = 0;
Re: CAM output decimal places
Great, thanks! Editing HPGL.js worked to control the number of decimal places in CAM output.
But I tried saving the script as "HPGL-integer.js" and that didn't work. It showed up in the Configuration list but gave error
Configuration file does not provide a class named "HPGL-4digit".
I can probably figure this out myself but a little more help would be appreciated. I am struggling to use a laser running MSDOS and can't spend much "company time" on this. Old engraving jobs were done years ago but the software tools are long gone. The only way to input new jobs was a floppy disk, and we don't have any of those any more. So I partitioned the drive to boot Windows XP (!) just to copy files from a USB chip. Then reboot into MSDOS and see if it works. If it doesn't, run back upstairs to my desk and try something else. It took three days of this just to determine that the decimal point was a problem. So you saved me writing a post-processor... thanks again!
Code: Select all
this.decimals = 0; // Was 4
Configuration file does not provide a class named "HPGL-4digit".
I can probably figure this out myself but a little more help would be appreciated. I am struggling to use a laser running MSDOS and can't spend much "company time" on this. Old engraving jobs were done years ago but the software tools are long gone. The only way to input new jobs was a floppy disk, and we don't have any of those any more. So I partitioned the drive to boot Windows XP (!) just to copy files from a USB chip. Then reboot into MSDOS and see if it works. If it doesn't, run back upstairs to my desk and try something else. It took three days of this just to determine that the decimal point was a problem. So you saved me writing a post-processor... thanks again!
Re: CAM output decimal places
The filename has to match the class in the file.
Ideally, you would derive your class from HPGL and only change the decimal places. This is an example for a file scripts/Cam/CamConfigurations/MyHPGL.js:
Note that HPGL-integer is not a valid class name as this would evaluate into a mathematical expression in JavaScript. HPGLInteger or HPGL_Integer would both work tough.
Ideally, you would derive your class from HPGL and only change the decimal places. This is an example for a file scripts/Cam/CamConfigurations/MyHPGL.js:
Code: Select all
include("HPGL.js");
function MyHPGL(documentInterface, newDocumentInterface) {
HPGL.call(this, documentInterface, newDocumentInterface);
this.decimals = 0;
}
MyHPGL.prototype = new HPGL();
Re: CAM output decimal places
Thanks, again! Was looking for class declaration because I'm used to C++, seems like JS does it implicitly. So all the member names have to change, a simple edit.
BTW - How do I mark a thread as solved? This one is solved to my total satisfaction.
BTW - How do I mark a thread as solved? This one is solved to my total satisfaction.