Hello Guest it is March 02, 2024, 12:19:11 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.

Topics - Bx3mE

Pages: 1
Mach4 General Discussion / Mysterious signal set when probe fails ESS + G31
« on: February 06, 2021, 07:35:28 PM »
I am using the X360 plugin to control my machine and have implemented a button to execute a probe move.

If the button is pressed  i run mc.mcCntlGcodeExecuteWait("G31 X-5 F20")
if i dont strike any target, pressing the button again thus executing mc.mcCntlGcodeExecuteWait("G31 X-5 F20") again does not start a probe move.
If it strikes the first time running it a second time is no problem...

Before running any GCode in the script i check various signals and make sure the machine is up for the task by checking IsInCycle, Is Enabled, Get signal state for Idle etc. which works great but none of these indicate that the machine is in any different state than before pressing the button the the first time. I suspect that i have missed someting but i dont know where to start looking.

Which variables and signals are set different when comparing a mc.mcCntlGcodeExecuteWait("G31 X-5 F20") move which strikes and one that does not strike?

Mach4 General Discussion / How to use the TouchOff UI with TLO
« on: February 03, 2021, 01:28:40 PM »
When I set up my machine for a job i measure the current tool Using the a modified version of the posted script you see here: https://www.machsupport.com/forum/index.php?topic=44258.new#new

Looking at the Diagnostics page my TLO has been set. Next i Use the TouchOff UI to set my fixture offsets.
Using the "find Z" function i touch off the surface.

After this I´d expect the DRO to read Z: 0.0000 but instead it reads 50.0530 which is my TLO!
TLO for the selected tool is enabled when using "find Z" so I expect the Find Z function to account for that or atleast have an option for this...

Am I doing this wrong?

My problem is that when i press "Zero Y" the dro changes its value from the current value to 570.000, 575 or a random (to me) position after restarting mach4.

Steps to reproduce:
Turn on and enable the machine.
Ref. All Home
- I have a custom script see below RefAllHomeWithOffset()
press Zero X (or Zero Y or Zero Z) one of them will fail with this wired behaviour.

The value changes if i run my M6 Script. Machine coordinates are still correct.

I have a PMDX-126 and a Warp9td ESS.
I Run Windows 10 Pro version 20H2
Mach Version is 4.2.0 build 4574
I completly rebuilt my machine and started with a new profile based on the Mach4Mill Profile.

I tried to find where the actions are defined but can not find any information in the API Documentation or in the scripting or Operation manuals.
If i change the button to just run the RefAllHomeWithOffset() without creating a coroutine and remove all Yield commands it homes but does not execute any gcode. Zero Y behaviour is still setting the DRO to 570.0000 or 575.0000
The only place where i can remember using this value (570.0000) is in the RefAllHomeWithOffset script.

Here are my scripts:
ScreenLoad additions:

-- Set Soft Limits () function.
function SetSoftLimits(inst, state)  -- legal params = 0 and 1.
    --local inst = mc.mcGetInstance (mInst)
    for i=0, (11) do
        if mc.mcAxisIsEnabled (inst,i) == 1 and state == 1
then mc.mcSoftLimitSetState (inst,i,1) end
if mc.mcAxisIsEnabled (inst,i) == 1 and state == 0
then mc.mcSoftLimitSetState (inst,i,0) end
-- Ref All Home With Offset() function.
function RefAllHomeWithOffset()

    coroutine.yield() --yield coroutine so we can do the following after motion stops
    mc.mcCntlGcodeExecuteWait(inst, "G92 X-5 Y575 Z5")
    wx.wxMessageBox('Referencing is complete')
    mc.mcCntlGcodeExecuteWait(inst, "G1 X0 Y570 Z0 F2000")


m6 Script:
function m6()
local inst = mc.mcGetInstance()
if mc.mcAxisIsHomed(inst, 0) and mc.mcAxisIsHomed(inst, 1) and mc.mcAxisIsHomed(inst, 2) and mc.mcAxisIsHomed(inst, 3) then
local changeToTool = mc.mcToolGetSelected(inst)
local changeFromTool = mc.mcToolGetCurrent(inst)
local XPositionBeforeToolChange = mc.mcAxisGetPos(inst,0)
local YPositionBeforeToolChange = mc.mcAxisGetPos(inst,1)
local XToolProbePosition = "17.0"
local YToolProbePosition = "0.3"
local XManualToolChangePosition = "17.0"
local YManualToolChangePosition = "0.3"
local ColletAtProbeZCoordinate = -248 -- Machine Z-coordinate when collet tip touches TouchPlate (Must be more than ProbeOperationDistance - DefaultToolLength
local ExtraProbeDistance = 15 -- SafetyMargin
local ProbeOperationDistance = -30 -- Length of Probemove before giving up
local ProbePrepSpeed = 750
local ProbeSpeed = 100
local DefaultToolLength = 70 -- Used if tool info is not found. (Should be a value slightly longer than the longest tool in the shop :D)
-- G90 - Absolute (Go to coordinate)
-- G91 - Incremental (Godistance along axis from current position)
-- G53 - Machine Coordinate Move
wx.wxMessageBox("ToolChange from T"..changeFromTool.." to T"..changeToTool.." Press OK to run M6 cript")
if changeToTool == changeFromTool then
mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0\nM5" )
local ToolZCoordinate = mc.mcAxisGetPos(inst,2)
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0 \n G90 G53 G0 X"..XManualToolChangePosition.." Y"..YManualToolChangePosition)
local changeToToolDescription = mc.mcToolGetDesc(inst,changeToTool)
wx.wxMessageBox("Please change to tool number "..changeToTool.." "..changeToToolDescription.." and press ok to continue")
mc.mcAxisSetPos(inst, 2 , ToolZCoordinate)
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
mc.mcCntlGcodeExecuteWait(inst,"G90 G0 X"..XPositionBeforeToolChange.." Y"..YPositionBeforeToolChange)
mc.mcToolSetCurrent(inst, changeToTool)
wx.wxMessageBox("If Toolchange was Sucessful - click ok to continue")
mc.mcCntlSetLastError(inst, "ToolChange Finished")
wx.wxMessageBox("M6 Toolchange can not run Machine is not Referenced to home. All operations should be aborted!!!")

function RunProbe(finst,ftool,fXToolProbePosition,fYToolProbePosition,fDefaultToolLength,fColletAtProbeZCoordinate,fExtraProbeDistance,fProbePrepSpeed,fProbeSpeed,fProbeOperationDistance)
    mc.mcCntlGcodeExecuteWait(finst, "G90 G53 G0 X"..fXToolProbePosition.." Y"..fYToolProbePosition)
    local toollen = mc.mcToolGetData(finst, mc.MTOOL_MILL_HEIGHT, ftool)
    if toollen == 0 then
        toollen = fDefaultToolLength
        mc.mcCntlSetLastError(finst, "Tool length not found - using Default Length")
    local probestart = fColletAtProbeZCoordinate + fExtraProbeDistance + toollen
    local GCODE = "G91 G31 G0 Z"..probestart.." F"..fProbePrepSpeed
    GCODE = ""..GCODE.." \n G91 G0 Z1 F"..fProbePrepSpeed.." \n G91 G31 Z"..fProbeOperationDistance.." F"..fProbeSpeed

function M6SetSoftLimits(inst, state)  -- legal params = 0 and 1. They are the X and Y extents
    --local inst = mc.mcGetInstance (mInst)
    for i=0, (11) do
        if mc.mcAxisIsEnabled (inst,i) == 1 and state == 1
then mc.mcSoftLimitSetState (inst,i,1) end
if mc.mcAxisIsEnabled (inst,i) == 1 and state == 0
then mc.mcSoftLimitSetState (inst,i,0) end

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

Mach4 General Discussion / Q word missing error when running G83?
« on: December 18, 2016, 09:15:09 AM »
When i run the generated G-Code the machine stops and complains about missing Q Word... Why? Q-Word is not 0 or negative and should be treated as sticky....
Anyone a clue?

(Note: G-Code is Generated By CamBam so i dont have a clue what Q Word does...)

Code: [Select]
G21 G90 G64 G40
G0 Z10.0
( T10 : 6.0 )
T10 M6
( Drill 6mm CenterBore 4-6mm )
M3 S1500
G0 X82.96 Y40.1
G83 X82.96 Y40.1 Z-5.0 Q1.0 R3.0 F100.0
G83 Y119.9 Z-5.0
G83 Y199.7 Z-5.0
G83 X637.24 Z-5.0
G83 Y119.9 Z-5.0
G83 Y40.1 Z-5.0

Mach4 General Discussion / Can i edit or add to a Predefined Macro?
« on: December 16, 2016, 10:43:13 AM »
I want to ADD stuff to the M30 Macro. I want it to be working as it works by default but add some code to finish up a GCode run.

All my Cam software end programs with move Tool to Z clearance plane, turn spindle off and (M30) stop execution and set next line marker to the first line.
After this i want to do some more stuff like turn on the coffe mashine to make a nice cup of coffe so i can admire my work in peace and also send an email to my phone telling me coffe is ready in 3 minutes.... :D

How and or where do i do this?

Mach4 General Discussion / Mach 4 Bug showing in M6 Script
« on: December 15, 2016, 07:15:15 AM »
I am experiencing wired behaviour in Mach 4

Im trying out the M6 command and have rewritten DTG:s M6 Script to suit my needs.
Problem is I am getting the wrong value in my script from "mc.mcToolGetSelected(inst)"
M6 Script outline:
Code: [Select]
function M6()
    local inst = mc.mcGetInstance();
    local changeToTool = mc.mcToolGetSelected(inst)
    local changeFromTool = mc.mcToolGetCurrent(inst)

   wx.wxMessageBox("ToolChange from T"..changeFromTool.." to T"..changeToTool.." Press OK to run M6 script")

1) Start Mashine
2) Start Mach4
3) Select Screen (wxRouterSet - Copy)
4) Enter number of the tool in the mashine into toolinformation/CurrentTool textfield (10)
5) Ref all home
6) Jog to where i want to set work Zero
7) Press zero X, Y ,Z
8) Run G-Code:

G21 G90 G64 G40
G0 Z10.0
T10 M6

The message bow that pops up Says: ToolChange from T10 to T1 Why? It shouls say T10 instead of T1.....

Where does T1 Come from?

Please advise!!

Mach4 General Discussion / Wired behavior preventing Homing (RefAllHome)
« on: November 28, 2016, 08:26:13 AM »
When i select "Reference All Axes" Mashine trips each home switsh as axpected and stops BUT LED never goes green and the Green "Cyclestart Button" remains grayed out.

It all looks looks the operation never finishes...
When i click "Stop" the "CycleStasrt" button comes back (has black test)

Where do i start?

I use Mach4.2.0.3206, ESS (B186), wx4 screenset, And X360_LUA plugin


I have Smoothstepper setup and have run it With pmdx 126 for a while now.

I am configuring my CNC for use with an Engraving Laser Diode.

To control my Laser Driver i have three signals: Driver On, Beam On and Beam Intensity (PWM).

I want to control Beam on using M62 P0 (Followed by a Move Command G1 X...)

I have tried different connections on the pmdx Port#1Pin#1, Port#2Pin16 and 17 but non seems to work.
Further investigation using the diagnostic screen shows that Output 0 Never toggles to On..... No matter of hardware configuration this should toggle right? Im running build 2914 of Mach 4.

Can anyone point me in the right direction? ??? ???

General Mach Discussion / Configure ttl output for laser diode driver.
« on: September 27, 2015, 04:42:32 AM »
I have à 3 axis router controlled with à pmdx-126 Bob and a Ethernet smoothstepper.and match 3. The spindle is à technomotor controlled fr.o.m. the Bob with a pmdx-107 isolated spindle control.

Now to the problem. I have a diode laser powered by a simpledrive. The simple drive accepts isolated ttl input but also analog/ttl which is not isolated. I would prefer to use the isolated input. Hos do i set this up without changing my spindle config?
I will need to run the spindle and the laser in the same program.

I rally need help and appreciate any help!

Hi, I need to use a heater to control the temperature of my work environment. The way i imagine this to be possible is to make a custom Gcode /Mcode which sets the desired temperature to my temp controller.

M850 1 58 Would set heater 1/sensor 1 to heat until 58 degrees at sensor location.
M851 5 40 1 Would wait for sensor 5 to read 40 degrees or more.
M851 2 35 0 Would wait for sensor 2 to read 35 degrees or less.
M852 1 1 Would wait for Heater 1/Sensor 1 to  reach set temperature.

Also i want to make the software read the current temperature to be displayed on one of the screens.

My proof of concept was making a arduino/modbus solution and it works! Now i have to remove the serial connection and do the same using nothing more than the options provided by the paralell ports provided by the Ethernet SmoothStepper.

Where do i start? What options are there?

Pages: 1