Hello Guest it is March 28, 2024, 06:15:56 PM

Author Topic: Mach3 VB Script Help  (Read 24398 times)

0 Members and 1 Guest are viewing this topic.

Offline RICH

*
  • *
  •  7,427 7,427
    • View Profile
Re: Mach3 VB Script Help
« Reply #10 on: February 09, 2016, 05:57:47 PM »
BR549,

Quote
AND just for the record you do not gain any accuracy by slowing down or double tapping (;-)

But,
You will minimize the overtravel into the piece and the  force you are putting on the probe.
If it's slow on the approach you also have  a  little time to stop the probing should it go wrong for some reason,
hasn't happened to me yet, but one of these days ....you never know........
I also fooled with my expensive probe, piece of poop it is, and depending on the approach speed it triggers differently.
Not a Mach thing but rather a probe problem.

Don't want to confuse, so back to sidelines to continue learning....... ;)

RICH

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 VB Script Help
« Reply #11 on: February 09, 2016, 06:21:51 PM »
HIYA Rich we did testing on probes and speed years ago with art.  IF you have a 3 point pivoted probe , and most low end probes are' the ONLY difference we saw was in the radial direction that you probed in in relation to the probe. THAT is a physical thing with teh motion of teh wabble plate on teh three pivot points. ALL 3 point wobble plates have teh same problem.

What is being refered to here is the need for a second pass or double tap. But if that is what he wants not a problem (;-).  I have seen a LOT of different approaches to this over the years always room to add one more (;-)

Actually it is NICE to see someone actually working on their OWN routines these days.  COOL (;-)

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 VB Script Help
« Reply #12 on: February 09, 2016, 07:50:22 PM »
Actually  this does bring up a good point IS there ONE spot a USER can go to to get ALL teh manuals that have been generated for Mach3 over teh years. OR are they still scattered about ???

Preferrably we need 2 sites in case we loose this one one day when Mach3 does go away permanently .

Just a thought, (;-) TP

Offline RICH

*
  • *
  •  7,427 7,427
    • View Profile
Re: Mach3 VB Script Help
« Reply #13 on: February 09, 2016, 08:01:17 PM »
"All" the manuals....not really, maybe the ones ArtSoft generated.
I would include the ones in Member's Doc's.

Would be nice if someone summarized all the threads and made a book.
If you search a subject you can sure spend a lot of time reading.
Just search probing if one wants some nighttime reading.

BTW, Yes it's nice to follow a users  work as you never what they will come up with.
Different minds look at things differently for sure.

Keep up the good work guy's,

RICH
Re: Mach3 VB Script Help
« Reply #14 on: February 09, 2016, 11:27:05 PM »
BR549
Quote
You cannot mix CB variable code inside of Gcode calls. You will have to seperate them .

Also you have problem with your return to zero math and mixing inc moves with abs values.

Okay, Well what is I do? I would need to individually input the Min/Max's as well the XZero/YZero's. So I would have to change XMax to something to go in the Gcode line. A Char?

And for my Zero math would this work better? XZero = (((Xmax*.5)/(XMin*.5))*2)
Re: Mach3 VB Script Help
« Reply #15 on: February 10, 2016, 12:23:05 AM »
Fixed all the syntax errors that popped up and I got this. Still says error but wont show a line. And I looked everywhere and cant find how to put a Var in a Code line. So I really need help with that.

Code: [Select]
Message "Finding Circle Center"
CurrentFeed = GetOemDRO(818)
 If GetOemLed (825) <> 0 Then     
      Message "Z-Plate is grounded, check connection and try again"
   Else
Code "G91 G31 X-7 F8"   
While IsMoving()
Wend                                         
Xmin = GetVar(2000)                                 
Code "G1 X.98*XMin F8"                 
Code "G91 G31 X7 F8"
While IsMoving()
Wend
XMax = GetVar(2000)   
XZero = (((Xmax*.5)/(XMin*.5))*2)
Code "G1 XXZero F30"       'as well is calling a variable in a code line acceptable? Need help with these lines
Code "G91 G31 Y-3 F8"
While IsMoving()
Wend
YMin = GetVar(2001)
Code "G1 Y.98*XMin F8"
Code "G91 G31 Y3 F8"
While IsMoving()
Wend
YMax = GetVar(2001)   
YZero = (((Ymax*.5)/(YMin*.5))*2)
Code "G1 YYZero F30"     
Code "G91 G31 X-7 F30"
While IsMoving()
If X<.95*XMin then SetFeedRate(F2) 
Wend
XMin = GetVar(2000)
Code "G1 X.98*XMin F8"   
Code "G91 G31 X7 F30"
While IsMoving()
If X>.95*XMax Then SetFeedRate(F2)
Wend
XMax = GetVar(2000)     
XZero = (((Xmax*.5)/(XMin*.5))*2)
Code "G1 XXZero F30"     
ode "G91 G31 Y-3 F30"
While IsMoving()
If Y<.95*YMin Then SetFeedRate(F2)      '<--- Do I need the () of While IsMoving to be around my If Then? Or is just before the Wend okay?
Wend
YMin = GetVar(2001)
Code "G1 X.98*YMin F8"
Code "G91 G31 Y3 F30"
While IsMoving()
If X>.95*YMax Then SetFeedRate(F2)
Wend
YMax = GetVar(2001)     
YZero = (((Ymax*.5)/(YMin*.5))*2)
Code "G1 YYZero F30" 
SetDro(XaxisDRO,0)
SetDro(YaxisDRO,0)
Code "G0 G53 Z-4" 
Message "Circle Center Found"
« Last Edit: February 10, 2016, 12:37:38 AM by nissan20det »
Re: Mach3 VB Script Help
« Reply #16 on: February 10, 2016, 12:58:31 AM »
I saw these in the mach program manual would either work?

Example:
‘ Example M6End macro
‘ Define some constants
Xaxis = 0
Yaxis = 1
Zaxis = 2
‘ Move all axes back to where they were before the toolchange
Xpos = GetToolChangeStart(Xaxis)
Ypos = GetToolChangeStart(Yaxis)
Zpos = GetToolChangeStart(Zaxis)
Code “G00 X” & Xpos & “ Y” & Ypos & “ Z” & Zpos
‘ Wait for move to complete
While IsMoving()
 Sleep 100
Wend

So If I did
Code "G1 X" & XZero "F30"   ??

or this?

‘ Set a variable 1234 to our target position of 2.3456
SetVar(1234, 2.3456)
‘ Now move X to our target position
Code “G0 X #1234”
‘ Or, another way…
Code “G0 X “ & GetVar(1234)

So maybe I can do
Code "G1 X" &etVar(XMin) "F30"

??
« Last Edit: February 10, 2016, 01:04:13 AM by nissan20det »

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Mach3 VB Script Help
« Reply #17 on: February 10, 2016, 04:45:54 AM »
So If I did
Code "G1 X" & XZero "F30"

That is the most usual way.

watch your concatenation operators though, the line as written will fail.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 VB Script Help
« Reply #18 on: February 10, 2016, 11:17:11 AM »
You are almost there (;-)   You can build a mixed string but you have to concatenate each piece together. These are just different examples

Code"G1 X" & Xzero & "F30"         

Or

Code"G1 X" & GetVar(2000)  & "F30"


Also remember when you go to do the math to find center it will depend on what quadrant you are in as to how it needs to be. The math for each quadrant may be different. SO you also need to be able to identify teh quadrant you are actually in (;-)

I also do not call the CB variables as Xmin , Xmax   because depending on teh quad that might not be the case and it could be confusing. I use X1 X2 , Y1 Y2. 

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Mach3 VB Script Help
« Reply #19 on: February 10, 2016, 12:19:03 PM »
@Terry - one post then I'll back out  ;)

@nissan20det - Can I make a suggestion: It's a classic beginner's mistake to try to code the whole thing straight off.

I'd suggest you do little test snippets at a time and test as you go.

test your

Code: [Select]
Code "G91 G31 X-7 F8"
While IsMoving()
Wend
Code"G1 X" & GetVar(2000)  & "F30"

I think you'll find it doesn't do what you think it does. (don't use your real probe to test this ;))