Hello Guest it is April 25, 2024, 11:47:58 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.


Topics - dbt3000files

Pages: « 1 2 3 »
11
Mach4 General Discussion / New to jogging/ non g-code moves
« on: January 30, 2020, 10:34:23 PM »
I am working on a sanding machine, and I want to be able to move away from the sanding surface quickly if I get an overload signal from the sanding motor.
I was thinking if I make each pass as a jog with the y axis, the z axis could be operated independently and moved away from the surface of the part while the y axis was still moving.

I was trying to test the  mc.mcJogIncStart function with the following code:

function m91002()
   local inst = mc.mcGetInstance()
   rc = mc.mcJogIncStart(inst, 0, -.2)
   if rc ~= mc.MERROR_NOERROR then
      wx.wxMessageBox("failure")
   end
end

I get the message "failure" when I run m91002 in the MDI, but if I remove the "function m91002()" at the beginning of the code, it works one time.
Any ideas about what I am missing or doing wrong? Also if anyone feels that there is a better way to go about this, I'm all ears!
Thanks,
David


12
Mach4 General Discussion / Screen editor bugs
« on: October 30, 2019, 01:43:20 PM »
Hey everyone.  Let me know if there is a more appropriate thread to post this to, but I have some solutions to some of the button script bugs people may have been experiencing.

In order for the scripts to lock in, only add one button at a time.
Exit the screen editor, check your button, restart Mach4 and check the button again.  If the button was working before restart but not after, go into the screen editor, copy the button, paste the copy, and then delete the copy.  Repeat the process, testing the button before and after restarting Mach4.  Usually it only takes round of this process.
The worst thing you can do is try to add multiple buttons during one screen editing session.  Personally I have mostly experienced these problems when dealing with scripts that write to the RegFile but sometimes other scripts behave strangely. 
Once your button works after a restart of Mach4, it seems to be good forever.

Hope that helps!


13
Mach4 General Discussion / trouble with mc.mcaxisisstill
« on: January 28, 2019, 12:21:17 PM »
I want to have Mach4 check an output from a clearpath motor every time the axis associated with that motor is moving.  I thought using mc.mcaxisisstill would be the way to do that, but it seems to be returning a positive result whether the axis is moving or not.  Any ideas what I might be doing wrong??
Here's a test code that I was using:

    local inst = mc.mcGetInstance()
    local still
    local rc
    local gcode = ""
    gcode = gcode .. ("g0 x-2\n")
    gcode = gcode .. ("g0 x0\n")
    mc.mcCntlGcodeExecute(inst, gcode)
    wx.wxMilliSleep(400)
    still, rc = mc.mcAxisIsStill(inst, 0)
    wx.wxMessageBox(tostring(still))
    if rc ~= mc.MERROR_NOERROR then
        wx.wxMessageBox("error")
    end

14
Mach4 General Discussion / mcCntlGcodeExecute best practice
« on: January 26, 2019, 04:05:03 PM »
Does anyone know if there is a way to check on the status of a gcode execution?  I have been using mc.mcCntlGcodeExecuteWait with no issues, but I want to be able to check the state of an input while the gcode is being run and then wait until it is done to move on to the next line of Lua. I am assuming that I can use mcCntlGcodeExecute to do this, but I can't figure out how to know when it is done.

Thanks,
David

15
Mach4 General Discussion / Macro keeps running after estop!
« on: November 17, 2018, 12:44:03 PM »
Hey everybody, I know this is very similar to a post I just made, but a little more perplexing. I just experienced a pretty bad crash because a macro continued running after the machine was disabled and raised a clamp jaw into a still moving spindle.

So a wood chip broke off of a part and got wedged into one of the slides, and blocked a Clearpath motor causing it trigger a "limit switch" event in Mach4. Everything good there.
The problem is, that the macro that was currently controlling everything continued running even though the machine was disabled. Although the machine was ignoring any motion commands, it still was able to operate the outputs, and did just that, opening a clamp jaw in the wrong position into a spindle that was still spooling down.

I now realize that I should have had the output pins set to be forced low in a disable condition, and had overlooked that when setting up Mach4. That would have prevented the crash, but I still would like to be able to prevent a macro from continuing in the event of a machine disable. It seems like this would be the default, but maybe there is some setting that I need to change?
If not, does anyone have any suggestions for building something into the code that would solve this problem?
Thanks for any help!
David

16
Mach4 General Discussion / terminate lua script
« on: November 13, 2018, 10:48:24 PM »
Does anyone know the best way to terminate a lua script or macro?

I have been using "do return end", but I have run into a problem.  If I run "do return end" from within a function it will end that function but not the entire macro script.

For example:
In a file called macrofunctions I could have the following:

function whatIwanttosay()
   wx.wxmessagebox("good to see you") 
   do return end    --end script so nothing else is said (this is what I was hoping I could use to stop the entire program)
end

function whatIamthinking()
   wx.wxmessagebox("looks like you gained a few pounds")
end

My macro would be:

function m90001()
   whatIwanttosay()
   whatIamthinking()
end

The do return end at the end of the function whatIwanttosay() does nothing to prevent the macro from calling the next function.  Is there a way to end an entire macro from within a function?  If not, I am wondering what is considered best practice for ending a script. 
I realize that I could have each function return a number and I could check for that number before running any further functions, but it doesn't seem like a very elegant solution.  I have quite a few nested functions, and the whole thing becomes a mess if I have to query each one to see if it has completed before continuing.

Thanks for any help!!
David


17
Mach4 General Discussion / configure menu greyed out!
« on: July 28, 2018, 01:13:37 PM »
I turned on the computer this morning and the configure menu and the edit screen options in Mach4 are greyed out.  Normally as long as Mach4 is not enabled, I am able to access these. Everything else seems to work fine, but I can't make any changes to anything. It is as if Mach4 thinks that it is enabled when it is not.  I have tried opening it without anything plugged into the computer (ess) and I get the same results.
Anybody have any ideas??!!
Thanks

18
Mach4 General Discussion / Ideas for running conditional programs
« on: May 23, 2018, 10:13:08 PM »
Hi everybody. I am working on writing a program for reloading a part in a machine in the case of an error.

I'll just give a little background info so this makes sense. I am making parts with bamboo as the raw material and a pick and place system that loads the bamboo.  Because the bamboo shape and size is extremely variable, it is impossible to avoid the occasional loss of a part from the fixture while it is being machined.

The obvious solution to me is to create a macro that does a quick diagnostic check, loads another piece, and starts the program again.  The tricky part, is that I'd like to control how many pieces are being machined. If there is a loss at 50 out of 100 pieces, the macro will restart the program and I'll end up with 50 more pieces than I intended.
I have thought about doing the entire program inside of a macro, but that doesn't seem like a very elegant solution.

I'd love to hear anyone's advice about this subject and hopefully it will be of some help to others.

David

19
Mach4 General Discussion / editing feed and speed wizard?
« on: April 30, 2018, 03:11:02 PM »
I would like to get into the lua code for the speed and feed wizard so I can see how the tabs and tables are laid out, but when I open it in the Lua editor, all I see is one bit of code:

EscLuaR.

Does anyone know how to see the code for this file?
Thanks,
David

20
Mach4 General Discussion / macro for Reference All Axes
« on: January 05, 2018, 05:44:14 PM »
I'm having trouble creating a macro that will reliably do the same thing as the "Reference All Axes" button.  The following works every time in the Lua editor:

function reference_all()
    inst = mc.mcGetInstance()
    mc.mcAxisHomeAll(inst)
end

reference_all()

However, if I create following macro it works great in the Lua editor, but when I run it as an m code, nothing happens.

function m91048()
    reference_all()
end

I figure that it has something to do with the "Reference All Axes" button using a coroutine, but I am not sure how to get a macro coroutine to communicate with the plc. (or if that is even the right approach) Just looking for the simplest way to get the m code to work the same way as it does running it from the Lua editor.

Thanks for any help!

p.s.
I will add a little more background information in case it helps.  I am trying to create a homing routine for Clearpath motors that have hardstop homing.  (meaning that you run the axis into a wall and the motor senses the resistance and stops itself) So I am hardstopping the axes, backing off a preset amount and then need to zero all the axes. With Mach4 set to "home in place" G28.1 causes strange and erratic behavior, either crashing Mach4 or wildly jerking the motors, so I need a good alternative.

Pages: « 1 2 3 »