Hello Guest it is March 28, 2024, 07:34:35 PM

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

0 Members and 1 Guest are viewing this topic.

Re: Mach3 VB Script Help
« Reply #40 on: February 11, 2016, 07:39:40 PM »
Okay This is reading all in MM What command do I say at the top to state this is Inchs?

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 VB Script Help
« Reply #41 on: February 11, 2016, 07:51:50 PM »
OK I gotta ask (;-) WHAT is the X1*.90 move about ?

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 VB Script Help
« Reply #42 on: February 11, 2016, 07:59:24 PM »
Is your Machine setup in Inches or MM ??  Look on the main RUN screen top right that is the modal line Do you see a G20 or a G21 listed ??

(;-) TP

Re: Mach3 VB Script Help
« Reply #43 on: February 11, 2016, 09:05:07 PM »
G20   And the X1*.90 is to move X to 90% of X1's value. That seems to be better termanolagy than X-.05 if X is at 3inchs thats a 3.05" move not .05".

Okay heres the code I have and heres a video of what its doing I so lost.

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"
Code "G31 X-7 F13"    
While IsMoving()
Wend                                          
X1 = GetVar(2000)
Sleep(200)             ' I put these here to stop machine gitters, and wow I know now what you mean by this code runs slow!
X3 = X1*1
Sleep(30)                                    
Code "G0 X" & X3
While IsMoving()
Wend
Code "G31 X7 F13"
While IsMoving()
Sleep(100)
Wend
X2 = GetVar(2000)
Sleep(200)  
XC = X1 + X2
Sleep(90)
Xc = XC*.5
Code "G0 X" & -Xc      
While IsMoving()
Sleep(100)
Wend              
Code "G31 Y-3 F13"
While IsMoving()
Wend
Sleep(90)
Y1 = GetVar(2001)
Sleep(200)
Y3 = Y1*.1
Sleep(30)
Code "G0 Y" & Y3
While IsMoving()
Wend
Code "G31 Y3 F13"
While IsMoving()
Sleep(100)
Wend
Sleep(90)
Y2 = GetVar(2001)
Sleep(200)  
YC = Y2 + Y1
Sleep(90)
Yc = YC*.5
Code "G0 Y" & -Yc    
End If




Ill post the video in 10 min closing up shop

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 VB Script Help
« Reply #44 on: February 11, 2016, 09:44:00 PM »
OK Remember when I mentioned that teh #2000 is an ABS position value ???   I was not kidding(;-)  The value you are getting could be a very high value NUMBER wise.  Without warping your brain with the math it is easier to make teh backoff move in INC  .050 will always be .050.   X1*.90 could end up being anything depending on WHERE you were on the table.

I am thinking you do not fully understand Abs and Inc terms in Gcode ?

IF you are in G20 mode then you ARE in inch mode.

Not quite sure what you mean by Machine jitters BUT if Sleep() cures it you have other problems.

Also rememeber what Stirling said START with simply moves , perfect them then add another section of code , test tune and repeat. You are trying to do it all at one time without fuilly understanding what it is doing. Kaos at best.

(;-) TP
« Last Edit: February 11, 2016, 09:46:29 PM by BR549 »
Re: Mach3 VB Script Help
« Reply #45 on: February 11, 2016, 11:15:11 PM »
BR 549 that's exactly what I was doing.. Like 4 lines at a time then add 4 more...

So I must not understand what ABS and INC are or teh lol.   If I increase the .98 on X3=X1*.98 to 1,2,3,4 or 5 the back off amount increases, If I lower .98 to .1 it decreases the back off. For Y its opposite ??

AS well
XC = X1+X2
Xc= XC*.5 ' I also tired Xc = XC/2 these do the same and work but i can tell its slightly off center

 these dont work
 Xc = X1+X2/2
Xc = (X1+X2)/2

You can see the jitter part I was talking about when it backs off Y's first touch. This has only ever happened with moving in Script. Never during a program or jog

https://www.youtube.com/watch?v=OyMWOmd8VPI
« Last Edit: February 11, 2016, 11:34:26 PM by nissan20det »
Re: Mach3 VB Script Help
« Reply #46 on: February 11, 2016, 11:38:32 PM »
And I thought GetVar(2000) will set the variable to the Machine coordinates DRO value at the point the probe was triggered... I must be way off ???

Oh as well the line I was getiign a backward movement

Code"G0 X" & Xc
   Then I changed it to this and it fixed it but I know I shouldn't have to
Code"G0 X" & -Xc
« Last Edit: February 11, 2016, 11:48:31 PM by nissan20det »
Re: Mach3 VB Script Help
« Reply #47 on: February 12, 2016, 02:50:50 AM »
 
well I think I got this abs inc figured out, all I had to do was think about it and wow this helps alot hahaha

Abs to me is absolute placement X7 moves to 7" not 7" long

Inc Is X7 will move X 7" is that right?

If so I thought G0 was abs so if you want to back off .050" and your at .350" you need to say G0 .300
In this case my X3=X1*.98 would always work  .100*.98 = .98 I would have backed off .020 in this case and 98% in all others. I do agree thats not enough I like .9 better.

You guys said G90 is abs G91 is inc so stick with one. So I should be changing my G0's to G1's and then just do .050. that now makes since to me altho why did the G0 X1*.98not work?? is it because im taking 98% of an inc move? So if I changed the first line to G90 would that equation then work?


Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Mach3 VB Script Help
« Reply #48 on: February 12, 2016, 03:37:09 AM »
Quote
You guys said G90 is abs G91 is inc so stick with one. So I should be changing my G0's to G1's and then just do .050. that now makes since to me altho why did the G0 X1*.98not work?? is it because im taking 98% of an inc move? So if I changed the first line to G90 would that equation then work?

I think you may be getting confused between G90, G91 and G0, G1 ??

I think you may also be getting confused regarding Mach3 handling equations within the Gcode line (if you are not then I certainly am).

Tweakie.
PEACE

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 VB Script Help
« Reply #49 on: February 12, 2016, 09:41:46 AM »
WHy does your X1*90 move not work ???  Easy you are trying to do an inc move with an abs position value NOT an inc value.

Take this example. Lets move to teh far side of the table so the example will be dramatic. Teh hole you are probing is 1" diam

Your first leg of the probe doing a center of circle trips at X95. So that makes your X 1 = 95.0000   OK   X3 = (95.0000 * .90) = 85.5

Your routine is STILL in INC mode so when you go to Code"G0 X "& X3 it will MOVE right 85.5 "  AND you just broke your probe.

HAD you actually been testing as you created each line you would have seen this right off teh bat (;-)  .

Also I did not finish the Formula to find center of a circle for a reason. It was to make you think about what you were creating.

There are 2 basic ways to work teh formula.  From an  INC approach OR  ABS approach. THAT would be your choice . But each takes a different way of doing it.


You are missing a LARGE block of basic knowledge for using Gcode. Trying to create a high end macro WITHOUT that knowledge is like trying to do Algebra without understanding the basic rules of Algebra. It will not make any sense.

(;-) TP