Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Fastest1 on March 30, 2010, 12:18:13 AM

Title: Tell me about this macro please!
Post by: Fastest1 on March 30, 2010, 12:18:13 AM
I have a lathe with a 6 tool rotary changer. I was given a macro that is for this machine but since I dont know how to load or use a macro ( I have watched the videos but I am still missing something). I believe the tool changer macro is labeled "M6". I have been reading and trying to undertand these values and parameters and when I opened the file I couldnt tell if actual values were installed. Any help would be great. Things I did prior, in general config I checked "run macropumps", in operator I opened VB script editor and loaded the "M6" macro and saved changes. I then closed and reopened Mach. When I opened Mach and typed in M6 T101 in the MDI box I would see the tool number change but no change in the axis position of A. I have full control of that axis. It is set for 360 degrees and if I spin it 90 degrees that is what it does. I dont understand script. Btw the power is on! LOL
Title: Re: Tell me about this macro please!
Post by: ArcEye on March 30, 2010, 04:18:09 AM
Hi

It looks OK, should be called M6Start.m1s.

You should also have a corresponding macro called M6End.m1s, which may or may not actually do something, depending on the set up.

Try renaming it.

regards

ArcEye

PS Turn off macro pump, if you didn't need it before, you don't need it for this.
Title: Re: Tell me about this macro please!
Post by: Fastest1 on March 30, 2010, 07:53:04 AM
ArcEye
Thanks for the response however it has now created even more confusion. I have never used this machine or any machine with a tool changer. When talking to the person who gave me that file I was under the impression that it rotated the tool holder  60 degrees (6 tool holder) and then backed up on the pawl a few degrees to lock. I am not sure if the Dro's reset at that moment or not. I have sent an email to him asking for more of an explanantion of what it is or how to set it up better. At some point I was able to see the file (when I opened it in the "operator"window of Mach). At the point of seeing it, I dont see any numerical values in the brackets. I see some words and equations of some kind which I see referred to in this section regularly but I have no idea what they are talking about. Is that file any different than the original m6Start.m1s that is in the Mach folder? If I could explain my lack of understanding here, I wouldnt be confused! Damn frustrating not knowing what to ask. LOL, at least you all are here to help. Thanks again.
Title: Re: Tell me about this macro please!
Post by: ArcEye on March 30, 2010, 01:02:46 PM
Hi

The macro does rotate the ATC 60 degrees per tool and backs it up 10 degrees at the end to latch the pawl.

Yes it does replace the default macro that comes with the installation.

Rename the original M6Start.m1s macro in your C:\Mach\macros\name_of_your_lathe_profile folder to M6Start.old or something like that.

Copy the new macro to that folder and re-name it M6Start.m1s.

regards

ArcEye
Title: Re: Tell me about this macro please!
Post by: Fastest1 on March 30, 2010, 02:35:35 PM
I cant wait to try it! Thank you. I was pretty sure the macro must have had some info in it.
Title: Re: Tell me about this macro please!
Post by: Fastest1 on March 30, 2010, 03:26:05 PM
Scripter compile error?
Title: Re: Tell me about this macro please!
Post by: Fastest1 on March 30, 2010, 03:46:26 PM
Looks like I wasnt saving it right. Got past that maybe and now it says tool number slot too large. If I type in M6 T1 (any number) in the MDI box, the tool number will change but the carousel doesnt move. I can control the carousel just fine with the keys or with the flyout mpg. Though the tool changer only has 6 spots it will let me call up any number.
Title: Re: Tell me about this macro please!
Post by: ArcEye on March 31, 2010, 04:03:10 AM
Hi

Quote
"Got past that maybe and now it says tool number slot too large"

You need to be precise, there is no message in the macro about 'tool number slots'.

The macro relies upon a saved tool number in a UserDRO, assuming you do not have the old owners full set of macros, that DRO will be blank.

Open the M6Start.m1s macro in an editor (Notepad not Word) and find

HoldingDRO = 1050
Requested_Tool = GetSelectedTool()
Current_Tool = GetUserDRO(holdingDRO)


Change the 3rd line to
Current_Tool= GetCurrentTool()

Save it, set tool 1 manually to cutting position, change the tool number DRO to 1 by clicking on it, entering '1' followed by carriage return and then enter M6 T303 from the MDI line.

If it doesn't work, write down exactly each message you get on the error message line and this will show a) that the macro is working and b) where you got to and why.

regards

ArcEye

PS  I assume you have auto tool change set in General Setup, check this too
Title: Re: Tell me about this macro please!
Post by: Fastest1 on March 31, 2010, 07:39:03 AM
Arceye, Thanks and yes I do have the auto tool change checked. I dont have a tool table set up, if that might be part of the problem. I did think that there must be a value inserted or referred to much as you expained to reference tool 1. Btw with 4 posts are you just out looking to help people? Spend much time here and I will wear you out! Hopefully not, and Thanks for your time and efforts.
Title: Re: Tell me about this macro please!
Post by: Fastest1 on March 31, 2010, 01:14:29 PM
Arceye, apparently I am doing something wrong. I did everything you said above. The file is edited, renamed and replacing the old M6Start.m1s file in my lathe profile. I have entered 1 into the tool dro after homing and setting the carousel on tool 1. If I enter M6 T303, it says, selected tool slot number too large. The tool number box does not change at all now no matter if I use just T3 or M6 T3, M6 T301, M6 T303 with or without spaces, of course the carousel isnt rotating either so it didnt suprise me. I am thinking my problem is how I am accessing the file(M6Start.m1s) in the "operator" drop down of Mach. I open Mach
click on operator
click on VB script editor
click file
click open file
My profile folder from within C/Mach3 pops up and I select "M6Start.m1s"
click open, and now the correct file is in the editor window (I see it has the corrected line as you asked me to change)
At this point I am confused on what to really do, if I select any "run command on the toolbar of the editor it tells me "syntax error". I am not sure what to have expected there, possibly an arrow going down sequentially thru the lines? Anyway I am not sure of exactly how to close/save or implement the file at this step. And how would I check to see that it had been implemented?
Thanks, John

Title: Re: Tell me about this macro please!
Post by: ArcEye on April 01, 2010, 06:09:39 AM
OK

I have re-written parts of it and run it in simulation and it works now.

There was a syntax error with an unterminated If statement and a couple of other little glitches.
(I have taken out the G53 move before the toolchange, you will need to have the lathe carriages in a safe position before the change, use G28 or similar until you are happy with what you are doing and can reinstate it if you wish)

Rename it M6Start.m1s and install it in your profile macro folder.
Run it from MDI not VB window

If it does not work I need to know exactly the message on the error message line, not a paraphrase of it.

It works perfectly in my simulated set up. I can see the axes change value as I select different tools based on my tool table offsets.

regards

ArcEye
Title: Re: Tell me about this macro please!
Post by: Fastest1 on April 02, 2010, 01:37:48 AM
ArcEye, I had built a profile based on a mill profile accidentally. You have to be very careful when creating a turn profile as it sometimes chooses the mill default even when the turn was highlighted. It actually took me 5 times of selecting to "create profile" with Mach3Turn highlighted each time. My issue with the VB had been due to my reading about a macropump. I think I am over that now anyway. I have learned a bit more about where a macro was to be installed and I think that was part of my issue also. I cant thank you enough and I will try this macro this weekend probably.