Hello Guest it is April 27, 2024, 08:14:09 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 - Screwie Louie

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 »
151
config file ... something in your configuration status that you used to reference in one or your registers or vice versa or something about your configuration was pointing to your register and it is not there anymore returning a false status. maybe? I've installed & reinstalled mach 4 so much that i just copy my license and profile -> uninstall -> reinstall -> and configure within 10minutes. That's the efficiency I get for playing around in the screen start up and PLC scripts. haha! Honestly, I have no clue what that error is. Just a guess on my part about "pointing" to a false value or a value that is returning a false or nil status.

 could be  some type of index that is trying to point to a "key" that had a value of a field in your configuration or startup file which used to be in your register plug-in which you deleted....did you have a table referenced in your register file? your guess is as good as mine...Lua is all about index's that are also known as keys are assigned values in a table or array.

for example: the key "distance mode" = "incremental" and "control mode" = "mill"

index=1    key = distance mode      value = incremental
index=2    key = control mode        value = mill

if you had a table and deleted it but some code is still trying to pull index#2 of  a mystery table that does not exist there would be no key to reference and return an nil or '0' value.

fml, i just totally went down the rabbit hole with this.

152
Hi Dan.

yah, I've dove into it. It is a wonderful insight on how we can create user tables, save and clear current data -> execute our tool change at our own defined position -> recall our work offset position, G54, axis coord, etc prior to tool change data, and begin working again, etc. Same familiar concept; just in a new language. The code is fast. I mean really fast and with Lua we get an easy & customizable user interface that we can tailor to our liking or program for our specific requirements. (Now, think of industry...requirements generation, the specific knowledge to comprehend, understand, and program cnc machines to achieve those results. I am not talking video games now. I am talking about physical material being manipulated into what is required for a specific function for a capability for the masses. What Mach4 allows us is a base / core / platform to create a package for industry that is tailored to their specific needs. They had to do this because of competitive markets, competition, and not to mention it is just a smart move in order to grab a market share of industry. That is the beauty of it! For the hobby user, the hobbyist can write a macro or two and sell it for $1-$5 maybe to the general public through paypal and instant download. "Hey Mach 3 had this function, I like this function. Where is this function? What...? I need to learn coding? Forget that. I can afford $3 to get my function back"...So now Mach 4 has given opportunity to hobbyists to offer their time and effort for programming CNC functions...that through the Mach4 platform and motion control devices should give you exceptionally better real time response. Does this matter to the hobbyist? Maybe, maybe not. Hey I like it. But for industry, this is huge. This is not Haas and proprietary software. Mach4 is a platform tailored to execute several axes of machines, at the same time, in different coordinate planes to reduce time and cost and improve efficiencies that is truly affordable. You know what's funny? We are talking about Lua wx libraries for user interfaces that were created in 2002, Lua which has been a popular user interface programming language for a decade, and a CNC software platform that has been in Beta testing for three years.

(Scripting manual...that is pretty cool, gotta read line by line very carefully. It really is about merging Gcode and Lua together, basically the same thing as Mach3 did with Visual Basic)

(see Mach 4 customization manual...ya, where is that? ...and the appendices? lol! The dog must of ate Art and Brian's homework. I think the customization manual is just referring to the wx library that is C++ and GUI, hence wxLua or a lot f the screen calls (user interface object like programming...think point and click vs. cmd line entry; for example wx.wxMessageBox "enter your text here" and a dialog box appears which data that you want to see for step debugging variables or processes with fast response)

my hardware...Its small. haha! now that's funny  :D I just have benchtop mill that I put together along with making the controller box from scratch. just a project like I think many of us do as hobbyists with a thirst for "How is that made?" "How do they do that?" ...and then, the potential in which you start doing what you love to do and your hobby starts to provide financial income and stability. Hat's off to those who have made it happen. I'm jealous.

153
one more thing....yep, about the third way...

it may seem cleaner and neater but you need to know...

what if you had 1,000,000 things to look at?
what if you you needed the value of myCounter again for another function?
what if you needed to query the number of another value?...will you cycle through a whole table again to get your answer from number 1 in sequential order? I hope not. (think, web traffic, or lines of Gcode, esp. contour milling).

There is a post by TimGS about binary tree or hash table searching...and then it died. Guess what.?.?...He is right! It is called Discrete Mathematics. I applaud you Mr. Tim.

154
from the first post...j=j-1 -- because the whole '0' thing about being the first instance in a stack / array, etc., whereas '0' or Zero is a number!

but...Lua does not recognize the first key indexed as '0' but '1'.

So what? What does this mean to you? Well....if you are running a loop, you can start with i =1 and Lua will return the first instance. C++ and other languages like to start with '0'...just keep that in the back of your head when doing counters, loops, iterations, etc.

again, so what? tables, man...tables   indexing and pulling values like in milliseconds with Mach4 being off by '1'unit is not good. It is NOT mach4's fault but the macro programmer's fault (or micro programmer,lol!, it may be our own fault if we just copy and paste and not logically understand the sequence of events. BECAUSE we are manipulating one programming language as function calls and variable pointers to another (Lua -> Gcode...or C++ to machine code, or Lua -> C+++ -> machine code -> bits bytes and lions and tigers and bears oh my! barf.) Let me break it down...what's our standard? how about 0.0001? Now you see how much '1' unit, key or value, or instance can affect the outcome of your efforts and not achieve your desired endstate? not to mention the cost of time an money through trial and error...(but it can be fun, trial and error that is. I think that's called experience (not necessarily old age, ha!)))(I don't know how many parenthesis's I just used here?.?.?.)

idk, this is kinda fun. I actually get to program a sequence and watch physical objects move in space and time....oh wait, that's robotics...haha! yep. ok, one too many drinks for me tonite!

-josh

155
better yet, how do you delete your own posts? I talk to much on here...

156
workingAutoToolSet() => work in progress!!!! arghhh.....bad way to name a function, how do you edit your own posts? I don't want to confuse anyone.

157
before you try it....that is just the start of an auto tool zero function. The code written only tells the Z axis to start jogging at a specific rate in a specific direction until it comes in contact with the tool setter, table, or top of material. The stop jogging command is triggered by my input signal through a conditional ~loop.

this is just one step in the process. one block sorta say. I can execute Gcode and move around in a button script. what I cannot do is execute Gcode and have my probe trigger a mc.FileHoldAcquire, or feedhold and any kind of stop movement command. I can only achieve this by using jogging commands and using time with a conditional loop to stop movement because I do not have the capability to utilize G31.

158
thanx for sharing! I've seen you post that earlier. My motion device doesn't support G31 probing commands yet.....hence trying to find a work around. I liked your reference in the bug report pointing to another thread about mcCntlGcodeExecute vs. mcCntlGcodeExecuteWait vs. mcCntlMdiExecute. It help shed some light on the applicability of when to use each function call depending on the circumstance.

159
--yep figured it out using conditional repeat/until structure as a timer based on a false signal condition, break when true

--only destroyed both my digital probe and tool setter in the process. The cost of having fun.

--this way I can start a jogging / probing routine without G31, now onto the easy stuff. the more I realize the more I think Lua was used just to create a series of function calls and variables that are just mapped Gcode blocks inside those functions and the variables are are mapped to #var, the power of G65/G66. Ok, I'm just talking to myself now.


function workingAutoToolSet ()

local mInst = 0
local rc = 0
local inst = mc.mcGetInstance (mInst)
local gCode = ""

local hSig = mc.mcSignalGetHandle (inst, mc.ISIG_INPUT0)


mc.mcCntlEnable (inst, 1)
mc.mcJogSetRate (inst, 2, 10)
mc.mcJogVelocityStart (inst, 2, -3)


repeat mc.mcCntlSetLastError (inst, "Approaching tool setter")
    until mc.mcSignalGetState (hSig) == 1; mc.mcJogVelocityStop (inst, 2)

end

--[[
gCode = "G0 G28 Z0.0\nG1 G53 Z-4.0 F5.0\n"
mc.mcCntlMdiExecute (inst, gCode)

end
if mc.mcInEditor () == 1 then workingAutoToolSet() end
--]]

160
--another way--


function autoSoftLimitsOn ()
    local mInst = 0
    local rc = 0
    local inst = mc.mcGetInstance (mInst)

    for i=0, 11 do
        if mc.mcAxisIsEnabled (inst,i) == 1 then mc.mcSoftLimitSetState (inst,i,1) end
    end
end
autoSoftLimitsOn()


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