Hello Guest it is May 22, 2024, 03:51:38 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 - thosj

301
Mach4 General Discussion / Touch button Hobby vs Industrial
« on: March 26, 2017, 05:07:46 PM »
Man, I'm telling ya!

As you all know by now, I have a Mach4 Industrial license and a Mach4 Hobby license. I have both installed, both working with the same screen and same profile, copied to the proper place in each, of course.

In Industrial the Touch button did NOTHING, much like MDIing T1M6 from my previous post today. I quit, start Hobby, it works. Hmmm..... Much sleuthing, screen editor, check button script, same. I see it's calling mcTouchOff.lua. File exists in both Modules folders, but the size in industrial is like 7k, the one in hobby is 292k!! I open them both in NP++, they're VASTLY different belying the 285k file size difference ! Hmmmmm.....again. Rename file in Industrial, copy in Hobby version, run Industrial, Touch button opens the interface.

So now, of course, I'm wondering, will it work or does it require other stuff that isn't there? And isn't the ONLY place to set the probe tip diameter in the Touch interface, it can't even be set in the Probing tab, right?? So I NEED the Touch module?

And I'm wondering why use Industrial at all, thanking my lucky stars I own Industrial thanks to Brian's early offer to us Mach3 users. If I'd paid $1400 I'd be more than simply perplexed.

If my Industrial license entitles me to support, I'd sure like to know why it's so different from Hobby, other than the places it's SUPPOSED to be different, like MACRO B and a fancier screen editor. And what do people who actually paid $1400 think? Or don't any users use Industrial other than a purchased OEM machine that's all configured for them? If I hadn't had Hobby to fall back on/compare, I'd have never figured out this Touch button thing.

Tom
0 days since last modification!

302
Mach4 General Discussion / Mach 4 M6
« on: March 26, 2017, 11:00:08 AM »
So I'm pretty new to Mach4. I have both an industrial license and a Hobby license. I have Industrial all setup on my machine and for two weeks have worked thru getting everything all setup, motors, limits, soft limits, screen, PoKeys buttons and analog pots, on and on. Never tried a tool change!! Now I think, time to figure out how tools work. Did T1 M6 in MDI, NOTHING except the dialog telling me to change tool and hit cycle start. Nothing. I have Hobby installed on another PC also, licensed, running Sim Mode. T1 M6 works there. Hmmm....started digging around, read configuration manual, operation manual, forum, and discovered the Macros directory in my profile has nothing but mcLua.mcc. This profile was originally created by packaging a Hobby profile and loading it into Industrial. Apparently the Macros folder for that profile, or at least all the stuff, didn't make it.

I've added two screenshots of the folder contents of my profile/macros folder and the default. Do I copy all the stuff that's in there over to my profile? I imagine so, but what is all that stuff other than m6.lua?

I guess one just has to KNOW to look in all these locations, plugins, profiles, profiles/macros, screens, others (?), and make sure they made the trip!! And yes, I watched the video about updating Mach4, but that's all manual copying, which in the end, might be a better way than packaging.

Like someone told me long ago, it's all intuitive if you know how to do it!!!

Tom

303
Got it, sheesh, finally!  ;D

Thanks to Wallerwang (?), and I don't know why Craig's code didn't work, it worked mathematically!!

Here's the code that actually works for me, for the cutters/pasters among us! You'd only need to change the PoKeys Device and PoKeys Analog Input to yours.

This is my Speed Override, 50% to 150% to match Mach slider

Code: [Select]
--Function to read value from analog register
function ReadRegister(device, analogPin)
    local inst = mc.mcGetInstance()
    local hreg = mc.mcRegGetHandle(inst, string.format("%s/Analog input %s", device, analogPin))
    return mc.mcRegGetValueString(hreg)
end

--Function to set SRO value
function SetSRO(analog)
    local percent = analog/1*1.0+0.5 --calculate percentage
    local inst = mc.mcGetInstance()
    mc.mcSpindleSetOverride(inst, percent)
end

--Main body -
local device = "PoKeys57" --Change this to the name of your PoKeys device
local analogPin = "44" --Analog input pin number on PoKeys

analogVal = ReadRegister(device, analogPin) --Save analog register value in variable
SetSRO(analogVal) -- Set SRO value in %

This is my Feed Override, 0% to 250% to also match the Mach slider.

Code: [Select]
--Function to read value from analog register
function ReadRegister(device, analogPin)
    local inst = mc.mcGetInstance()
    local hreg = mc.mcRegGetHandle(inst, string.format("%s/Analog input %s", device, analogPin))
    return mc.mcRegGetValueString(hreg)
end

--Function to set FRO value
function SetFRO(analog)
    local percent = analog/1*250 --calculate percentage from 0% to 250%
    local inst = mc.mcGetInstance()
    mc.mcCntlSetFRO(inst, percent)
end

--Main
local device = "PoKeys57" --Change this to the name of your PoKeys device
local analogPin = "45" --Analog input pin number

analogVal = ReadRegister(device, analogPin) --Save analog register value in variable
SetFRO(analogVal) -- Set FRO value in %

Both of these are LUA files, stored, in my case, in the Mach4 Industrial directory and run with code in the PLC script, which runs the files every 50ms or whatever that interval is.

Here's the PLC script lines, way near the end.

Code: [Select]
-------------------------------------------------
--My Stuff!!
-------------------------------------------------
--Runs the PoKeys FRO and SRO lua files as shown!

dofile("C:\\Mach4Industrial\\PoKeys_analog_FRO.lua")
dofile("C:\\Mach4Industrial\\PoKeys_analog_SRO.lua")

--------------------------------------------------

--This is the last thing we do.  So keep it at the end of the script!
machStateOld = machState;
machWasEnabled = machEnabled;

Now, being old fashioned, I'd like the Rapid Override, 0% to 100%, to follow the Feed Override which is 0% to 250% with the one PoKeys Analog Input pot. Wonder if I can have two LUA files running, reading the same PoKeys Analog Input and moving two sliders? Or might it be better to have one file reading the input and updating two things? I had Mach3 doing this but don't remember how. Must have written Brains, eh?

It's always somethin', ain't it?  :o

Tom




304
Well, Craig, I can't get Matevž code to work. I get nothing from the pot using this:

Code: [Select]
--Function to read value from analog register
function ReadRegister(device, analogPin)
    local inst = mc.mcGetInstance()
    local hreg = mc.mcRegGetHandle(inst, string.format("%s/Analog input %s", device, analogPin))
    return mc.mcRegGetValueString(hreg)
end

--Function to set SRO value
function SetSRO(analog)
    local percent = 50+100*analog --calculate percentage
    --local percent = analog/40*60 --calculate percentage
    local inst = mc.mcGetInstance()
    mc.mcSpindleSetOverride(inst, percent)
end

--Main body -
local device = "PoKeys57" --Change this to the name of your PoKeys device
local analogPin = "44" --Analog input pin number on PoKeys

analogVal = ReadRegister(device, analogPin) --Save analog register value in variable
SetSRO(analogVal) -- Set SRO value in %

If I uncomment my old line and comment the 50+100*analog line, the pot works. With the 50+100*analog line it doesn't work AT ALL, no movement although the pot is working in Regfile.

So what's wrong with that line? I've tried all manner of spaces, nothing. Mathematically, that formula works, analog * 100 plus 50.

If you're using this, can you post up your actual lua file code so I can just try that to try and learn what's wrong with my code??

Tom

305
Thanks, Craig, I'll give that a go later today.

Stuart, I know about the Brackets part of the formula (!), not in My Dear Aunt Sally, but assumed (not THAT'LL get me!! Makes as ass of..........) That's how I got distracted trying to dope out the formula required to get 50% to 150%. Tried brackets and if brackets in LUA are normal parens, I couldn't seem to get it. Perhaps brackets of any type don't work like that here.....or brackets want to be square brackets or curly brackets? I guess not being a real programmer gets me stuck pretty easily. One thing I know, mental block or whatever, I could read thru VB script in Mach3 and dope it out, but with LUA, I'm having a harder time doing that, so my learning has been kind of halting!!! It's either mental block or old age, I don't remember which  >:D

306
Hey, thanks Craig.

I'll give that a go later today, I'm sure it'll work.

I guess it's simply the old My Dear Aunt Sally, multiply, divide, add, subtract!!! I couldn't logic it out even knowing that, it seems  >:(

I'll have to look into the filter value on the input. Where is that, in the PoKeys plugin settings or in Mach settings? I'll figure it out, I'm not at the machine just now. My spindle DOES seem to glitch a little, by the sound, with the pot working, but let me get the pot to 50% to 150% and see what I think. I actually disabled it figuring I'd just use the screen slider, once I heard the spindle glitch, or dither, or whatever it is/was. I'll play with that a bit.

Thanks for the help!

Tom

307
Did you guys ever figure this out some way other than the table way?

I have a PoKeys 57E. This is a lua file being run from the PLC script.

here is my code, and my analog pot works but goes DOWN to 0% and UP to 150%. Usable, but not perfect.
That 40*60 was derived by guess and by gosh!! Not the scientific method.


Code: [Select]
--Function to read value from analog register
function ReadRegister(device, analogPin)
    local inst = mc.mcGetInstance()
    local hreg = mc.mcRegGetHandle(inst, string.format("%s/Analog input %s", device, analogPin))
    return mc.mcRegGetValueString(hreg)
end

--Function to set SRO value
function SetSRO(analog)
    local percent = analog/40*60 --calculate percentage
    local inst = mc.mcGetInstance()
    mc.mcSpindleSetOverride(inst, percent)
end

--Main body -
local device = "PoKeys57" --Change this to the name of your PoKeys device
local analogPin = "44" --Analog input pin number on PoKeys

analogVal = ReadRegister(device, analogPin) --Save analog register value in variable
SetSRO(analogVal) -- Set SRO value in %

It seems the line that says:

local percent = analog/40*60 --calculate percentage

Should say something like:

local percent = analog/((1*100) +.5) --calculate percentage

Do the 0 to 100, add .5, inferred to in the post above, but it doesn't work. I've tried different ways of doing the math, but apparently I can't do that or there's another convention I haven't discovered.
I've tried:

local percent = analog/1*100+.5
local percent = .5 + analog/1*100
local percent = (.5) + (analog/1*100)

I probably have to do the math outside that line, but I tried a couple ways to do that and can't figure it out!!

I'm sure I'm missing some basic programming convention here, but.....I can't get it.

Any ideas?

Tom

308
Mach4 General Discussion / Re: Hobby/Industrial and Profiles
« on: March 21, 2017, 04:30:39 PM »
The problem here was solved with Andy from Warp9 and a Teamviewer session. He set my firewall settings by hand for industrial, his SCU configurator doesn't account for Mach4 Industrial.

And, we found my machine.ini did not make the transition for some reason. We manually copied the machine.ini from hobby to industrial and all was well.

Andy wasn't positive what actually fixed me, but it's been good since.

Here is the Warp9 forum thread for ref.

https://warp9td.com/index.php/kunena/7-general-discussion/6493-mach4-industrial

309
Mach4 General Discussion / Re: Mach 4 Touch button problems
« on: March 19, 2017, 09:45:43 AM »
It will be interesting to hear why changing the Screen Unload Script was necessary, and what about the code that was in the Screen Unload Script originally, the part about siglib? We don't need that, but do need this code to tell if the TouchOff dialog is open and close it?

OH, and where is the profile ini? I don't seem to have a profile ini on either of the two machines I have Mach4 installed on.

Just curiosity stuff, figured I could sort of hijack the thread seeing as the OP's issue was solved.  >:D

Tom H.

310
Mach4 General Discussion / Re: Single block mode
« on: March 12, 2017, 09:54:46 AM »
I forgot to mention, Bertho, and you may know to do this, but save our edited screen set to some other name so if you upgrade Mach4 it doesn't get overwritten.