Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: Vido on July 06, 2023, 04:24:18 AM

Title: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 06, 2023, 04:24:18 AM
Hello,

I use MACH3 to control a waterjet cutting machine. Since I have a parameter list in which the parameters (e.g. pressure, feed, amount of abrasive, etc. depending on the material and material thickness) are entered (= txt. file), I would like to add them depending on the material and material thickness read in data. My train of thought would be that I create a subprogram for each material and for each material thickness and then access this. In such a subprogram (e.g. for material = titanium and material thickness = 2mm) the pressure, the amount of abrasive, the pierce time and the feed should be entered and exactly these values ​​should be read in and accepted by MACH3 by calling the subprogram. Can MACH3 do that at all? There is nothing in the manuals about it.
As CAD/CAM I use TopSolid because this is preferred (not by me)!
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Graham Waterworth on July 06, 2023, 06:23:47 PM
I would have thought you could do that with your CAD system.  Can you setup a tool library with all the tools set with different cutting data.  Is the data a calculation based on material and thickness,  if its a ratio its a simple calculation button and 2 DRO's.

If not then you could use a VB macro to read a CSV file and if all the different types had a number code you could load it, that way you can put it into mach3's dro's.

The other option is to create a wizard screen with drop down or buttons.

Its doable but time consuming.


Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: TPS on July 07, 2023, 05:40:29 AM
here is an example i made years ago for a Laser.
sorry, comments are in German, but the code itselv
will explain what it is doing.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 14, 2023, 11:03:48 AM
I got it. Thank you very much!
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 17, 2023, 07:05:49 AM
Another question, maybe you can help me: can I program the offset when homing an axis? I imported the material list and this includes the material thickness. I have the material thickness displayed in a DRO and I would like to read this out in order to use the Z axis for referencing up to e.g. 3 mm above the workpiece surface, is that possible? I can see the command behind the "Ref All" button on the MACH3 screen, it doesn't do me much good because it just says: DoButton(24) DoButton(23) DoButton(22)! I would also like to have the SoftLimits activated in the program, at least for the Z axis.

Thank you!

PS: for all German speakers: i speak German! :D
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: TPS on July 17, 2023, 07:10:27 AM
have a look for G52 and G92, maybe one of these is what you are looking for.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 17, 2023, 11:14:36 AM
have a look for G52 and G92, maybe one of these is what you are looking for.


Something more important: with your help I managed to import the parameters from the material list and to display them in the DROs of MACH3, but on a PC where I can sit comfortably in front of it. I have now copied the necessary files to the other PC at the machine and it does not open the parameters there - the DROs always contain zero. The paths of the files are the same, the programs are the same - everything is the same, but the parameters are not read in. The controller (CSMIO/IP-A) is connected to the PC by the machine, while no controller is connected to the PC where I created the programs - does it have any influence? Did you have this problem too?

Thanks
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 17, 2023, 12:07:59 PM
I found the problem now: it's the controller (CSMIO/IP-A)! If I don't connect to the controller when starting MACH3, then the material selection works fine - the parameters are displayed in the DROs. However, if I connect to the CSMIO/IP-A controller when starting MACH3 (which I must, otherwise the axes cannot be moved), then zero is displayed for all parameter DROs. What could be the reason?
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: TPS on July 17, 2023, 12:21:39 PM
witch DRO numbers did you use?
out of my mind, i think i can remember CSLAB usees the aeria 1500 ++.
but not 100% sure.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: TPS on July 17, 2023, 12:33:02 PM
did a quick search
1501 1502 1503 are used by the encoder module
1510 1511 by spindle positioning
1511 1512 1513 by probing
1511 1512 1513 1514 by riggid tapping
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 17, 2023, 01:10:11 PM
did a quick search
1501 1502 1503 are used by the encoder module
1510 1511 by spindle positioning
1511 1512 1513 by probing
1511 1512 1513 1514 by riggid tapping

Oou, okay. I used 1500- 1504 for the DROs
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 18, 2023, 03:10:39 AM
did a quick search
1501 1502 1503 are used by the encoder module
1510 1511 by spindle positioning
1511 1512 1513 by probing
1511 1512 1513 1514 by riggid tapping

i tried other OEM Codes (1203-1207) for the DROs and it works. Thank you!
By the way: where did you get the information that CS LAB use the OEM Codes 1500+? I've looked through various documents from MACH3 but found nothing; I only have an application description from CS Lab but it doesn't say anything about OEM codes.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: TPS on July 18, 2023, 06:51:10 AM
i got some information years ago from Wojtek (CSLAB) and som others you can find in their example script's.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 18, 2023, 08:49:06 AM
i got some information years ago from Wojtek (CSLAB) and som others you can find in their example script's.

Sorry to ask again: I would now like to use the number read from the text file, which is displayed in a DRO, to set a delay. The delay should ideally be directly in macro M771. Macro M771 opens the valve. After opening the valve, a delay time (depending on the material and material thickness - value read from the material list into the corresponding DRO) should occur before the program continues. I tried the following (written directly in macro M771):

1) AcivateSignal (Output8)
    Sleep(GetOEMDRO(1207))

2) AcivateSignal (Output8)
    #1 = GetOEMDRO(1207)
    Sleep([#1])

3) AcivateSignal (Output8)
    GetOEMDRO(1207) = a%
    Sleep(%a)

Case 1 shows no error, the valve opens (it should) but it is not delayed?
Case 2) shows the error "Scripter Compile Error. In:M771.mis"?
Case 3) shows the error "Error on line: 2- Type mismatch"?

Is it possible to run the "G4 P" command via the macro, where the value from the DRO should be after the "P"?
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: TPS on July 18, 2023, 08:58:14 AM
i have tested this code in VBScripter window:

Code: [Select]
SetOEMDro(1207,5000)

msgbox GetOemDro(1207)

ActivateSignal(OUTPUT8)

Sleep(GetOEMDRO(1207))
   
MsgBox "After"

and it works like expected
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 18, 2023, 09:37:44 AM
i have tested this code in VBScripter window:

Code: [Select]
SetOEMDro(1207,5000)

msgbox GetOemDro(1207)

ActivateSignal(OUTPUT8)

Sleep(GetOEMDRO(1207))
   
MsgBox "After"

and it works like expected

It works with my variant all the time too. In the settings I set the dwell to seconds. What I missed is that for the "Sleep" function, the time is always given in msec. Since I had readings of around 3 seconds (which turned out to be 3 msec for the sleep function), this is barely noticeable, so I figured there was no dwell at all.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 20, 2023, 09:32:14 AM
Hi TPS!
Do you perhaps have a list of which pound variables are occupied or free in MACH3? I would like to read the feeds out of the DROs depending on the material and put these values ​​after the "F" in the G-code. When selecting the variables, I selected the command "SetVar(1234, GetOEMDRO(1203)) in a macro M123, i.e. variable 1234 always reads the feed - that works. But if I write "SetVar(1235,GetOEMDRO(1203)), then the error message comes up: "Cannot do G1 with zero feed!"
I also tried using variables 1233, 1236, 1001, etc. but got the error message every time. When selecting variable 1, it suddenly worked again. There must probably be some variable numbers in use here as well, but I can't find a list of which they are or which variables are still free.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 20, 2023, 10:13:38 AM
I've tried various variables. The error message "Cannot do G1 with zero feed!" appears when the G- code ist loading for the first time, the program can be started and the machine moves with the correct feed rates. As a result, the error message no longer appears (unless there really is zero in the DRO - then the program stops at this point, which is also clear). Is it possible not to get the error message? It works, but it's annoying when the error message appears when loading the G-code for the first time! I habe to click the button "Rewind" and then start the program.
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: TPS on July 20, 2023, 12:06:06 PM
the simpies way to set the feedrate is:

Code: [Select]
Code "G1 F" & GetOEMDRO(1203)

or just
Code: [Select]
Code "F" & GetOEMDRO(1203)
Title: Re: Read specific data from a parameter list (txt file) into MACH3???
Post by: Vido on July 21, 2023, 07:49:12 AM
the simpies way to set the feedrate is:

Code: [Select]
Code "G1 F" & GetOEMDRO(1203)

or just
Code: [Select]
Code "F" & GetOEMDRO(1203)

Ok, when I do it with your variant, then the error message doesn't come at all. It's funny that the error message with my variant ONLY occurs when the G-code is loaded for the first time - but the program runs perfectly... funny.
Thanks!