Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: JTulley on July 31, 2008, 12:30:56 PM
-
I've just attempted to run my first personally generated G-code program using Solidworks to Sprutcam for a Tormach PCNC110.
When I run the code it starts off OK, i.e. moves to a tool change position, requests tool change then moves Z towards the workpiece. However the spindle does not get turned on and an error box pops up saying
Error on line:2 - Unspecified error
Meanwhile the G-code program continues running, generating machine motion ( but no spindle rotation)
Clicking OK to the first error message brings up another window - M5 - Mach3 VB Script Editor with the code DoSpinStop()
Funny thing is there isn't an M5 command issued from my code. ( Is the M5 part of the M998 instruction ? )
Any ideas why this is happening ?
[Program sample below]
%
OProject
N10 G90 G17 G40 G80 G49
(Pocketing)
N20 M998
N30 T12 G43 H12 M6
(Cylindrical mill L21, D12)
N40 G0 X160.315 Y32.987 Z25. S1600 M3
N50 G0 Z21.
N60 G1 Z16. F100 M8
N70 G3 X160.315 Y32.987 Z16. I-0.316 J-2.9837
N80 X159.724 Y33.234 Z16. I-1.4125 J-2.544
N90 X159.018 Y33.359 Z16. I-0.9163 J-3.113
N100 X156.876 Y28.425 Z16. I0.9815 J-3.3579 F200
-
Have you checked that the spindle control switch is in the "auto" position and that the head/door interlock switch is closed?
I don't know if M5 is part of M998 or not but my SprutCAM-generated code for a PCNC 1100 matches your lines N10 and N20.
Mike
-
The spindle is in the auto position, and I can start it with either the spindle start button on the screen, or using an M3 command in the MSI.
M5 also works in the MDI to stop the spindle.
-
please attach the M998 macro.
Hood
-
I should also say that I set the units to metric in the M990 file as previously discussed, and also that the M998 worked when using the firstpart.nc program.
' Revised 3 Jan 07 to shorten Not Reffed message
' Revised 2 Aug 2005, JAP to ignore the 9999 values and to be Units aware.
Option Explicit
' This macro iimplements Goto Tool Change logic
Dim x, y, z, CurrMetric
Dim PosIsMetric, DestX, DestY, DestZ
If NOT GetLED (7) AND Not GetLED (8) AND Not GetLED (9) Then ' axes are reffed so Abs coords OK
x = GetUserDRO( 1200 )
y = GetUserDRO( 1201 )
z = GetUserDRO( 1202 )
PosIsMetric = GetUserDRO (1209) ' this is definition of what units the tool change position is in
CurrMetric = GetLed (2)
If (CurrMetric <> 0 And PosIsMetric <> 0) Or (CurrMetric = 0 And PosIsMetric = 0) Then ' we need no conversion
DestX = x
DestY = y
DestZ = z
ElseIf CurrMetric <> 0 and PosIsMetric = 0 Then ' we need to convert to metric
If x <> 9999 Then DestX = x * 25.4
If y <> 9999 Then DestY = y * 25.4
If z <> 9999 Then DestZ = z * 25.4
Else ' convert to imperial
If x <> 9999 Then DestX = x / 25.4
If y <> 9999 Then DestY = y / 25.4
If z <> 9999 Then DestZ = z / 25.4
End If ' got a valid set of destinations
Code "G0" ' to switch things to G0 mode if not there already
If z <> 9999 Then
Code "G53Z" & DestZ
If x <> 9999 And y <> 9999 Then ' can do coordinated move
Code "G53X" & DestX & "Y" & DestY
Else ' do separate move
If x <> 9999 Then Code "G53X" & DestX
If y <> 9999 Then Code"G53Y" & DestY
End If
Else
Message " Z must be moved for safety of X and Y moves but position is 9999"
End If
Else
Message "Cannot use button/M998 as not referenced"
End If
-
Dont see anything in that macro that should cause a problem also dont think having the Speed and M3 on the same line as other code should cause a problem but just try placing the S1600 M3 on the line above so it looks like this
S1600 M3
N40 G0 X160.315 Y32.987 Z25.
I will see if I can grab the Tormach install and see what happens here but your code certainly seems to run fine on standard Mach3.
Hood
-
One of the things I notice is that some of the G codes have the leading zeroes missing. ,e.g rather than G00 this code has G0.
I don't think that this should be important, but I'll probably modify the code tomorrow when I'm next at the machine to see if it makes a difference.
-
no, Mach can recognise G0 or G00, G1 or G01, so thats not a problem.
Been looking at the Tormach site to see if I can download the xml and macros but cant find them I am afraid.
Hood
-
I've just checked out the M6 macro as well. I have two, M6start.m1s and M6end.m1s
M1Start has the code:
tool = GetSelectedTool()
SetCurrentTool( tool )
but M6end is blank.
Does this make sense ?
-
Probably ok as your other macros will be doing the toolchange.
Hood
-
I have them here. Hopefully they are attached OK
-
Seems to run fine here with your macros, of course I am using the standard Mach3 rather than the OEM that Tormach use, also just using a generic xml but the spindle LED lights as it should.
Hood
-
Thanks for your help Hood.
I guess I'll just have to manually reenter the code line by line until I find the fault.
Could even be an"invisible" character on the code line.
I can check if the firstpart.nc file still runs, it may well be that working in metric with the Tormach throws up more errors as they are clearly mostly used in the US, not Europe.
-
Dont know for sure but I would imagine John P uses metric mostly.
Can you attach your xml and the full code and I will load it and see if I get a problem.
Might also be worth asking on the Yahoo group for Tormach as although it is based on Mach it is an OEM version so things may work a bit differently.
Hood
-
Here's the .xml and full code.
-
Hood, It appears to have resolved itself.
The program runs fine today. Very strange as I did several reboots yesterday when I was having the problems.
Thanks again for the help.
-
oops, read your post before I came to the workshop and said I will wait and download the xml etc when I get here, guess what, I forgot :(
Good you seem to be sortedm I know there are a few bugs with VB etc and Brian is working hard on a new revision of Mach which amongst other things is dealing with VB issues. Obviously you will have to wait a while after the Mach revision as Tormach will have too check it over and do whatever they do to make their OEM version but think if all goes well Tormach will be quick with this one.
Hood