Hello Guest it is April 25, 2024, 08:56:13 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.


Topics - machiavellian

Pages: 1
1
Thinking they would be useful, I copied the various tables from the end of the Mach3 programming manual and pasted them into machine executable .m1s script files that contain a bunch of constant declarations.  I'd prefer to avoid using 'magic numbers' in my code since I've been taught that's a no-no since, like 1980.  Even assembly language back then had good macro expansion support.

Problem is, pulling them in with #expand is absurdly slow, at least in the interpreter environment.  And RunScript loses it's context so it's useless for initialization.  So I see why that's just not done in Mach's VBScript (aka Cypress Enable).

For the short-term I've resorted to just using the scripts for reference and copy & pasting in the lines I need, but that's triggering my compulsive-programmer disorder, I like my the code I write to be 'perfect' (as possible anyway).

So long story short, is there any way of compiling .m1s script text files into binary .m1c files as referred to in a few places in the manuals?  This should eliminate the text file copying & parsing that's going on while reaping the benefits of getting clear, consistent & readable definitions layed out, thus improving code without the overhead.  Is it possible?

Apologies in advance, I'm new here and just starting to get up to speed.  I'd be happy to share the constant definition files if anyone is interested.  Ideally someone would throw them up on GitHub & better document & maintain them.

... hmm...  Alternatively, there appear multiple ways to escape the execution environment, even mention of com interfaces, but is there any provision (API) for integrating an app running externally to for example, read & write internals in Mach3?  Otherwise that seems pretty futile without some serious hacking.

Or I guess I could hack together my own pre-processor, even handle #expand & remove the unnecessary fluff, but that seems overkill unless it became a community project useful to many.

My hopes aren't high here, but I thought it's worth asking since I'm so new to this programming environment.  Am I just missing something obvious?  I'm kinda legendary for that...

2
VB and the development of wizards / How to interrupt a running script?
« on: December 11, 2020, 01:57:37 PM »
I'm writing a new tool-change z-zeroing script.  It approaches things a little differently (sorry bad pun).

The script loops at multiple points and I want the user to be able to pause and/or stop the script at various points by clicking <Feed Hold> and <Stop> buttons on the [Program Run] screen (or keys or MPG inputs).

I can't seem to find a way for the script to read the 'clicked' state of these buttons.  Is there a way to do this?  I can't edit the script behind these buttons. (?)

Clicking <Reset> seems to stop the script but clicking <Reset> again to clear the e-Stop continues the script where it stopped.  If the tool is about to crash, this isn't quite what I want...

Interrupting motion underway would be a bonus if possible, but I'm aware it's happening async in another thread if not on an external motion controller.  Maybe checking a stop flag and triggering a motion-abort in the While (IsMoving()) loop?

Ideally I'd like to do all this while not having to edit screensets or throw up modal dialogs.

This seems like it should be pretty easy to do, I think I'm probably just missing something obvious.

Hopefully this new tool setting approach will solve some of the problems I've run into (haha) with the scripts I've found online.  If it works well I plan to share it here.

3
General Mach Discussion / Definitive Tool Auto Zero Script
« on: December 02, 2020, 08:43:59 PM »
Is there a definitive (tested, debugged, safe) tool auto-zero script available?  I've tried several I found here and elsewhere and they all seem to range from unreliable to dangerous in one way or another.  I just spent most of a day trying to find something that works and they all seem pretty slipshod.  Not for lack of effort, it just seems people solve their corner case and call the job done instead of publishing a robust solution to the general problem.  It seems the best option for meis to scrape together my own hack.

Am I just missing something obvious?  It seems a topic of interest, a related forum thread here has >8000 views in three years(!)

If there really is no really safe, reliable, recommended script out there, is anyone interested putting our heads together and writing one?

It seems like it breaks down into two use-cases:  The Auto Tool Zero (ATZ) button script and when a M6 macro calls the M6Start/End scripts.  For my use, I'd like the ATZ button to trigger a zero at the current location but M6 to safely move to the Auto Tool Change location and zero from there.

The problems I've seen in various scripts seem to break down into different categories:  Properly capturing & restoring machine state when the script runs, safely (but quickly) doing a rough 1st-pass find-zero without overrunning the touch-plate, ...

... Before diving in too deep, I'd better gage interest.  Maybe a good script is out there?

Pages: 1