Hello Guest it is April 19, 2024, 02:43:13 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - helmholtz

Pages: 1
1
I have a little project where I need to engrave serial numbers on about 200 pieces. I found this old post in another area of the forum and this macro sort of does the trick.  I started to modify it to get it to work the way I wanted but ran into trouble with some of the deprecated commands. It would be pretty helpful if I could get it to work as I can call the macro as part of a larger program to get the serial number on the part.

The macro is attempting to set each of these variables to the current X and Y axis DRO readouts. This doesn't work and I think the 'getdro' command is obsolete. Plus I think the syntax is wrong anyway.
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

Here is the original topic:
https://www.machsupport.com/forum/index.php/topic,11018.0.html

What I really need help with is what is the proper syntax to define a new variable, then set the variable to the current X axis DRO (and similar for the Y axis)? I played with the getOEMdro() command but I don't understand the syntax and how you would turn that dro reading into something that can be used as an integer. I'm not much of a programmer so the syntax and logic is a bit tough for me to figure out. I'd greatly appreciate any advice or alternative options!

 
Code: [Select]
It wil start off by engraving       S/N:     then adds the serial number    IE:    S/N: 090300001  ,  next run  S/N: 090300002 , ETC


CODE EXAMPLE:
' Macro for consecutive S/N engraving from MACH

Sub main
Dim A As String
Dim Ch As String
Dim Cnt As Integer
SetVar(1303 , .250)  'LetterSpacing
Setvar(1300 , -0.005) ' Z Depth cutting
Setvar(1200 , 0.050) ' Safe Z
'CPx= Getoemdro(0)
'CPy= Getoemdro(1)
SETIJMODE(1)
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "S"
Code "g90 G0  Z#1200 X[#1301 + .2250] Y#1302 "
code "G91G0 x -.0706"
code " y-.0449"
code "G90 G1Z#1300 F20."
code "g91 g1X.0159Y-.0361I.05J.0004"
code "X.0375Y-.0151I.0377J.0395"
code "G1X.0348"
code "G3X.0373Y.0151I-.0001J.0539"
code "X.0157Y.0361I-.0346J.0365"
code "X-.016Y.0383I-.0551J-.0004"
code "X-.037Y.0164I-.0378J-.0356"
code "G1X-.0352"
code "G2X-.0373Y.0157I.0003J.0528"
code "X-.0157Y.0372I.0371J.0376"
code "X.0157Y.0374I.0535J-.0004"
code "X.0373Y.016I.0377J-.0365"
code "G1X.0706"
code "G90 G0Z[#1200]"
Code "G0 Z#1200 X[#1301 + .2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "/"
Code "G0 Z#1200 X[#1301 + .2250] Y#1302 "
code "G91G0X.0357Y.1071"
code "G90 G1Z#1300 F20."
code "G91 g1X-.1071Y-.2142"
code "G90 G0Z[#1200]"
Code "G0  Z#1200 X[#1301 + .2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend 
 
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "N"
Code "G90  g0 X[#1301 + .2250] Y#1302 "
code "G91G0X-.0706 Y-.1078"
code "G90 G1Z#1300 F20."
code "G91 g1y.2156"
code "x.1412 Y-.2156" 
code "y.2156"
code "G90 G0 Z#1200"
Code "G0 Z#1200X[#1301 + .2250] Y#1302"

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message ":"
Code "G90  g0 X[#1301 + .2250] Y#1302 "
code "G91G0y-.0559"
code "G90 G1Z[#1300 -.010] F20."
Code "Z#1200"
code "G91 Y.1118"
code "G90 G1Z[#1300 -.010] F20."
Code "Z#1200"
Code "G0 Z#1200X[#1301 + .2250] Y#1302"

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend


P10= GetOEMDRO(1050)
A=Str(P10)
For Cnt=1 To Len(A)
  Ch=Mid(A,Cnt,1)
  Select Case Ch
    Case "0" ZERO
    Case "1" ONE
    Case "2" TWO
    Case "3" THREE
    Case "4" FOUR
    Case "5" FIVE
    Case "6" SIX
    Case "7" SEVEN
    Case "8" EIGHT
    Case "9" NINE
  End Select
Next
P10=P10+1
SetOEMDRO(1050,P10)
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))
SETIJMODE(1)
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend   

End Sub

Sub ZERO
message "Zero"
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

Code " G0 X[#1301 + .2250] Y#1302 "
code "G90 G0 z#1200"
code "G91 G0 X-.0004Y.1076"
code "G90 G1 Z#1300 F20."
code "G91 G1X.0176 "
code "G2X.0374Y-.0194I-.0021J-.05"
code "X.0164Y-.0417I-.0488J-.0432"
code "G1X-.0009Y-.1012"
code "G2X-.0157Y-.0372I-.0527J.0004"
code "X-.0372Y-.0157I-.0375J.0371"
code "G1X-.0353"
code "G2X-.0372Y.0157I.0004J.0528"
code "X-.0157Y.0372I.0371J.0376"
code "G1Y.1059"
code "G2X.0157Y.0389I.0585J-.001"
code "X.0372Y.0175I.0382J-.033"
code "G1X.0177 "
Code "G90 Z#1200"
Code "G0 Z#1200X[#1301 + .2250] Y#1302"

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend
End Sub

Sub ONE
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "One"
Code "G90  g0 X[#1301 + .2250] Y#1302 "
code "G91G0X-.0359Y.0719"
code "G90 G1Z#1300 F20."
code "G91 X.0357Y.0361"
code "Y-.2156"
code "X-.0357"
code "X.0718"
code "G90 G0 Z#1200"
Code "G0 Z#1200X[#1301 + .2250] Y#1302"

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend
End Sub

Sub TWO
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "Two"
Code "G90 G0 Z#1200 X[#1301 + .2250] Y#1302 "
code "G91G0X-.071Y.0531 "
code "G90 G1Z#1300 F20. "
code "G91 G2X.0157Y.0375I.0535J-.0004 "
code "X.0377Y.0159I.0379J-.0371"
code "G1X.0352 "
code "G2X.0375Y-.0159I-.0005J-.0531 "
code "X.0159Y-.0375I-.0373J-.038 "
code "X-.0164Y-.0383I-.0527J-.0001"
code "G1X-.1256Y-.1213"
code "X.142"
code "G90 G0Z#1200"
Code "G0 Z#1200 X[#1301 + .2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend   
End Sub

Sub THREE
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "Three"

code "g90 G0 Z#1200 X[#1301 + .2250] Y[#1302 ]"
code "G91G0X-.0605Y.0917"
code "G90 G1Z#1300 F20."
code "G91 G2X.0362Y.0159I.0366J-.0341"
code "G1X.034"
code "G2X.0357Y-.0159I-.0006J-.0494"
code "X.0151Y-.0379I-.04J-.0379"
code "X-.0151Y-.0379I-.0552 "
code "X-.0357Y-.0159I-.0363J.0335"
code "X.0357Y-.0159I-.0006J-.0494"
code "X.0151Y-.0379I-.04J-.0379"
code "X-.0151Y-.0374I-.0546J.0002 "
code "X-.0357Y-.0159I-.0363J.0335"
code "G1X-.034 "
code "G2X-.0362Y.0154I.0002J.0505 "
code "G90 G0Z[#1200]"
Code "G0 Z#1200X[#1301 + .2250] Y#1302"

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend 
End Sub

Sub FOUR
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "Four"
Code "g90 G0 Z#1200 X[#1301 + .2250] Y#1302 "
code "G91G0X.0353Y-.1059"
code "G90 G1Z#1300 F20."
code "G91 Y.2117"
code "X-.1059Y-.1411"
code "X.1412"
code "G90 G0Z#1200"
Code "G0  Z#1200 X[#1301 + .2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend   
End Sub

Sub FIVE
 Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "Five"
Code "G90 G0  Z#1200 X[#1301 + .2250] Y#1302 "
code "G91G0X.0714Y.1071"
code "G90 G1Z#1300 F20."
code "G91 X-.1428"
code " Y-.0714"
code "X.0895"
code "G2X.0374Y-.0159I-.0005J-.0531"
code "X.0159Y-.0374I-.0372J-.0379"
code "G1Y-.0358"
code "G2X-.0159Y-.0378I-.0537J.0003"
code "X-.0374Y-.0159I-.0379J.0372"
code "G1X-.0357"
code "G2X-.0379Y.0159I.0002J.0536"
code "X-.0159Y.0374I.0372J.0379"
code "G90 G0Z#1200"
Code "G0 Z#1200 X[#1301 + .2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend   
End Sub

Sub SIX

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))


message "Six"
Code "G90 G0 Z#1200 X[#1301 + .2250] Y#1302 "

code "G91G0X.0555Y.091"
code "G90 G1Z#1300 F20."
code "G91 G3X-.0379Y.0155I-.0376J-.038"
code "G1X-.0352"
code "G3X-.0377Y-.0159I.0002J-.053"
code "X-.0157Y-.0375I.0378J-.0379"
code "G1Y-.1062"
code "G3X.0157Y-.0377I.0533J.0001"
code "X.0377Y-.0157I.0378J.0376"
code "G1X.0352"
code "X.0375Y.0157I-.0004J.0535"
code "X.0159Y.0377I-.0371J.0379"
code "G1Y.0352"
code "G3X-.0159Y.0375I-.0531J-.0005"
code "X-.0375Y.0159I-.038J-.0372"
code "G1X-.0352"
code "G3X-.0377Y-.0159I.0002J-.053"
code "X-.0157Y-.0375I.0378J-.0379"
code "G90 G0Z[#1200]"
Code "G0  Z#1200 X[#1301 + .2250] Y#1302 "
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend   
End Sub

Sub SEVEN
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))


message "Seven"
Code "G0 Z#1200 X[#1301 + .2250] Y#1302 "
code "G90 z#1200"
code "G91G0X-.0714Y.1071"
code "G90 G1Z#1300 F20."
code "G91 X.1428"
code "X-.1071Y-.2142"
code "G90 G0Z[#1200]"
Code "G0  Z#1200 X[#1301 + .2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend   
End Sub

Sub EIGHT

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

message "Eight"
Code "g90 G0  Z#1200 X[#1301 + .2250] Y#1302 "

code "G91G0X0.Y.1061"
code "G90 G1Z#1300 F20."
code "G91 X.0176"
code "G2X.0373Y-.016I-.0004J-.0525"
code "X.0157Y-.0374I-.0378J-.0378"
code "X-.0157Y-.0372I-.0528J.0004"
code "X-.0373Y-.0157I-.0376J.0371"
code "G1X-.0352"
code "G3X-.0373Y-.0164I.0005J-.0519"
code "X-.0157Y-.0383I.0398J-.0386"
code "X.0159Y-.0361I.05J.0004"
code "X.0375Y-.0151I.0377J.0395"
code "G1X.0348"
code "G3X.0373Y.0151I-.0001J.0539"
code "X.0157Y.0361I-.0346J.0365"
code "X-.016Y.0383I-.0551J-.0004"
code "X-.037Y.0164I-.0378J-.0356"
code "G1X-.0352"
code "G2X-.0373Y.0157I.0003J.0528"
code "X-.0157Y.0372I.0371J.0376"
code "X.0157Y.0374I.0535J-.0004"
code "X.0373Y.016I.0377J-.0365"
code "G1X.0176"
code "G90 G0Z[#1200]"
Code "G0 Z#1200 X[#1301 + .2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend   
End Sub

Sub NINE
Setvar(1301, getdro(0))
Setvar(1302, getdro(1))


message "Nine"
Code "G90 G0  Z#1200 X[#1301 +.2250] Y#1302 "

code "G91G0X-.0555Y-.091"
code "G90 G1Z#1300 F20."
code "G91 G3X.0379Y-.0155I.0376J.038"
code "G1X.0352"
code "G3X.0375Y.0157I-.0004J.0535"
code "X.0159Y.0377I-.0371J.0379"
code "G1Y.1062"
code "G3X-.0159Y.0375I-.0532J-.0005"
code "X-.0375Y.0159I-.038J-.0372"
code "G1X-.0352"
code "G3X-.0377Y-.0159I.0002J-.053"
code "X-.0157Y-.0375I.0378J-.0379"
code "G1Y-.0352"
code "G3X.0157Y-.0377I.0533J.0001"
code "X.0377Y-.0157I.0378J.0376"
code "G1X.0352"
code "G3X.0375Y.0157I-.0004J.0535"
code "X.0159Y.0377I-.0371J.0379"
code "G90 G0Z#1200"
Code "G0  Z#1200 X[#1301 +.2250] Y#1302 "

Setvar(1301, getdro(0))
Setvar(1302, getdro(1))

While IsMoving()
Wend
End Sub

SETIJMODE(0)
CODE"G90"
CODE"M30"               



2
General Mach Discussion / sudden onset of Stepper stalling
« on: March 08, 2017, 08:39:56 PM »
I've got a Hoss mini mill clone that has been working great and almost daily for 18 months. Now it is suddenly stalling the Z-axis on a regular basis either while executing a program or just jogging. No pattern for when it happens. I verified that it is not a physical resistance issue on the machine. Never had problems in the past with stalling either, but it's not going away on it's own.

Is it possible I have either a dying breakout board or driver??? Or, is it possibly a windows stability issue? I've attached my XML file as I know you guys love looking at them!

I use the following:
KL-4030 driver
CNC4PC C-35 breakout board (parallel port)
Window 7 computer (only runs mach3, does not even connect to internet)
NEMA23 382oz/in 3.0A Stepper Motor

I had already considered moving to a motion controller as I'd read they offered more stability. Either the
UC400ETH Ethernet CNC Motion Controller
or the
UC100 USB to Parallel CNC Motion Controller

Any ideas on what I should do here?
thanks in advance.



3
I've been using Mach3 Turn for many months on a converted bench lathe and everything has worked as I expected so far. Most of my problems have been easily solved by reading the forum posts.

I recently added a C6 speed control board from cnc4pc so I could use spindle control (I use the C10 breakout board, and C3 index pulse card). I thought I configured it pretty well and get close to the requested spindle speed, both in the Mach3 DRO and against a laser tach.

BUT, I'm experiencing some really odd behavior with regards to G95 and can't figure out what's going on. On an intermittent basis Mach3 will reduce the feedrate, while executing a program, to some unusually low number like 0.0002"/rev. It will often be on like the first couple of roughing passes, but then Mach begins to execute the feedrate specified in the program on later passes. It usually fixes itself as the program goes on. Sometimes it doesn't, and I have to restart the Mach software.

If I stop the program and enter a feedrate in the MDI, it executes fine. It only occurs while executing a program. At no time do I see a drop in RPM in the Mach 'True spindle speed' DRO

What could possibly be causing Mach to ignore a feedrate as specified in a program, but do so on an intermittent basis, and then execute the feedrate later in the same program?

In general I use the following syntax for example:
G97 S800 M3
G95 F0.004
G01 Z X whatever...

Under 'ports & pins' -> 'spindle setup' both 'spindle speed averaging' and 'use spindle feedback in sync mode' are checked.

What am I missing here?

Thanks for any help!

Pages: 1