Hello Guest it is April 25, 2024, 12:23:43 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 - Ya-Nvr-No

21
Mach4 General Discussion / Re: Read droGageBlockT
« on: May 25, 2019, 11:05:55 AM »
 --To my understanding your trying to use these two Probing Screens Dro's
 --Make sure you have created registers GageBlock and GageBlockT before you can write and read them.
 
   local GageBlock = scr.GetProperty("droGageBlock", "Value")
   local GageBlockT = scr.GetProperty("droGageBlockT", "Value")

   WriteReg('iRegs0/GageBlock',tonumber(GageBlock));
   WriteReg('iRegs0/GageBlockT',tonumber(GageBlockT));
   
 --Never tried to share the same named variable but worth a test
 --if not just change them. (more of a scripting timing and use issue id expect)
 --Just have to make sure any changes to the Dro's get reread and rewritten to the registers
 --I do remember if you try to read the registers to soon after writing to them they are not available.
 --so a dwell might need to be used if in the same script
 --But in most cases registers are updated in the PLC or button script and then used in the M code.
 
   local GageBlock = ReadReg("iRegs0/GageBlock");
   local GageBlockT = ReadReg("iRegs0/GageBlockT");

22
Might not be what your looking for but it gave me a challenge on a rainy day.

Here is a rough idea of excel code I created for computing points using Johns numbers
uses tool tip radius and a couple variables so I can cut in either direction on most domes.
pretty much all of my gcode programming is done with variables.
I use this method to give me a start on creating the gcode.
I start with a cad drawing and then verify the dimensions with the calculations.
Once you know the computed variables they just get updated/created when ran for the known set Radius and part diameter variable dimensions.

I find variable programming a lot faster than posting out a program or repetitive paths, In this case id probably use a G10 in the loop and keep incrementally shifting Z0 over until part face dome cleaned up.

23
MACH TOOL BOX / Re: Multi pass facing program
« on: November 11, 2018, 11:09:38 AM »
only two reasons I can think of why it might not work:

need a valid Mach3 license and it limits you to one loop or
you did not add a return/enter command after the M99

you will notice in the future a lot of programs, a comment statement or more likely a "%" on the next line to assure that it reads to the end of the loop or file.
insure yourself that a CR/LF (carriage return/line feed) is completing the line to be read by doing something like this:

M99
%

24
General Mach Discussion / Re: Trouble with parametrics & subroutines
« on: November 09, 2018, 04:19:01 PM »
I messed around with your code in Mach4, but had to make some changes as not sure what it is.
You do have to put in a diameter in the tool table.
did notice once I added the cutter comp working feature I had to double the loops in the M98
not sure what that's all about, seems like a bug



Code: [Select]
#1=0
#2=0
#3=-5.2
G21 G90 G40
G0 X-65 Y5 Z5
G1 G41 X-60 Y0 F500
 Z[#3]
 X-55 Y0
 X-45
 X0
M98 P2 L20
 X 0.86 Y-35.71 F500
G3 X0 Y-35.5 I-0.89 J-43
G1 X-60
 Y0
#3=[#3 + 5.2]
G0 Z[#3]
G40 X-65 Y0
M30

O2 (Increments X then recalculates Y, then moves there)
#1=[#1+26.0000]
#2=[[[0.495*[2.718**[0.020*#1]]]+[0.0320*#1]]*-1]
G1 X#1 Y#2 F800
M99
%

25
Mach4 General Discussion / Re: Mach 4 Lathe error on start up
« on: November 05, 2018, 08:17:09 AM »
as Mr Tuttle stated go to:
Quote
To view it, Operator->View Screen Script, scroll down to line 768.
you will find this line is the load issue, thou i'm confused why it works after, that is  ???

26
MACH TOOL BOX / Re: Multi pass facing program
« on: November 02, 2018, 07:03:07 PM »
You mean you want me to write it for you ???
try this:

    O30
    (THIS IS THE SUB TO CUT FACE)
    G91 G1Y[#1005] (Increment over in Y)
    G90 X[#1000]F80. (Cut across part)
    G0 Z.25 (GO UP TO CLEAR PART FACE)
    X0 (BACK TO STARTING SIDE)
    G1 Z[#1004] (MOVE BACK DOWN TO CUT DEPTH)
    G91 Y[#1005] (again increment over)
    G90 X[#1000] (Cut across part)
    M99

27
Mach4 General Discussion / Re: Mach 4 Lathe error on start up
« on: October 30, 2018, 07:50:18 PM »
make sure your passing a number for the fourth parameter if Data and string for the third parameter if Desc
here is a Data and a Desc (= description)


if xFlag==1 then
   rc=mc.mcToolSetData(inst,mc.MTOOL_LATHE_X,CurTool,tonumber(xVal))
end

if dFlag==1 then
   rc=mc.mcToolSetDesc(inst,CurTool,'Bit Diameter: '..tostring(dVal))
end

28
Mach4 General Discussion / Re: Screen Set Ideas
« on: October 29, 2018, 09:25:32 AM »
 ::)  Funny guys,  ;D you know I love pushing  8)

showing how you can add to that same function, a start and stop tool cleanout routine using an "a# and b# value"
the loop uses "i" to select the current tool that needs cleaned out from a to b

Code: [Select]
local bVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_B)
local bFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_B)
--mc.mcCntlSetLastError(inst, 'bVal handle == ' .. tostring(bVal));
--mc.mcCntlSetLastError(inst, 'bFlag handle == ' .. tostring(bFlag));

if((aFlag == 1)and(bFlag == 1)) then
for i = aVal, bVal do
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_POCKET,i,0)
        rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_HEIGHT,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_HEIGHT_W,i,0)
        rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_DIA,i,0)
        rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_DIA_W,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_X,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_X_W,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_Y,i,0)
rc=mc.mcToolSetData(inst,mc.MTOOL_MILL_Y_W,i,0)
        rc=mc.mcToolSetDesc(inst,i,tostring(""))
end
end

29
Mach4 General Discussion / Re: Screen Set Ideas
« on: October 26, 2018, 08:39:30 PM »
Thought id show how you can pass hParam values to the tool table in mill mode, got the idea from Tuttles lathe project code he created passing values to his tool table.

First thing all macros need to be saved in .mcs extension not .lua
the ZeroBrane defaults to a .lua extension and that bit me.
as I found out they never get compiled in the mcLua.mcc file (why... good question it says lua, right in the name)  ::)

I attached the sample code so all can learn and play with.
no way is it clean & refined but gives you an idea how its done and how you can test in the ZeroBrane's debug mode

thanks SMurph making my life even more ...  :-*

and yes there are other ways to update the table (G10), this was just a challenge I wanted to learn from.
the default tool is the current tool but you can use and pass a t# to write data to different tools
could be made into a looping routine that cleans out all the data in the table.
its all about whats being passed and how it is used in the function.

30
Mach4 General Discussion / Re: Screen Set Ideas
« on: October 21, 2018, 09:18:39 PM »
Added the ability to set field colors based on values
I added in the load script
vtimer=0
used to only update colors every 30 PLC loops


Code: [Select]
function GetPoundDroVariables()
    local inst = mc.mcGetInstance();
for i = 0, 999 do
local val = scr.GetProperty('drovar'..tostring(i),'Value','Value',0);
scr.SetProperty('drovar'..tostring(i), 'Fg Color', 'Black');
if val == '' then
val = tonumber(0)
else  
val = tonumber(val)
if val > 0 then
scr.SetProperty('drovar'..tostring(i), 'Fg Color', 'Blue');
elseif val < 0 and val > -99999 then
scr.SetProperty('drovar'..tostring(i), 'Fg Color', 'Red');
end
end
end
end

vtimer = vtimer + 1;
if vtimer == 30 then
vtimer = 0
GetPoundDroVariables();
end