Hello Guest it is April 03, 2020, 02:25:02 AM

### Author Topic: DRO problem???  (Read 7400 times)

0 Members and 1 Guest are viewing this topic.

#### mn_mike

• 17
##### Re: DRO problem???
« Reply #10 on: October 08, 2012, 12:32:25 PM »
So, the value box is close, but still not accepting the "000" (multiple).

Here is the code

Code: [Select]
`' Macro for consecutive S/N engraving from MACHMainEndSub mainDim A As StringDim Ch As StringDim Cnt As IntegerDim Value As StringSetVar(1303 , .250)  'LetterSpacingSetvar(1300 , -0.005) ' Z Depth cuttingSetvar(1200 , 0.050) ' Safe Z 'CPx= Getoemdro(0)'CPy= Getoemdro(1)SETIJMODE(1)Setvar(1301, getdro(0))Setvar(1302, getdro(1))Value = Question( "What is the value ??" )   Message(Value) A = ValueFor 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 SelectNext`
I defined "value" as a string, but it's still not accepting multiple "zeros"

Any thoughts?

Mike in MN

#### BR549

• 6,925
##### Re: DRO problem???
« Reply #11 on: October 08, 2012, 12:34:16 PM »
IF you could post the Macro code it would be much easier to help.

(;-) TP

#### mn_mike

• 17
##### Re: DRO problem???
« Reply #12 on: October 08, 2012, 12:44:02 PM »
Attached is the M1502

Basically everything after what I added in the other post is just g-code.

It works flawlessly if there is no leading Zeros (all real numbers).

Thank you,

Mike in MN

Here is the code in the attached file (The g-code is incomplete as of right now with regards to the "Zs" I will absolute code them.)

Code: [Select]
`' Macro for consecutive S/N engraving from MACHMainEndSub mainDim A As StringDim Ch As StringDim Cnt As IntegerDim Value As StringSetVar(1303 , .250)  'LetterSpacingSetvar(1300 , -0.005) ' Z Depth cuttingSetvar(1200 , 0.050) ' Safe Z 'CPx= Getoemdro(0)'CPy= Getoemdro(1)SETIJMODE(1)Setvar(1301, getdro(0))Setvar(1302, getdro(1))Value = Question( "What is the value ??" )   Message(Value) A = ValueFor 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 SelectNextSetvar(1301, getdro(0))Setvar(1302, getdro(1))SETIJMODE(1)Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend   End SubSub ZERO message "Zero"Setvar(1301, getdro(0))Setvar(1302, getdro(1))Code "G91X.025"Code "G91X.0419 Y.013"Code "Z-.2"Code "G1 Z-.06 F10."Code "G91G3 Y.0539 I-.0741 J.027"Code "G91X-.0374 I-.0187 J-.0066"Code "G91Y-.0539 I.0741 J-.0269"Code "G91X.0374 I.0187 J.0067"Code "G0 Z.26"Code "G91X.0045 Y-.013"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend End Sub Sub ONESetvar(1301, getdro(0))Setvar(1302, getdro(1))message "One"Code "G91X.025"Code "G91Y.0685"Code "Z-.03"Code "G1 Z-.23"Code "G91X.0114 Y.0115"Code "G91Y-.08"Code "G0 Z.26"Code "G91X-.0114"Code "Z-.03"Code "G1 Z-.23"Code "G91X.0229"Code "G0 Z.26"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend End SubSub TWO Setvar(1301, getdro(0))Setvar(1302, getdro(1))message "Two"Code "G91X.025"Code "G91X.0017 Y.0685"Code "Z-.03"Code "G1 Z-.23"Code "G91G2 X.0444 Y-.0104 I.0205 J-.0123"Code "G91X-.0059 Y-.0143 I-.0228 J.0011"Code "G91X-.0206 Y-.0153 I-.1236 J.1441"Code "G91G3 X-.0196 Y-.0285 I.0186 J-.0339"Code "G91G1 X.0478"Code "G0 Z.26"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend   End SubSub THREESetvar(1301, getdro(0))Setvar(1302, getdro(1))message "Three"Code "G91X.025"Code "G91X.0011 Y.0685"Code "Z-.03"Code "G1 Z-.23"Code "G91G2 X.0395 Y.0052 I.0221 J-.0151"Code "G91X-.0164 Y-.0337 I-.0135 J-.0142"Code "G91G0 Z.26"Code "G91X.0057"Code "Z-.03"Code "G1 Z-.23"Code "G91G2 X.0119 Y-.0338 I-.0017 J-.0196"Code "G91X-.0418 Y.0052 I-.0185 J.0222"Code "G0 Z.26"Code "G91X.048 Y-.0114"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend  End SubSub FOURSetvar(1301, getdro(0))Setvar(1302, getdro(1))message "Four"Code "G91X.025"Code "G91X.0414"Code "Z-.03"Code "G1 Z-.23"Code "G91Y.08"Code "G91X-.0414 Y-.0612"Code "G91X.0531"Code "G0 Z.26"Code "G91Y-.0188"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend   End SubSub FIVE Setvar(1301, getdro(0))Setvar(1302, getdro(1))message "Five"Code "G91X.025"Code "G91X.0484 Y.0801"Code "Z-.03"Code "G1 Z-.23"Code "G91X-.0484"Code "G91Y-.0355"Code "G91G2 X.0458 Y-.0045 I.0205 J-.0268"Code "G91X-.0245 Y-.0401 I-.0214 J-.0145"Code "G91X-.0213 Y.0114 I0. J.0254"Code "G0 Z.26"Code "G91X.0501 Y-.0114"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend   End SubSub SIX Setvar(1301, getdro(0))Setvar(1302, getdro(1))message "Six"Code "G91X.025"Code "G91X.048 Y.068"Code "Z-.03"Code "G1 Z-.23"Code "G91G3 X-.0434 Y-.0043 I-.0208 J-.0116"Code "G91X-.0016 Y-.0457 I.0667 J-.0252"Code "G91X.0457 Y-.0016 I.0231 J.0057"Code "G91X-.0457 Y.0016 I-.0226 J.0073"Code "G0 Z.26"Code "G91X.0468 Y-.018"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend   End Sub Sub SEVENSetvar(1301, getdro(0))Setvar(1302, getdro(1))message "Seven"Code "G91X.025"Code "G91Y.08"Code "Z-.03"Code "G1 Z-.23"Code "G91X.048"Code "G91G3 X-.024 Y-.08 I.1214 J-.0801"Code "G0 Z.26"Code "G91X.024"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend   End SubSub EIGHT Setvar(1301, getdro(0))Setvar(1302, getdro(1))message "Eight"Code "g90 G0  Z#1200 X[#1301 + .2250] Y#1302 "Code "G91X.025"Code "G91X.0214 Y.0428"Code "Z-.03"Code "G1 Z-.23"Code "G91G2 Y.0372 I0. J.0186"Code "G91X.0237 Y-.0186 I.004 J-.0193"Code "G91X-.0237 Y-.0186 I-.0195 J.0005"Code "G91G3 Y-.0428 I0. J-.0214"Code "G91X.0266 Y.0214 I.0042 J.0219"Code "G91X-.0214 Y.0214 I-.0214 J0."Code "G0 Z.26"Code "G91X.0214 Y-.0428"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend   End SubSub NINE Setvar(1301, getdro(0))Setvar(1302, getdro(1))message "Nine"Code "G91X.025"Code "G91X.0018 Y.0122"Code "Z-.03"Code "G1 Z-.23"Code "G91G3 X.0434 Y.0043 I.0208 J.0116"Code "G91X.0016 Y.0457 I-.0667 J.0252"Code "G91X-.0457 Y.0016 I-.0231 J-.0057"Code "G91X.0457 Y-.0016 I.0226 J-.0073"Code "G0 Z.26"Code "G91X.003 Y-.0622"Setvar(1301, getdro(0))Setvar(1302, getdro(1))While IsMoving()Wend End Sub SETIJMODE(0)CODE"G90"CODE"M30"                `

#### BR549

• 6,925
##### Re: DRO problem???
« Reply #13 on: October 08, 2012, 12:48:27 PM »

(;-) TP

#### mn_mike

• 17
##### Re: DRO problem???
« Reply #14 on: October 08, 2012, 12:53:28 PM »
Ok, I feel kind of bad going through all of this before looking over the documents...

I changed the "Question" to "AskTextQuestion" per the Macro-Prog-Ref pdf. It works like I want it to now.

I will try using this format and refine the code and see how things work from there.

I do appreciate you giving me the direction.

Thank you,

Mike in MN

#### BR549

• 6,925
##### Re: DRO problem???
« Reply #15 on: October 08, 2012, 12:56:06 PM »
I was just about to suggest the same change(;-) BUT you beat me to it. The aggravating thing about AskTextQuestion is the operator HAS to manual click on the LINE to be able to input the value. MAJOR pain.

Let us know how it works out, (;-) TP

#### BR549

• 6,925
##### Re: DRO problem???
« Reply #16 on: October 08, 2012, 01:08:42 PM »
Just another thought, You CAN create your own text box in VB and have it operator friendly AND make it a s large or small as you need. The asktextquestion box was what Art created to make it easier on us.

(;-) TP

#### mn_mike

• 17
##### Re: DRO problem???
« Reply #17 on: October 08, 2012, 01:17:31 PM »
Just another thought, You CAN create your own text box in VB and have it operator friendly AND make it a s large or small as you need. The asktextquestion box was what Art created to make it easier on us.

(;-) TP

I would be interested if  you have a little direction for the texbox. Can that be incorporated in the "Screen"?

Mike in MN

#### BR549

• 6,925
##### Re: DRO problem???
« Reply #18 on: October 08, 2012, 01:25:10 PM »
Begin Dialog DialogName1 60, 60, 160, 70, "Input Serial Number"
TEXT 10, 10, 28, 12, "SN:"
TEXTBOX 42, 10, 108, 12, .SNStr
OKBUTTON 42, 54, 40, 12
End Dialog
Dim Dlg1 As DialogName1
Dialog Dlg1

MsgBox Dlg1.SNStr
End

It cannot be directly BUT you can add a button to call up the textbox from the screen.  You would save the value to a DRO or variable or possible a user message line.

(;-) TP

#### BR549

• 6,925
##### Re: DRO problem???
« Reply #19 on: October 08, 2012, 01:31:00 PM »
Probably best to Save it to a Gcode Var (SetVar(500, Value) )that way it is directly available from inside the macro. IF you want it to be incremental  you would save it to a VAR in the range or 500-600 that way it is saved when you close down MAch3 and is available when you start back up to continue the SN string where you left off.

At the same time I would write the value to teh MACH3 staus bar so the OP can SEE what he actually typed in to verify it is correct BEFORE he makes a bad serial number.

(;-) TP
« Last Edit: October 08, 2012, 01:32:46 PM by BR549 »