Hello Guest it is April 25, 2024, 12:13:13 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - moorea21

Pages: « 1 2 3 4 5 »
11
General Mach Discussion / can a macro read a comment in gcode file?
« on: May 17, 2015, 03:39:48 PM »
I've had the idea of encoding some extra information from my vb6 gcode generator into my gcode files by having it write them into a gcode comment line (on line 8 in this particular case), with the idea that a macro might then be able to read them and assign their values to persistent variables in mach xml. This seems less complicated to me than my original idea of trying to get my vb6 app to write to mach's xml directly.

Can a macro 'read' a line of my gcode file, and use what it finds, without me having to write in line numbers for it to refer to? I'm not sure what approach to take with this; maybe using carriage returns as delimiters for an array made out of the first 8 lines, and then break the 8th element into its usable parts. Does Cypress Basic do this? Or is there a better approach to this problem?

Thanks,

M21

12
How would I find the locations where persistent variables 500-600 are stored on my hard drive? If possible, I'd like to write to these variables with the software I use to generate and edit my gcode, so their values can be found and used in my macros.

13
General Mach Discussion / can subprograms be listed out of order?
« on: May 12, 2015, 02:49:17 PM »
I'm not with my Mach pc for a few days, but I was wondering about how flexible Mach is when it comes to the order of subprograms and main code etc in a gcode file; so I thought I'd just ask instead.

My code runs fine, when the subprograms are written in numerical order, but it would be useful if they could be written in the order in the attached text file; I have a program that generates my gcode, which I can modify easily to resemble that in the attachment, but putting them in numerical order would be much more difficult.

Does Mach allow subprograms to be listed in non numerical order? Does it matter if some appear after the 'M30' line? My code has no main program as such; the main code is in sub 411, and it never gets to M30 because a macro called before that closes the file and opens the next one in the folder.

As I said, it runs fine when the subs are in numerical order; the only change to the attached version is the order they are written in.

14
General Mach Discussion / call subprogram from macro?
« on: May 03, 2015, 12:47:14 PM »
I could call a subprogram from a macro by coding

Code "G98 P112"
but is there a way that doesn't use 'Code "'?

Thanks
M21

15
General Mach Discussion / using a variable value directly in gcode
« on: May 03, 2015, 10:08:32 AM »
I'm having no luck executing movement from inside macro files, so I'm looking for an alternative to this macro.

Dim X As Double
X = GetVar(302)
Code "G00 X" & X
End

Is it possible to call up the value of the variable X in this way inside the macro, pass it to the main Gcode file, and then read and execute the 'G00 X &X' command in the Gcode itself, rather than unreliably from inside a macro? Absolute mayhem ensued when I tried more complicated moves from a macro, I'm looking to avoid all 'Code "G...."' statements if at all possible.

If not, would adding
'If IsMoving()
Wend'
before 'End' ensure that this line is executed properly before moving on?

Thanks,
M21

16
When I run his macro (attached,) I wanted it to stop all activity at the statement 'DoOEMbutton(1003)', but this doesn't stop the macro call afterwards, which then executes some gcode moves when I had wanted no gcode moves...

Obviously DoOEMbutton(1003) isn't the right command to use.

What should I use instead, that will stop the macro from running (preferably as well as any gcode that's running) until I press cyclestart?

Thanks again

M21

17
Attached macro works fine using F7, on run (in VB window), most messages don't appear. If I un-comment the message on 2nd to last line, no messages appear except the last one.

Can I change this behaviour?

Thanks

18
Attached macro and Gcode file ('.cgf')

When loaded, this starts without me pressing cyclestart, ignores M00, tries to run the macro which gives message 'Terminating Scripts' while a tool path fails to appear.

Running the macro from the vb editor on the same gcode file but without the call to M111 works fine.

Baffled here, as usual...

Why does this happen?

19
I've written this, to interact with a picaxe and a light sensor that works like this:-

- Outputs are activated, one 5.0V for the picaxe and sensor, etc, the other 3.6V for an LED.
- The picaxe gives a signal to the BOB to say it's switched on
-The picaxe via sensor measures ambient light through a small 'window', records its value
-The machine (Mach3) squirts a sample of paint on the window and compares the amount of light before and afterwards; if the difference is over a certain value, IsSquirtBigEnough sets to 1, and the macro ends, returning focus to the Gcode file that called it
-If the paint deposit was not big enough, IsSquirtBigEnough sets to 0, and the macro returns to the label 'tryagain'. The window self cleans (C drive), and the test starts again

Code attached; there may well be a better way for Mach to look out for signals from external sources, also my gcode pauses may not produce accurate timing as they are probably slow to process. That's my guess anyway.

This code gives me a syntax error, without highlighting where that error is, and I haven't been able to spot it. The missing 'Is' from the start of a variable name isnt it; I fixed that, same result.

Also, my method for coordinating the actions of main machine and picaxe may not be that good; has anyone successfully used somethng like this before? If so, how was it coded to make sure both units work together in time?

Thanks
M21

20
I want to be able to preserve the value of 'FileNum', (variable used in a macro), and access it from other macros after the macro that generated it is switched off, or use it in the same macro called again later in my Gcode. I tried this:-

Dim FileNum As Double

'Code arriving at a value for FileNum...

Param1() = FileNum

It tells me I have a type mismatch at the last line, which I don't understand, as the manual says that parameters are doubles, like my variable.

My variable is never more than 2 digits long, so doesn't have to be a double; I just thought it needed to be, in order to transfer its value to parameter1.

Am I not assigning the value of FileNum correctly to Param1()?
How can I pass values from one macro to another?

Thanks,

M21


Pages: « 1 2 3 4 5 »