Value array

More
31 May 2022 07:51 #244264 by luki
Value array was created by luki
Hi everyone,

first of all I want to say thanks to everybody in this forum that helped me commissioning my system so far.
If anyone needs help with his MESA 7C80 write me. I will support as good as I can.

I'm planing to do a battery cell welding system with Linux CNC.
The first step is done. I'm using the MESA 7C80 which works very good so far. The system is moving. Now it's time for the next step...programming the movement.

I'm coming from PLC programming. What I'm aiming for is something like a main Programm and a seperate file with parameters which are used in the main program. These paramaters are for example: X and Y location for each battery cell, numbers of welding spots for each cell and so on.

The main programm should be able to look up these parameters by an index number.
Is that possible? If it is poosible. What than is the keyword?

Thank you in advance.
Lukas

Please Log in or Create an account to join the conversation.

More
31 May 2022 08:50 #244267 by andypugh
Replied by andypugh on topic Value array
I am not entirely clear what question you are asking, so this might be the answer to the wrong question.

LinuxCNC G-code supports numerical parameters (#1, #2 etc) and also named parameters (#<xpos≥ for example)

For the numerical parameters indirection is supported:
#7 = 20
#1 = 7
(DEBUG, #[#1])

Would display the value "20"

LinuxCNC also supports subroutines, and these, too, can be numbered.
O100 SUB
(DEBUG, This is Subroutine 100)
O100 ENDSUB

#1 = 7
#7 = 100
O #[#1] CALL

But consider whether you really want to use re-usable G-code for this. It might be better in the long term to have a front-end (graphical or otherwise) that outputs a chunk of transient job-specific code for each job.

Of course, you don't have to choose, you can easily do both depending on the job.

As an example, here is a bit of G-code I wrote that uses computed subroutine calls to engrave numerals:
forum.linuxcnc.org/20-g-code/27169-g-cod...inders?start=0#40497

Please Log in or Create an account to join the conversation.

More
31 May 2022 09:45 - 31 May 2022 09:45 #244271 by luki
Replied by luki on topic Value array
  Hi Andy,
thanks for your quick reply.
I would like to use a special torch to weld copper cell connectors onto lithium-ion cells. Any number of spot welds can be set on a cell. These spot welds are located on an imaginary circle that is coaxial with the center of the cell. The parameters for each battery cell in the pack are: - X and Y coordinate of the center of each cell - Circle diameter on which the spot welds are located - Number of spot welds on the cell So I need a file that contains this information for each cell. A loop runs in the main program. The loop counter corresponds to the index to access this information. I hope you now understand a little better what I intend to do.

In the Image you see a cell with three welding spots.
 
Attachments:
Last edit: 31 May 2022 09:45 by luki.

Please Log in or Create an account to join the conversation.

More
31 May 2022 09:58 #244272 by luki
Replied by luki on topic Value array
I will need something like a multi-dimensional array to store the data for each cell.

1. dim: Cell number
2. dim: X-location of cell centre point
3. dim: Y-location of cell centre point
4. dim: circle diameter on which the welding spots are located
5. dim: number of welding points

Please Log in or Create an account to join the conversation.

More
31 May 2022 13:51 #244290 by luki
Replied by luki on topic Value array
I tried to do it with variables within an INI-file

which could look like this:

[1]                      <- battery cell number
X=100               <- X location of battery cell
Y=100               <- Y location of battery cell
DIAMETER=3
PPOINTS=4

Inside my gcode it looks like:

G1 X#<_ini[1]X> Y#<_ini[1]Y> F1000

That works pretty good BUT the  question for 1 million $ is:

How can i make section a variable so i can access the sections by a loop counter?


 

Please Log in or Create an account to join the conversation.

More
01 Jun 2022 00:37 #244329 by andypugh
Replied by andypugh on topic Value array
I don't think that passing values in from the INI is the way to go.

If I was doing this I think I would make a simple GUI to enter the parameters.

Then I would have a G-code subroutine that takes X, Y diameter and points as inputs to do the welds for each cell.

Start with the Subroutine, so that, in MDI:

O <weld> CALL [100] [100] [3] [4]

Does the welding. Then work out what the next layer up is.

linuxcnc.org/docs/stable/html/gcode/o-co...ml#ocode:subroutines

Please Log in or Create an account to join the conversation.

More
03 Jun 2022 08:00 #244489 by luki
Replied by luki on topic Value array
Sounds promising. I will try that. Many thanks Andy.

What dooes MDI mean?
Is there any documentation of how creating a simple GUI to enter paramters?

Please Log in or Create an account to join the conversation.

More
03 Jun 2022 21:49 - 03 Jun 2022 21:58 #244546 by BigJohnT
Replied by BigJohnT on topic Value array
MDI is Manual Data Input, LinuxCNC you can input one line of G code at a time.
NGCGUI is what I use on my lathe to many ops.
linuxcnc.org/docs/stable/html/gui/ngcgui.html
or possibly
linuxcnc.org/docs/stable/html/gui/pyvcp.html

JT
Last edit: 03 Jun 2022 21:58 by BigJohnT.

Please Log in or Create an account to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum