Hello Guest it is March 05, 2021, 09:51:05 PM

Author Topic: Offsets for spherical tools  (Read 9252 times)

0 Members and 1 Guest are viewing this topic.

Re: Offsets for spherical tools
« Reply #10 on: January 23, 2009, 08:03:57 PM »
Hmm. Last time I used VB it was pretty gruelling. I'll try these and see what i can do. Cheers...

I thought of another way I could cut a parabola, sending the cutter round in an extremely long helix. I'll have a play with that too.
Re: Offsets for spherical tools
« Reply #11 on: January 24, 2009, 08:58:00 PM »
I'm having no joy here. I can't get the macro to operate.

The macro is named M9991 and is stored in \macros.

the code I was using as a test should show red G0 moves +500 X, then +500Y, then +500 Z. The Z move defined by a parameter that the macro should create by calling it from the Y DRO.

Gcode here:

#10=0
#11=0
#12=0
G0 X500
G0 Y500
M9991
G0 Z#11
m30
%

Macro here:

CODE"#10="&GetOEMDRO(800)
CODE"#11="&GetOEMDRO(801)
CODE"#12="&GetOEMDRO(802)

I'll be honest, I have no idea what I'm doing. If i could see something work, I'd be a great deal happier. As it is it's like repairing a radio with a knife and fork. What i want to do is this:

 - get an axis DRO value
 - assign it to a conventional # parameter and use it in a regular parametric subroutine.

Sorry to bugger round in little circles over what should be a very simple affair but I've never written a macro before and I'm definitely missing a point somewhere... I've tried the suggested methods, with permutations and alterations galore, and I get errors, or it just doesn't work.

Is it not working on the simulations because the DRO doesn't actually move?

Is Mach looking for the macros somewhere else? A subfolder?

My head hurts and i'm going to bed.

 ???
« Last Edit: January 24, 2009, 09:01:33 PM by BluePinnacle »

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Offsets for spherical tools
« Reply #12 on: January 24, 2009, 09:17:38 PM »
Dont have a clue about any of that stuff but your macro needs to be placed in your profiles macro folder, eg if your using the standard mill profile it would be C:\Mach3\Macros\Mach3Mill
 To see if Mach is looking at your macro put the following as the first line of your macro.

MsgBox("I am Running")



Hood

Offline ger21

*
  • *
  •  6,289 6,289
    • View Profile
    • The CNC Woodworker
Re: Offsets for spherical tools
« Reply #13 on: January 24, 2009, 09:42:53 PM »
Try something like this:

x = getoemdro(800)
string1 = "#10=" & x
code string1
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

vmax549

*
Re: Offsets for spherical tools
« Reply #14 on: January 24, 2009, 10:09:49 PM »
CODE"#10="&GetOEMDRO(800)
CODE"#11="&GetOEMDRO(801)
CODE"#12="&GetOEMDRO(802)


Try

SetVar(10,GetOemDro(800))
SetVar(11,GetOemDro(801))
SetVar(12,GetOemDro(802))

(;-) TP

vmax549

*
Re: Offsets for spherical tools
« Reply #15 on: January 24, 2009, 11:39:36 PM »
Question? Did you set up a NEW set of DROs or are you trying to read dros that are already in use in MACH?

(;-) TP

Offline jimpinder

*
  •  1,232 1,232
  • Wakefield, West Yorks, UK
    • View Profile
Re: Offsets for spherical tools
« Reply #16 on: January 25, 2009, 03:15:48 AM »
If you want to run a macro alongside GCode, then the macro must be written and then put in the correct folder so that Mach3 knows where to look for it. If you are using a Mill screen, then the folder is Mach3/macros/Mach3mill.

VB is a good program, in that you can check all your code before posting it, by stepping through the program. If the program won't step there is a fault, and it should be highlighted, or the cursor stops at the right place.When you first load the GCode, Mach 3 reads the program, complete with macros and displays it on the toolpath, so it gives you an idea whether you are right or not.

Be careful, because if the machine is attached and on, the machine will move in response to " Code" instructions. I write all my VB on a different computer, where I have Mach 3 installed, but not connected to any machine. In this way I can run the complete GCode, with Macros.

If you look at the video tutorial on scripting and copy say the part where you download the tool change position from the user DRO's for a test, this will get you going. Rather than writing complex codec, keep it simple, using easily recognisable variables. Then do the maths, and then write out the code to the machine. This is one of my macros for  rounding off a bar.

Rem Round End swinging arm

Code "G0 Z-17"

For depth = 0 To 10 Step 0.25

xpos = 26.34 - depth
Code "G0 X"&xpos
Code "G1 F25 Y15"
Code "G0 X"&(xpos+1)
Code "G0 Y-1"

Next depth 


For getting parameters from DRO, write them into variables first named something like oldxpos, oldypos, oldzpos usiing simple instructions like

oldxpos = GetOemDro(**)
OR
newxpos = GetUserDRO(***)

do whatever you want with it, then either post it back to Mach3 e.g. SetVar(10,newxpos) or write the code for the machine to run using Code"G1 X"&newxpos &"Y"&newypos  etc.

the machine runs as though you are writing the code on the MDI line, the only drawback being that you cant see it, the program just shows the macro number, not the macro itself.
I write some comments in the VB for the macro to post to the machine and it appears on the comments line, to let me know whereabouts the macro is, since some of them take an hour to run, where they are thinning down bar stock, then putting the profile on.

Stick at it.

If you email me and tell me what it is you want to do exactly, I will write some code for you, but I am a bit busy for the next three weeks, although I have some free evening time this first week.










Not me driving the engine - I'm better looking.
Re: Offsets for spherical tools
« Reply #17 on: January 25, 2009, 06:55:48 AM »
Thanks guys, very much appreciated. I'm going to have to learn about VB, it's just that the learning curve at this point is quite steep and a bit greasy.

I'll try some of the suggestions tonight - there seems to be a number of ways to do the same thing. The DRO I'm trying to read is the one on the "program run" screen, the regular X,Y and Z DROs that Mach will be using for the program as it runs, I think the OEM codes are 800, 801 and 802.

Jim - sound advice. I'm only doing proof-of-concept stuff for now, on a laptop with no mill attached. I'm keeping this muck well away from my real rig until I can say with confidence that I know what will happen ;)

Thanks again, I'll try to get this set up this evening and see how we go.

vmax549

*
Re: Offsets for spherical tools
« Reply #18 on: January 25, 2009, 05:26:05 PM »
IF you are trying to read the main screen axis dro you are using the wrong approach(;-)

They are Dro's 0-4 AND they  require

GetDRO(0)  for x
GetDro(1) for Y
GetDro(2) for Z

There are DROS, OEMDROs and USERDROs   (;-)

If you have your math worked out and know how it is to be applied  we probably can help you out with te macro side. AND YES there are several ways of doing things that end up with the same results.

Let US KNow if we can help out,(;-) TP
   

Offline jimpinder

*
  •  1,232 1,232
  • Wakefield, West Yorks, UK
    • View Profile
Re: Offsets for spherical tools
« Reply #19 on: January 26, 2009, 04:43:27 AM »
I'll concur with that.

If you search for visual basic on the forum, there is a complete list of Mach3 specific functions in VB somewhere, if you haven't already got it.
Not me driving the engine - I'm better looking.