Hello Guest it is April 27, 2024, 04:22:48 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 - TTalma

Pages: « 1 2 3 4 »
11
My tool change scripts are writen in inches. When I have a file in MM It messes up the tool change script.

When the gcode file is using mm and switches the coordinates to mm, what  do I need to add to my tool change script to switch to inches at start of script and switch back to mm at the end of the script?

12
I made a few changes to my tool rack, and as a result it is .1" higher. I changed the .csv file to reflect the new position. But Mach is still using the old position. I can't find anywhere in my code where the old number is. The old position was -6.45, The new position is -6.35. What is happening?

I have tried:
Recompiling all files
Restarting Mach
Restarting the PC

My .csv file looks like:

Code: [Select]
Tool_Number,X_Position,Y_Position,Z_Position
1,41.5, 0,-6.35
2,41.5,5.5,-6.35
3,41.5,11,-6.35
4,41.5,16.5,-6.35
5,41.5,22,-6.35
6,41.5,27.5,-6.35
7,41.5,33,-6.35

My .lua file looks like:
Code: [Select]
local TC_Positions = {}
local inst = mc.mcGetInstance()
local CSVPath = wx.wxGetCwd() .. "\\ToolChangePositions.csv"
ToolNum = 0;

--[[ Open the file and read out the data --]]
io.input(io.open(CSVPath,"r"))
 
local line;
for line in io.lines(CSVPath) do
    tkz = wx.wxStringTokenizer(line, ",");
    TC_Positions[ToolNum] = {} -- make a blank table in the positions table to hold the tool data
    local token = tkz:GetNextToken();
    TC_Positions[ToolNum] ["Tool_Number"] = token;
    TC_Positions[ToolNum] ["X_Position"] = tkz:GetNextToken();
    TC_Positions[ToolNum] ["Y_Position"] = tkz:GetNextToken();
    TC_Positions[ToolNum] ["Z_Position"] = tkz:GetNextToken();
    TC_Positions["Max"] = ToolNum
    ToolNum = ToolNum + 1;
end

io.close()

function TC_Positions.GetToolData(SelectedToolNum)
    local MaxToolNum = TC_Positions["Max"]

    if (SelectedToolNum <= MaxToolNum) and (SelectedToolNum > 0) then
        return TC_Positions[SelectedToolNum]
    else
        return nil
    end
end
return TC_Positions

The section of code that gets the value looks like:
Code: [Select]
local ToolData = tcp.GetToolData(SelectedTool)
    if (ToolData ~= nil) then
        Num2 = ToolData.Tool_Number
        XPos2 = ToolData.X_Position
        YPos2 = ToolData.Y_Position
        ZPos2 = ToolData.Z_Position
    else
mc.mcCntlEStop(inst)
        mc.mcCntlSetLastError(inst, "ERROR: Tool number out of range!")
        do return end
    end

After this code the ZPos2 value = -6.45

13
My blast gates on my system are controled with a pneumatic cylinder. I would like to automate opening and closing the blast gate with the system.

I need to send a short pulse to open the blast gate and a short pulse to close it. If I control these with M7 or M8 for on, and M9 for off. A continuous pulse is sent to the relays opening/closing the cylinder.

How do I set the system so that a short pulse is sent with M8 or M9?

Or can I do something different and some how send a command when the spindle is turned on?

I'm just not sure what the correct way to do this is.

14
I have a tool changer on my CNC. When I move in to position to release the tool I would like to move the spindle up while commanding the drawbar output. Currently the drawbar pushes the tool holder out about 1/2" causing the tool rack to flex. If I am able to move while the drawbar is being engaged I could prevent this flexing.

My code looks like:
Code: [Select]
...
local DrawbarOPEN = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)
...
mc.mcCntlGcodeExecuteWait(0, "G00 G91 X2")
mc.mcSignalSetState(DrawbarOPEN, 1)
c.mcCntlGcodeExecuteWait(0, ""G00 G91 Z.5")
...

The 3 lines do the following
slide the tool holder in to the tool holder fork
Open the drawbar
Move up to where the drawbar is clear

I would like to combine the open drawbar step and move up to where the drawbar is clear. right now after each line of code there is a noticeable pause.

Is there any way of smoothing out these motions?

I am using a smooth stepper, and the PC is a 3ghz i5.

15
Like the title states I would like my work coordinates to be equal to my machine coordinates when I home the machine.

This morning I powered up my machine, homed it and started a job. But I noticed that it went to the wrong position. Fortunately i hit e-stop before it started cutting, or it would have ruined a bit, possibly a fixture.

I homed the machine again and changed the work coordinates by typing them in the window to match the machine coordinates.

I've never had an issue like this in the past. When homing It always gets the coordinates correct, for machine and work. When powering down I always save the fixture settings, so I'm not sure if this was what was saving the homing coordinates.

I did some maintenance on my machine yesterday, and manually moved the axis so I could grease the rails etc. And that may account for why it was off. But I don't think so. I've had a few crashes in the past, and homing the machine corrected the position.

If there is a setting to automatically set the values of the work coordinates when homing, why would this have changed after several months of use? It worked yesterday, but not today. The only thing I did that I don't normally do is move the axis by hand.

16
I have a few operations that I perform regularly on different parts. I would like to know if I can create a GCODE file to perform an operation then call that GCODE file.

Basically I create a hole for a countersunk 1/4" cap head bolt. Can I create a GCODE file that just creates this countersunk hole. Lets call the file BoltHole.NC

Then I have a file called CutPart.NC.

The in CutPart.NC can I call BoltHole.NC file? If so what would the command look like?

17
When I am hogging material off for a rough clean up some times I lose a couple of steps. For the roughing it doesn't really matter, but it does on the following steps.

Is there a Gcode command that will reference all axis home?

I know about the G28 command but this only returns the axis to the home position, it doesn't appear to reference it from the switch if it's off a few steps.

18
Mach4 General Discussion / Call function in macros folder from button
« on: March 09, 2019, 02:30:25 PM »
I have a funtion, setToolDepth, in my macros folder. I was wondering how do I call this function from button?

I am using the blank button in the tool information area. I added the event for "left mouse up", and just put:
Code: [Select]
setToolDepth() In it, but no surprise, it didn't work. How do I make this call. I would like to use the existing function so I don't have the same code in multiple places.

19
In my ATC script I have a cycle that sets the depth of the the tool. I copied this code in to a new File named M1000.mcs. and placed it in the same directory as my M6 file.

In my M6 code I call the M1000 and the cycle just stops.  I can't get it to call an external M command to work, it always hangs.

For example i tried:
Code: [Select]
function m1000()   
    inst=mc.mcGetInstance()   
    mc.mcCntlSetLastError(inst, 'Call M1000 Success!')
end

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

And calling from my M6 with
Code: [Select]
mc.mcCntlGcodeExecuteWait(inst, "M1000")

Any idea how to do this?

I would like to be able to add a button to my screen to just call the tool measurement command. Then I can just insert a tool, measure, and go. I don't want to have the same code in 2 different places, that's a maintenance nightmare.

20
I have my ATC changing tools properly. This morning I added a z Axis depth setter. It correctly goes and hits the depth setter.

But I do not know what to do with the value it returns. If my table surface is Z = 0.

When the Depth setter triggers the height is 3.3198" above the table surface. So how do I tell Mach that the Z axis height is 3.3198" when the setter triggered?

Then if I give the machine a command like:
G90
G00 Z1
I want it to move to a height 1" above the table surface.

How do i do this?

My code:
    -- Search for probe
    mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-4 F20") --probe the new tool
    local probedz = mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_POS_Z) --Z Probe position in Machine coords
    mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z0 ") --Retract
    mc.mcCntlGcodeExecuteWait(inst, "G00 G91 X-2.75 ") -- Move to clear spot

    -- Save offset
    local NewOffset = probedz
    mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, selectedtool, NewOffset)
    mc.mcCntlSetLastError(inst, string.format("Auto tool setting complete, Tool %.0f Offset = %.4f", selectedtool, NewOffset))

Pages: « 1 2 3 4 »