Hello Guest it is April 29, 2024, 03:42:12 AM

Author Topic: Linking DRO to program, program uses whatever is put in the DRO..  (Read 3011 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarak

*
  •  229 229
    • View Profile
I've got this topic in another of my posts, but thought it may get a few more looks in it's own topic.
I've searched the forums and looked in Mach3 but I can't seem to work out how to get a DRO and a button that runs a program to interact.
I think I'm close, I want to have a DRO that you can put a measurement into and when you press a button it will use this measurement in the program, this is what I have.
Create a DRO, I assigned it to DIAMETER OF CURRENT TOOL (which I think is OEM code 105), should I select DIAMETER OF CURRENT TOOL from the drop down or should I enter the OEM code 105?

Create a button and assign VB code to it as follows:

Material = GetOEMDRO (105)
CODE "#1=Material"     ;In theory if 20 is entered into the DRO, Material should =20
CODE "G90 G55 G21 
CODE "G00 Y[#1*2]    ;Rapid to Y40
CODE "G01 Y#1 F100  ;Linear travel to Y20
CODE "G00 Y[#1*2]    ;Rapid back to Y40
CODE "M30"

What am I doing wrong?

Offline Scott

*
  •  139 139
    • View Profile
Re: Linking DRO to program, program uses whatever is put in the DRO..
« Reply #1 on: February 22, 2007, 12:50:13 PM »
Either 'DIAMETER OF CURRENT TOOL' or 105 should work, but I'd use 105 because I've come across a couple of the drop downs that didn't seem to work (I can't remember which ones) and the numbers have always worked.

Try this...

ToolDia=GetOEMDRO (105)

CODE "G90 G55 G21"
CODE "G00 Y" &ToolDia*2
CODE "G01 Y" &ToolDia & " F" &100
CODE "G00 Y" &ToolDia*2
CODE "M30"

Pay attention to the "" marks and the &'s.  If you want to use #1 instead of ToolDia, then just declare it that way instead.
Scott