Hello Guest it is March 29, 2024, 04:30:46 AM

Author Topic: Tormach / Mach3 / Sprutcam code failure  (Read 12634 times)

0 Members and 1 Guest are viewing this topic.

Tormach / Mach3 / Sprutcam code failure
« 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
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #1 on: July 31, 2008, 01:05:41 PM »
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
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #2 on: July 31, 2008, 01:10:26 PM »
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.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #3 on: July 31, 2008, 01:36:56 PM »
please attach the M998 macro.
Hood
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #4 on: July 31, 2008, 01:58:33 PM »
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   

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #5 on: July 31, 2008, 02:14:38 PM »
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
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #6 on: July 31, 2008, 02:56:07 PM »
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.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #7 on: July 31, 2008, 02:59:04 PM »
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
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #8 on: July 31, 2008, 02:59:53 PM »
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 ?

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Tormach / Mach3 / Sprutcam code failure
« Reply #9 on: July 31, 2008, 03:06:34 PM »
Probably ok as your other macros will be doing the  toolchange.
Hood