Hello Guest it is April 19, 2024, 06:22:47 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 - OregonMike

Pages: 1
1
Mach4 General Discussion / Re: Macro will not jog mill
« on: November 25, 2023, 08:55:03 PM »
Thank you again.  I did exactly what you said and, of course, it worked.  Waiting for the idle state is something I totally missed.

I also see that this
   function Test_Clicked_Script(...)
       wait = coroutine.create(TestButton)
   end
(in addition to the function) was put into the ScreenScript.lua file which was much easier (and less risky) than me trying to put the code in a module.

2
Mach4 General Discussion / Re: Macro will not jog mill
« on: November 24, 2023, 05:29:02 PM »
Thank you.  I was reading some yesterday and ran into the coroutine.create as used in another part of Mach4 and sort of understood what it does.  I'll do this when I get home and can access Mach4.

3
Mach4 General Discussion / Re: Macro will not jog mill
« on: November 22, 2023, 06:33:04 PM »
I tried in vain to use "wait = coroutine.create(TestButton)".   Does it go in the "Clicked Script".  I can't find it in the screen or script manual.  Could you say a little more about how it is used, where it goes, or what manual it's in.  I don't mind reading them.

I can put "TestButton()" in for the "clicked script" and it finds the function in the Screen Load Script (I added it there).  The problem is that the axes do not get zeroed.  The machine jogs and the function goes to completion (the last line executes) without errors but these two lines do nothing.
     mc.mcAxisSetPos(inst, 0, 0)
     mc.mcAxisSetPos(inst, 1, 0)
The button does not find the function if it's in the modules directory and I do get an error that it's nil.

I would make a code window in the post as other do, if I knew how.  Sorry. 

The code-

function TestButton()
   --Move axis 1/2 bit diameter in X+ and Y+
   --Set current position as X and Y zero in work coordinates
   
   --Get bit diameter and set jog distance
   local strBitDiam = scr.GetProperty("JogToValue", "Value")
   local AxisJog = tonumber(strBitDiam) / 2
   local strAxisJog = tostring(AxisJog)
   
   -- Jog controller 0 in the X and Y axes;
   mc.mcJogIncStart(inst, 2, 1)
   mc.mcJogIncStart(inst, 0, AxisJog)
   mc.mcJogIncStart(inst, 1, AxisJog)
   
   --Put code in MDI to show step
   --This does execute
   scr.SetProperty("mdi1", "Value", "After jog")   
     
   -- Set local coordinates to zero for the X and Y axes
   --These do not execute, or at least values do not get zeroed.  No error returned. 
   mc.mcAxisSetPos(inst, 0, 0)
   mc.mcAxisSetPos(inst, 1, 0)
   
   --Put code in MDI to show step
   --This does execute
   scr.SetProperty("mdi1", "Value", "After zeroing")       
 
end


4
Mach4 General Discussion / Re: Macro will not jog mill
« on: November 22, 2023, 09:50:03 AM »
Thank you, Bill.  I have done that manually for years, typing the 1/2-bit-diameter into the MDI and zeroing with mouse clicks.

Since my post I did add a button with script to read the bit diameter (0.5 in this example) from a text box and write the following to the MDI
G0 Z1
G0 X0.25 Y0.25
m1250()
When executed, the machine moves and the call to m1250 runs this code to reset the local coordinates.
mc.mcAxisSetPos(0, 0, 0)
mc.mcAxisSetPos(0, 1, 0)
I could have written G90 to the MDI instead of m1250(), but the local coordinates would change back if a G90.1 ever got into the Gcode.

What I would like to do is get the whole thing to work from the button.  I think a module is the way to do this, but I haven't got any code to run in a module for the button (even though the scripting manual makes it sound easy).

Bill - I think you answered a question on soft limits override for me about a year ago and said the override just didn't work.  Support agreed.  The override does work now in the current version of Mach4.

5
Mach4 General Discussion / Re: Macro will not jog mill
« on: November 21, 2023, 11:36:17 AM »
CntlGcodeExecute and CntlGcodeExecuteWait will not compile (pasted at end of post) into the m1250 file described above.
Suggestions?

Is there another jog command that might work in a macro in the profile\...macros directory??

Does this code need to be located somewhere else so jog commands can be executed?  m1250 gets called from the MDI okay, but it seems like the mcJogIncStart and CntlGcodeExecute can't be found when they are called from m1250.


-- Jog controller 0 in the X and Y axes.
   -- mc.mcJogIncStart(0, 0, AxisJog)
   -- mc.mcJogIncStart(0, 1, AxisJog)
   mc.mcCntlGcodeExecute(inst, “G00 X0.125 Y0.125” ) 
   -- mc.mcCntlGcodeExecuteWait(inst, “G00 X0.125 Y0.125” )

Can't start debugging for 'C:\Mach4Hobby\Profiles\Mach4Router\Macros\m1250.mcs'. Compilation error:
m1250.mcs:9: unexpected symbol near '<\226>'
Program stopped (pid: 14244).

6
Mach4 General Discussion / Macro will not jog mill
« on: November 20, 2023, 02:09:46 PM »
It's my first Lua attempt, and a macro looked less challenging than a Lua panel.  I to code this -

After homing, I use the bit like an edge finder (turning it manually as I jog) and set the X and Y zero.  I then jog X and Y by 1/2 the bit diameter using the MDI (hopefully after raising the Z) and zero Z and Y again.  I verify that the cutter is centered over the corner of the workpiece. 

When I step through this code in the debugger, it works.  The axes jog and the work coordinates are zeroed.

function m1250()
   local inst = mc.mcGetInstance()
   local AxisJog = .125
   -- Jog controller 0 in the X and Y axes.
      mc.mcJogIncStart(0, 0, AxisJog)
      mc.mcJogIncStart(0, 1, AxisJog)
   -- Set the position of the X axis by changing the fixture offset.
      mc.mcAxisSetPos(0, 0, 0)
      mc.mcAxisSetPos(0, 1, 0)
end

if (mc.mcInEditor() == 1) then
   m1250()
end

When I run this from the MDI (m1250) on the CNC (or the Mach4-Demo), the coordinates zero, but the machine does not jog.
I think this tells me the macro is being compiled.  It is enabled.

I have deleted the mcLua.mcc file and restarted Mach4.

I suspect this has something to do with the Mach4 core versus the GUI, but I'm at a loss.

Can anyone suggest how to make the jog command work?

Thank you in advance for suggestions.


(I would guess the work coordinates could be changed without jogging, but I would like to move the machine to the new (0,0) to get visual confirmation.)

7
Mach4 General Discussion / Re: Issues after reinstall of Mach4
« on: July 11, 2023, 10:24:41 AM »
All issues were resolved with another reinstall of Mach4.

8
Mach4 General Discussion / Issues after reinstall of Mach4
« on: July 09, 2023, 01:15:52 AM »
My router ran flawlessly for two years.  Recently I had an issue with the tool path tool path progress stopping when Gcode was loaded.  Tech support could not resolve it and suggested a reinstall.  I reinstalled (v4300 to v5036), put all the settings back, and here are my issues.

Mach4 stops when executing a line with G90, G91, or G94.  G90.1 and G91.1 cause no problems.  Same results with the MDI.   Any ideas why they won't execute? These are common commands.   After removing them, I let the machine cut air for several minutes (with my mouse over the stop button) and it appeared to work fine except ...

Here's a bigger mystery to me.  The Z and Y axes move correctly.  When the X-axis is instructed to move 10 inches, the displayed machine coordinates change by 10 inches.  However, the displayed work coordinates change by about 15 inches and the actual motion is about 7 inches (appears to be a reciprocal relationship).  I have an x-soft limit set at 29 inches and could move the WCS X past 44 inches (at which point the machine coordinate was almost 29).  If the motor counts per unit (which I checked) were off in the setup, I would expect both coordinate systems to be wrong.  How can the displayed work coordinates move a different amount from the machine coordinates?  What do I check to resolve this?  I have no idea what to check.

Lastly, my estimated tool path does not appear in the tool path window nor do the soft limits.  I have not tried to solve this issue other than to do a few clicks.  I think that the first two issues might be related to this. 

I have a Pokeys57cnc control board connected by ethernet.

Thank you for any suggestions.

9
General Mach Discussion / Re: Mach3 Ref All Homing gets hung up
« on: April 23, 2023, 01:23:38 PM »
Nobody may read this, but here was my experience with, I think, a similar problem.

The Z limit switch (first axis homed) appeared to work fine when I put an ohm meter on it and depress it with my finger.  However, if I depress the switch until it clicks but not any further, the closed/open state is not reliable.  The resistance across the switch is highly variable when it is closed but almost open.

When homing, the machine travels to the switch, closes it, reverses direction until it opens, then stops.  The machine is in the unreliable position (after the click but no further) when it stops to reverse.  Sometimes a false open resistance causes the machine to stop before it travels back far enough to fully open the switch.  Other times the resistance is such that the machine continues with homing but eventually the cnc senses it as closed and shuts down due to a limit error.  This can occur anytime while the other axes are homing until the gantry is moved away from the switch causing it to fully open.  The randomness of the problem made it hard to troubleshoot.

Put an ohm meter on the limit switch and depress it very slowly.  Stop as soon as it clicks and see if it is truly changes state and holds it.  Going the other way, fully depress the switch and slowly release it to see if the resistance changes prior to the click.

10
Mach4 General Discussion / Re: Won't generate tool paths
« on: March 25, 2023, 01:43:35 PM »
I know the thread is old, but I started having this problem with every new gcode file I created after about March 10.  All my pre-March files load into Mach-4 Hobby just fine.   I use Fusion360 to make the g-code. 

Does anyone know if something changed in Fusion360?  If so, do I fix the problem by changing a setting in Fusion or in Mach4.  My Mach4 version is about 2-3 years old.

Thanks for any help.

Pages: 1