Question

Firstly, great job on B4A. I've just started, and already have a small app running on my 10" tablet. It's very exciting. But I'd like to do this next...

As a self-taught newbie, I wrote an app using VB6. It's a "glorified calculator" that produces a text file from user inputs, which becomes a "program" for a CNC lathe. In essence, the app generates one text file - a long list of variable names and their values. These variables are then read back into memory, and output to a second text file, in a format the CNC lathe can understand. To make life interesting, all lathes are not created equal - they have slightly varying (syntax?) needs, so there have to be several separate "Post Processors" to cope with the different "dialects". Which is not a problem, once I have it sussed in this Android world!

So (simplified) the first text file, produced from user input in text boxes, may look like this: Diameter1 = 123.4

Diameter2 = 456.7

Length1 = 0

Length2 = -35.

RoughingFeedrate = 0.25

FinishingFeedrate = 0.1

etc...

This first text file format isn't critical - whatever works. It's just an intermediate storage place.

Then, after "Post Processing", using the stored variables in the first text file, the second text file could be this:

G0 X123.4 Z0

G1 Z-35. F0.25

X456.7 F0.1

I'd be very grateful for either a solution, or to be pointed to a suitable place. I have looked but not found anything simple enough. I'm hoping this is one of those "easy when you know how" situations. I thank you in advance, hoping I've posted in the correct place, and hoping that you have a SIMPLE solution for me, (these posts are mind-boggling!)

Was it helpful?

Solution

See the text files tutorial. You should use File.WriteMap to save a pairs of keys and values. You can later either create a string with the required format and save it with File.WriteString or add each line to a list and write it with File.WriteList.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top