Hello Guest it is March 18, 2024, 10:31:39 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 - jevs

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 »
121
Based on that second video, should I be putting this at the beginning of everything I work on?

Code: [Select]
if mc.mcInEditor() == 1 then
   dofile("ScreenScript.lua")
end

122
Great! I will watch those now before moving forward. Thanks.

However, I think I kinda have the hang of it now. It has been working for me. Part of my problem is just not knowing how to format the code correctly from the miserable API help. It has the info you need, just not the exact syntax to know how to use it. I am sure this is clear to people that already know...but tough for a new person that is not a programmer.
My code was hanging the debugger as part of my problem, It could not compile...now I just comment out anything new when it does not work to see if that is what is doing it...

I am just stuck on how to use the code information I can find in the API help now...flooding the board with questions, but I am not sure how else to get through this. No way I am going to be as far as I had hoped after working on this for a weeks worth of free time, even giving up on sleeping :(

It is getting there though....thanks for the help.

I am surprised there is hardly any scripts to be found on the internet being shared. I am yet to find a single M6 script for an ATC.....this would help a lot. I am just trying to make it up from scratch.

123
Mach4 General Discussion / How to stop the spindle motor in M6 script?
« on: August 04, 2019, 04:54:59 PM »
I believe I need to use mcSpindleSetCommandRPM, however, the cryptic way the API help is written it never just tells you exactly what code to use. So how do I turn this information into something that actually works?
This does not work:
Code: [Select]
rc = mc.mcSpindleSetCommandRPM (inst, 0)and neither does this:
Code: [Select]
int rc = mcSpindleSetCommandRPM(inst, 0)


 mcSpindleSetCommandRPM
C/C++ Syntax:
int mcSpindleSetCommandRPM(
      MINSTANCE mInst,
      double RPM);

LUA Syntax:
rc = mc.mcSpindleSetCommandRPM(
      number mInst,
      number RPM)

Description:
Set the commanded RPM for the spindle.

Parameters: Parameter Description
mInst The controller instance.
RPM A double specifying the RPM.


Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.

Notes:
None.

Usage:

// Set the spindle RPM to 5000.
MINSTANCE mInst = 0;
int rc = mcSpindleSetCommandRPM(mInst, 5000);


124
I am researching this while seeing if there is a response here. It seems like maybe I need to put in Accell and Decel times that would be enough to allow it to reach full speed or come to zero from full speed?
Maybe I can open up mach3 and find the settings in there that I used for this....

One thing I cannot find in the manual is what "Spindle Override Delay:" does.
Mine is set to 25ms, but I am not sure what this does and it does not seem to be in the manual that I have found so far.

125
Do I need to turn it off in the M6 script?
If so, how do I make sure it is stopped before it tries to release the tool and make the change?
I do not have a spindle encoder. It runs off a VFD connected to 0-10V output and CW CCW relays from the BOB.

I do not see anything in my Mach3 M6 script that did this, and I don't recall what happens or how it knew not to start the change without the spindle stopping first. I can only guess I somehow it knew to turn off the spindle and then wait a certain amount of time that would allow it to stop from it's highest RPM....it has been too long.
 

126
This is already a big help! Now I got one thing working. Using the debugger is so much faster...

127
Hi,

Quote
If you start the debugger (green arrow) then it ends up putting a green arrow next to the first line that is not a comment. Nothing in there has a value.

The green arrow shows that this is the next instruction to be executed, it has not been executed yet and so the variable may well
be undefined. What you need to do is single-step through the code, that is DON'T push the green arrow again but F11.
Once the line has been executed then hover on the variable.

Craig

Ahh, that helps. I figured there should be a way to step through one line at a time without adding a bunch of red balls which still skips stuff.....thanks.
You can see where a tutorial video would help someone that knows so little :)

Do you know where I might find an M6 for an ATC with a tool height touch plate? If I could see some code rather than trying to reinvent it from scratch it would be much faster. I am doing stuff now that I do not know if it is even needed. Just trying to mimic my old VB script from Mach3, but I did not have a touch plate to set tool heights then. Part of why I am switching to mach4 is so I can have more than one probe input (3D and tool height) without trying to put them in series on the same input. This is not as nice because then you have to short the input jack on the 3d probe or the touch plate won't work when it is detached (NC probes).

128
I still get nil where I think there should be a value....not sure. I am learning a little here by trial and error though (which is not the fastest way) :)

I commented out my bad code that was stopping the debugger from loading and running. I wish they would give the exact way to do things in the API help instead of giving you a basic idea that you have to figure out what to add or change to make it work....


129
I think I am starting to figure this out....I wish there was a video tutorial though.
I cannot get the debugger to run on my stuff. I just get an error.

However, I loaded up a lua example from the mach4 directory to try to figure out how it works.
I guess I need to put a red ball everywhere I want the debugger to stop and then F5 moves it to the next red ball. Then I can hover over things and get a value.

If you start the debugger (green arrow) then it ends up putting a green arrow next to the first line that is not a comment. Nothing in there has a value. If you hit the green arrow again, it just seems to exit the debugger. So, I assume you have to put a red ball on the lines to make it stop without exiting? It will not stop on every line though, so I guess it can only stop at certain places in the code depending on what the code is.


130
I must be doing something wrong because I get nil for everything.
Code: [Select]
function m6()

local inst = mc.mcGetInstance()
local selectedTool = mc.mcToolGetSelected(inst) --Gets selected tool
selectedTool = math.tointeger(selectedTool) --Converts selected tool to integer
local currentTool = mc.mcToolGetCurrent(inst) --Gets currently loaded tool
currentTool = math.tointeger(currentTool) --Converts currenlty loaded tool to integer

Shouldn't I be able to get a value at least for the current tool? It has a current tool on the screen. Somehow I think the editor and mach are not in communication at this point.
I never get any values by hovering over anything in the screen load script or anywhere else either and selecting evaluate in console give nil on everything.
So, I am not sure what I have wrong.

About from the editor:
ZeroBrane Studio (devel; MobDebug 0.702)
Copyright © 2011-2017 ZeroBrane LLC
Paul Kulchenko
Licensed under the MIT License.
Based on Estrela Editor
Copyright © 2008-2011 Luxinia DevTeam
Christoph Kubisch, Eike Decker
Licensed under the MIT License.

Based on wxLua editor
Copyright © 2002-2005 Lomtick Software
J. Winwood, John Labenski
Licensed under wxWindows Library License, v3.
Built with wxWidgets 3.1.1, wxLua 2.8.12.3

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 »