Circles and CNC

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Circles and CNC

Post by Sterling » Sun Nov 23, 2014 7:24 pm

Howdy all (again)

I am seriously new to this - so my apologies if this is something obvious!!
NOTE: I saw elsewhere about "converting lines and arcs into segments" (command: OG) but that didn't work either. :/

My situation....
I am having a problem exporting a DXF file with circles and arcs! I will design something in QCAD that contains arcs...
Then use the CAM Export
Then load it into my Linux CNC machine
...I get an error.
Judging on what I see in the error message, for some reason arcs do not line up when exported~!! However, I can make the same drawing, save it as an SVG and use Makercam to export it for the CNC...and it works. (so I'm sure it is not my CNC software).


Idea? Help? It would really be an arduous process to draw these things by hand!
...I've uploaded an error message...
Attachments
QcadArcError.png
QcadArcError.png (128.86 KiB) Viewed 16734 times
>>>Thanx!

~Sterl~

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: Circles and CNC

Post by andrew » Sun Nov 23, 2014 7:48 pm

The X/Y coordinates in your G-Code file look like they are relative. However, your application tries to interpret them as absolute coordinates.
You either have to:
- produce absolute X/Y coordinates with QCAD/CAM or
- add a setting to the header to tell your machine that X/Y coordinates are relative (incremental). You can do this very likely by changing G90 in the header to G91.

Keep in mind that Z movements will likely also be interpreted as being relative if you switch to G91 (incremental) positioning. I'd recommend to stick to absolute coordinates.

What configuration did you use when creating the G-Code file from QCAD/CAM? The default configuration of QCAD/CAM ('GCode') actually produces absolute X/Y coordinates.
Or perhaps your machining software has converted the file based on some user preference? Just a wild guess...

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Sun Nov 23, 2014 8:45 pm

Howdy -
Thanx for the reply Andrew~!


Here is the thing:
I have exported it using the "GCode" option as well as the "LinuxCNC" option (which was a *.js script file written by someone from the LinuxCNC forms)
In the past, I have exported designs that have contained arcs before, and there has been an intermittent problem...but not every single time like I am getting now. :/
I have even taken the arcs, and trace over them using the "Two Points And An Angle" command (A2) repeating them with a 10 degree angle.

I'm fairly certain there is something awry in the exporting process because when I do so, the header and initial coordinates are as follows =
G20 G17 G40 G49 G54 G64 P0.005 G80 G90 G94
G0 ZNaN
XNaN YNaN

...obviously this will not do! :P
I uninstalled and updated QCADCAM to version 3.7.2

I'm pretty new to this, and don't understand much regarding the terminology or definitions; I draw and export! So if I miss something or am not clear, let me know & I will try to me more clear! Thanx~!
>>>Thanx!

~Sterl~

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Sun Nov 23, 2014 8:54 pm

NOTE: Lines #2 and #3 were hand coded in by me (the were NaN)
Also...the Initial X and Y coordinates are negative, ad that doesn't make sense either as I have the image well within the positive side of the area!
>>>Thanx!

~Sterl~

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: Circles and CNC

Post by andrew » Sun Nov 23, 2014 10:11 pm

OK, it looks like the configuration you are using is probably broken.

I've attached a simple configuration based on the information I've seen on your screenshot:
(attachment removed, latest version below)

I'd expect that there are probably other things that need to be adjusted, just let me know.

- Quit QCAD/CAM
- Save the attached file to your QCAD/CAM installation under scripts/Cam/CamConfigurations

When converting to CAM, choose the configuration "LinuxCNC". You can choose absolute or incremental positioning. The configuration should support both.

I've also pasted the contents of the file here to make it easier to view for interested users:
// include GCode configuration:
include("GCode.js");

// constructor: set up global settings:
function LinuxCNC(documentInterface, newDocumentInterface) {
    GCode.call(this, documentInterface, newDocumentInterface);

    // output unit is inch:
    this.unit = RS.Inch;

    // output four decimals (e.g. 1.2345):
    this.decimals = 4;

    // for incremental positioning, set current position as 0/0:
    this.x = 0.0;
    this.xPrev = 0.0;
    this.y = 0.0;
    this.yPrev = 0.0;
    this.z = 0.0;
    this.zPrev = 0.0;
}

// configuration is derrived from GCode:
LinuxCNC.prototype = new GCode();

LinuxCNC.prototype.getFileExtensions = function() {
    // set allowed output file extension:
    return ["ngc"];
};

LinuxCNC.prototype.getLineNumberCode = function() {
    // don't use line numbers:
    return "";
};

// header:
LinuxCNC.prototype.writeHeader = function() {
    // LinuxCNC header:
    if (this.getIncrementalXYZ()) {
        this.writeLine("G20 G17 G40 G49 G54 G64 P0.1 G80 G91 G94");
    }
    else {
        this.writeLine("G20 G17 G40 G49 G54 G64 P0.1 G80 G90 G94");
    }
    // retreat to safety level:
    this.writeRapidZMove(this.getSafetyZLevel());
    this.toolPosition = GCode.ToolPosition.Clear;
};

// footer:
LinuxCNC.prototype.writeFooter = function() {
    this.writeToolUp();
    this.writeRapidZMove(this.getSafetyZLevel());
    this.toolPosition = GCode.ToolPosition.Clear;
    this.writeLine("M2");
};

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 12:12 am

I will give that a try! Thanx muchly! 8)
>>>Thanx!

~Sterl~

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 1:55 am

Thanx for the file!!
Let me start off by saying that I did not receive an error. :)
However...I noticed that when I loaded the exported file into the CNC machine, the measurements were not what I remembered. When I looked at the "header" of the code, I saw that G21 was listed first, meaning the code was generated in metric. I had made the drawing in inches. So, I changed the "G21" into "G20"; reloaded the file and I receive an arc error again. :/

So then I changed the drawing table in QCADCAM from inches into mm. However, my 4inch drawing did not become a 25mm drawing. It became a 4mm drawing!

Instead of redrawing everything...is there another way to convert?
>>>Thanx!

~Sterl~

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 2:24 am

I changed the G21 to G20 in your file and encountered an ARC error again.
So then, I changed the size of my drawing from 4inches to 25inches.

The export worked and loaded fine...however, the Z axis was EXTREMELY high, and instead of following the arcs (there are about 5 of them) it broke each one into multiple segments of about 10+.
Maybe I need to change the QCADCAM application and drawing preferences from inch to metric and then reload it and try again?
IDK...I'm running out of ideas~! :P
>>>Thanx!

~Sterl~

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: Circles and CNC

Post by andrew » Mon Nov 24, 2014 9:53 am

Sterling wrote:When I looked at the "header" of the code, I saw that G21 was listed first, meaning the code was generated in metric.
The code is actually produced in Inches (this.unit = RS.Inch;).
The LinuxCNC config outputs a fixed header ("G21 G17 G40 G49 G54 G64 P0.1 G80 G91 G94" or "G21 G17 G40 G49 G54 G64 P0.1 G80 G90 G94"). It is important to understand that QCAD/CAM does not know (or care) about the meaning of this header. The meaning is also highly depended on individual machines.

I've adjusted the config to produce "G20" instead of "G21".
I receive an arc error again.
Arcs are coded with I / J coordinates. Some machines expect these coordinates to be absolute, others relative to the arc start point. If you know which one it is for your machine / controller, I can change the configuration accordingly. If you don't have that information, perhaps you can provide a working example with an arc in it, so I can analyse it.

Another possible source for errors are the decimal places. Perhaps, your machine expects more decimal places (or less) than generated by the LinuxCNC config. The decimal places are currently set to 4 (this.decimals = 4;). Again, a working example or machine documentation, etc. would be helpful.

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 2:09 pm

Groovy, thanx! I am running LinuxCNC version 2.6.3 ...and I see that 2.6.4 has been released. I'll update that and look into the rest. Thanx again~!
>>>Thanx!

~Sterl~

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 3:40 pm

My Linux CNC machine is not hooked up to the internet. So I brought it in, and ran the updates.
I have QCADCAM installed on that machine as well (version 3.7.2) So I decided to run some tests on that while at my desk inside the house I took my original QCADCAM image, made a new layer, then drew the top arc over the old one, hid all but the new layer and exported it = It worked!
I did this with the next two arcs, and it worked. Even when I joined #2 and #3. Then I drew the last inside arc, exported that file, but received an error.

So I decided to deleted that last arc, draw a straight line and then redrew the arc… it worked~!!! (curious...)

Files uploaded/attached
(File with error = “Top4Arc.ngc”)
(File without error =“Top4.ngc”)
(Image of error "4arclast-bad.ngc")
Attachments
4arc_last-bad.png
4arc_last-bad.png (125.84 KiB) Viewed 16691 times
Top4.ngc
(363 Bytes) Downloaded 556 times
top4Arc.ngc
(329 Bytes) Downloaded 540 times
>>>Thanx!

~Sterl~

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 3:50 pm

A couple of addendums...
#1) Yesterday my work was being done on my home machine, which is a Windows machine & where I do the majority of my design work.
#2) Today I had been doing this on the Linux machine.

I'm not sure if that makes a difference...both are running the same version of QCADCAM.

Oh, and one more thing I just realized - the Linux exported the files export using that original Linux_cnc.js...not the one you made/modified.

I can give the same procedure a try on my Windows machine and see if that makes a difference!

(And again - Thank you *very* much for the help!!)
Attachments
Lcnc_Mill.js
(2.13 KiB) Downloaded 561 times
>>>Thanx!

~Sterl~

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: Circles and CNC

Post by andrew » Mon Nov 24, 2014 4:09 pm

Sterling wrote:Oh, and one more thing I just realized - the Linux exported the files export using that original Linux_cnc.js...not the one you made/modified.
Hmm.. that pretty much explains it. My configuration cannot possibly fix any problems if you aren't using it ;) Any reasons for this?

The problem with your configuration file is that decimals are set to 3 (default), but LinuxCNC needs 4 decimals for Inch output.
The LinuxCNC.js configuration does all that, but you kinda do have to use it to benefit from that...

I've also copied over the other settings from your configuration in case you require any of these (defaults for clearing level, etc).

Anyway, latest version is attached.
Attachments
LinuxCNC.js
(2.37 KiB) Downloaded 546 times

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 5:46 pm

Awesome, thank you!!

In the interim, I decided to to uninstall QCADCAM from my windows7 notebook, reboot & them perform a fresh install.

I will remove the old LinuxCNC_mill.js file from the cam/cam congif directory and copy this new one in. Thanx again!
(Fingers crossed) :D
Last edited by Sterling on Mon Nov 24, 2014 5:50 pm, edited 1 time in total.
>>>Thanx!

~Sterl~

Sterling
Active Member
Posts: 27
Joined: Wed Nov 19, 2014 11:15 pm

Re: Circles and CNC

Post by Sterling » Mon Nov 24, 2014 6:07 pm

HUZZAH!!

I was able to Export it with no troubles *AND* when I copied it over to the Linux machine, there were NO ERRORS!!!!

THANK YOU!!!

Next up...copy your LinuxCNC file over to my Linux machine~!!! Thanx again! :D :D :D

(My apologies for being problematic!)
>>>Thanx!

~Sterl~

Post Reply

Return to “QCAD Troubleshooting and Problems”