Hello Guest it is December 09, 2021, 09:25:22 AM

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.

Messages - Octathorpe

Pages: « 1 2 3 »
Everything is working great!

I put it all together on the actual machine today and it all checked out .  Everything moves as it should and behaves as intended.  What a great result!

I will play around with those other suggestions and make sure that it ends cleanly and has no errors.

I have one more step I have to complete before a real run.  The spectrometer program is rather lame and takes up a huge amount of CPU - there really isn't much I can do about it.  But I was not able to install Mach 3 and run it at the same time as the spectrometer app on the same machine.  It just crashed the machine. So I'm going to leave mach 3 on a separate machine and do the file check on the spectrometer box.  It won't really change much.  I'll set that networking up tomorrow, set the new file path and gather my first set of data. 

Jason, I really appreciate your effort.  I've been fretting about this and trying various approaches for quite a long time - with very limited success.  However, what you have provided is solid and really looks like it will work perfectly for me. 

Jason totally Rocks!

I have added a blerb of script to do the movements, and (amazingly), it worked!

Since this is running as a macropump and goes through and then restarts, it isn't necessary to have logic for stepping through the spots in sequence, all that has to be done is just move X + 9 unless the end of a row has been reached.  This is easly figured out based on the number of files. 

If anyone has comments please let me know, otherwise I'll put it on the actual machine today and see what happens.
----------------------- (code below - I coudn't figure out how to make the 'code' box)

'for all cases not described in select below set move to be X+9

MoveX = GetOemDRO(800) + 9
MoveY = getoemdro(801) + 0

'for the special cases at end of rows override previous settings

Select Case  GetFileCount
  Case 12   
    MoveY = getoemdro(801) - 9
    MoveX = GetOemDRO(800) - 99
  Case 24
    MoveY = getoemdro(801) - 9
    MoveX = GetOemDRO(800) - 99
  Case 36
    MoveY = getoemdro(801) - 9
    MoveX = GetOemDRO(800) - 99
  Case 48
    MoveY = getoemdro(801) - 9
    MoveX = GetOemDRO(800) - 99
  Case 60
    MoveY = getoemdro(801) - 9
    MoveX = GetOemDRO(800) - 99
  Case 72
    MoveY = getoemdro(801) - 9
    MoveX = GetOemDRO(800) - 99
  Case 84
    MoveY = getoemdro(801) - 9
    MoveX = GetOemDRO(800) - 99
  Case 96
    MoveY = getoemdro(801) - 63
    MoveX = GetOemDRO(800) - 99
end select

'Move Y
Code ("G1 Y" & MoveY)
'Move X
Code ("G1 X" & MoveX)


I installed Mach 3 on a machine at home (no CNC but it doesn't seem to care all that much).  It all loaded up perfectly! 

I can paste files into the C:\automation directory and the LEDs go on.  This is really getting fancy now!

I'll try it on the real machine tomorrow and start trying to add the movement commands in there.

I've managed to get the motors tuned correctly and moving the correct distance.  I've got a button working with VB code attached to it.  I couldn't get screen designer 4 working, but I got it to work in screen designer verision 3.  I'll need to figure out more about how to turn LEDs on and off and get something going to be able to stop the program if something goes wrong.

I've attached an image of what the sample plate looks like as well as some example coordinates.   I am planning to move from the top left in the image (0,0) to the right across the 12 columns in the X direction to (99,0) in multiples of 9 mm and then come back to (0,9) and move across the 12 points to (99,9), etc.   

I am going to do some more testing to get more familiar with the process of working within Mach with VB.  I'm still getting used to the debugging process and how to complete if, then, else logic.  It's not something I have done much of.   Next I'll deal with the logic of making it work through the array in some logical fashion.  I'm sure there are a thousand different ways to accomplish that process.

It's all moving along quite well....

It's Alive!!

...well it's pretty exciting for me, anyways.

I was able to paste your code into the script editor and it reads the number of files correctly in the target directory and then moves the machine.  So that is good news - at least that file system function for reading the number of files works and should function as a trigger. 

btw, I'm not sure what the "?" are in my view of the code, could be a font issue - I'm in Atlanta.  I'll keep working with the screen editor (can't get it to work for me yet).  I also have to set up some other variables - it's currently moving 11.5 mm instead of 9 mm per move.  I'll report when I have more info.  Thanks very much for your effort, it's nice to see the critical part functioning!


I will try to test that code today and let you know what happens.  If I can at least get it to move in response to a single file creation event then all of the movement can be worked out.

When I paste the code into notepad, the question marks appear as little box.  Is that what is expected?

You asked if I could generate an external trigger using the machine.  There is an option to use an LED on the instrument that goes on and off as an analog trigger for mach3.  I have been considering using a phototransistor to trigger a high (5V) setting to one of the parallel port input pins when the LED is on (LED on means collecting  data, LED turns off means that file is done).  This is essentially the same information that can be obtained with the filecount variable you used in the script.  I would like to try the VB filecount route first, but if there is some significant reason why it would be best/easiest to do this whole process using the LED and a 5V input trigger then let me know and I will get that little circuit put together and get a 5V trigger coming into the parallel port.  I have the parts to build the optical sensor, but I have not made it yet - I assume it _has_ to be relatively easy to build such a sensor (I have a few schematics) and get it working, but then again, my first award after joining the department was "most likely to electrocute himself" so I can't guarantee the success of my sensor building abilities  ;)

Meanwhile I will test the script - which I very much appreciate.  I will comment out all of the case statements for now and just see if I can get a response from a filewrite event in that directory.

Yet another follow up. ;D

I have determined that my spectrometer program has an option to "allow data to be sent via DDE to a spectrum analysis application".  However, I believe it is only set up to work with one particular program.  Still, this may again provide some kind of handle. 

I believe you are correct in that I can do everything in G-code if I use the analog optical sensor to trigger a 5V signal which I can monitor on the parallel port.

What I'm trying to decide now is which external trigger should I use to be the trigger to continue and move to the next spot:  external analog optical or internal operating system file write/detect function. 

I'm going to try to see if anyone has any comments on the VB script concept in the other thread as a solution may be as simple as attaching a relatively short script to a button on a mach 3 screen.  If that turns out to be problematic then I'll start trying the analog optical route.  I suspect that if I go with this 5V trigger route then there will be a lot of folks around here that will know how to help me with the syntax for such a script since it will not involve VB.  I've got a phototransistor, 5V power supply, appropriate resistor and a schematic, but I have not actually put the photosensor widget together to see if it will function as I expect.

I am concerned that I will not be able to run the script I previously posted because mach3 may not understand that kind of command.  If that is the case, is there a way to run a native VB script and still be able to send a move/G code command to Mach3 from outside the program?

The following is a description of the sequence that I want to script.  Sorry, I'm not a programmer myself so I don't know the proper syntax, but what I'm trying to do is rather simple so I just wrote it out in text so you can get the general idea.  Any comments or suggestions as to how to create this would be appreciated.

Sample layout is a square grid of 96 points with 8 rows on the X axis and 12 columns on the Y axis.  Points are 9.00 mm apart.

Start loop1 with  Y=0
Start loop2 with X=0
Wait for a new file to appear in directory, then move to next line
Gcode command: Move to point (X+9, Y)
If X=63 then goto next line, else goto loop2 repeat point above
If Y=99 then end
Let Y=Y+9, goto loop1 repeat point above

Pages: « 1 2 3 »