Hello Guest it is September 23, 2023, 08:07:45 PM

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 - Bodini

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 »
Mach4 General Discussion / Re: Read write to a DRO ??
« on: May 30, 2014, 07:32:31 PM »
I just sent you an email with an image regarding your question (couldn't upload the image at the moment).  Hopefully it's what you are looking for.  -Nick

And super quick here out of my notes:

Sending a Property called 'value' to a DRO called 'udro101' with a variable called 'Passval'
Code: [Select]
Passval = 100
scr.SetProperty('udro101', 'Value', tostring(Passval))

*Addendum*  Finally gained access to photobucket.  ::)  I made this quck image for my own purposes.  (As in, i wont remember in a month  ;) )

The Dro says "1" but the var says "0" (since I'm checking the var, then the script works).  Like you say, that should probably be addressed.

Good thinking, Craig.

Code: [Select]
inst = mc.mcGetInstance()
local linecount = mc.mcCntlGetGcodeLineCount(inst)
if linecount > 0 then
    wx.wxMessageBox ("File loaded")--file is loaded
    wx.wxMessageBox ("No file loaded")--no file loaded

Is there a way for Lua to check IF Mach4 has a gcode file loaded?  ???

Thanks, Nick

Mach4 General Discussion / Re: Mach 4 Feature Request
« on: May 19, 2014, 04:28:18 PM »
I could be totally wrong but i think I read on this forum that a script has to be "wrapped in a function" in the macros folder.  when mach starts, mclua.mcc compiles all the macros (as functions, meaning that it reads them but does not do them).  then when you call the macro, it runs the function (probably totally wrong wording there but from one dummy to another, you get the point).  If your macro is not in function form then mach will run it right there on startup (put a message box in a script, not in a function, and see it for yourself).  as far as ive seen most macros that compiled and ran just fine in the lua editor will cause mach to stop right there (i suppose its in some infinite loop or something).  this was my laymans understanding of what i read on the forum so PLEASE correct me if i'm wrong! :-)


ps- here we go talking about things when this thread is supposed to be for requests only.  >:( ::)  New 'mach hangs on loadup' thread anyone?

Mach4 General Discussion / Re: Mach 4 Feature Request
« on: May 19, 2014, 01:25:56 PM »
On compiling macros at startup: a bad macro should give an error message and not cause Mach hang forever. (don't ask me how I know about that ;-) ) 

Mach4 General Discussion / Re: Variables reading and writing
« on: May 18, 2014, 04:23:18 PM »
found this worked to 15000 for me (at least I did not get any messages, so assume it works)

    if (v1 < -1000000 or v1 > 1000000) then
        --filters out big numbers
    elseif v1 ~= 0 then
        l1output = string.format ("%5d = %0.6f \n",rowno,v1)  --formats registry var number for writing
        file:write(l1output)  --writes to file

Thanks Nick ya did good. nice to have new tools.  ;D

Nice one, Craig.  I had a feeling it could be improved on, but once it worked for me i said 'screw it' and quit for the night. ;-)

Mach4 General Discussion / Re: Variables reading and writing
« on: May 17, 2014, 10:51:42 PM »
HIYA Craig, I have a #VAR report generator for MACH3 that does that trick. It sweeps through ALL the Var Numbers and reports ONLY the one that are > OR <  0

IT IS important that you check for values < AND > because some values are negative values.

Save the text file and send it to Notepad for viewing and printing.

I trick I use a lot when trying to find something in the VARs . I input a Value into a DRO that is easy to spot then I create the report and open in Notepad. THen do a search on that string to find the value and I then HAVE the Var number where I found the value.

Thnaks, (;-) TP

If I read you correctly, I made something like that last night for Mach 4.  Like you said, its good to seek out a certain number you are looking for with a search in notepad (i like notepad++, btw).  This script has similar concepts used in that tool table writing script.  I have it set to stop at 14000 because it sometimes doesnt work after that for reasons that are beyond my knowledge (as most things in this codey stuff are)  :D


Code: [Select]
file = io.open("registry introspect.txt","w") -- open a new current file
file:write("Mach 4 Register Variables\n\n")
inst = mc.mcGetInstance()
regstart = 1  --start registry #
regend = 14000 --end registry #
regstep = 1  --step increment
rowno = regstart

for L1 = regstart,regend,regstep do  --creates the registry number to check
    v1 = mc.mcCntlGetPoundVar(inst, L1)  --gets the var from the registry number

    if v1 < -1000000 then
        --filters out big negative numbers
    elseif v1 > 1000000 then
        --filters out big positive numbers
    elseif v1 == 0 then
        --filters out zero values
        l1output = string.format ("%5d = %10.4f \n",rowno,v1)  --formats registry var number for writing
        file:write(l1output)  --writes to file
    rowno = rowno + 1 --iterate the row number
file:write ("\n")  
file:write(os.date("Created: %x  %X"))

Mach4 General Discussion / Re: Export tool table
« on: May 15, 2014, 11:41:53 PM »
Oops, we crossed paths there. ha!  look for vars w3 and w4.

Mach4 General Discussion / Re: Export tool table
« on: May 15, 2014, 11:40:25 PM »
Followed corrections/suggestions by TP.  Version 2. (or would that be or something like that?)   :D

Code: [Select]
--Version 2
file = io.open("tool table.txt","w") -- open a new current file
file:write("Mach 4 Tool table\n\n")
file:write(string.format("Tool#        Length   Length Wear     Dia   Dia Wear    Description\n"))

inst = mc.mcGetInstance()
var1 = 7780 --start number
var2 = 10319 --end number
var3 = 10 --increment
local toolno = 1

for outer = var1, var2 ,var3 do
    c1 = outer + 5 --length
    c2 = outer + 6 --Length wear
    c3 = outer + 8 --dia
    c4 = outer + 9 --dia wear

    w1 = mc.mcCntlGetPoundVar(inst, c1)
    w2 = mc.mcCntlGetPoundVar(inst, c2)
    w3 = (mc.mcCntlGetPoundVar(inst, c3)*2)
    w4 = (mc.mcCntlGetPoundVar(inst, c4)*2)
    desc= mc.mcToolGetDesc(inst, toolno)
        ootput1 = string.format("Tool#%d   %10.2f %10.2f %10.2f %10.2f    %s\n",toolno,w1,w2,w3,w4,desc)
        ootput2 = string.format("Tool#%d   %9.2f %10.2f %10.2f %10.2f    %s\n",toolno,w1,w2,w3,w4,desc)
        ootput3 = string.format("Tool#%d   %8.2f %10.2f %10.2f %10.2f    %s\n",toolno,w1,w2,w3,w4,desc)
if w1 > 0 then
if toolno >= 100 then
elseif toolno >=10 then
        var1 = var1+10
toolno = toolno + 1
 file:write ("\n")  
 file:write(os.date("Created: %x  %X"))
 file:close() -- close current file

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 »