Hello Guest it is March 28, 2024, 03:54:47 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.


Messages - Ya-Nvr-No

491
Mach4 General Discussion / Re: DRO Code differences
« on: April 29, 2014, 08:56:31 AM »
Cool... We will see selling of screens with scripts that do things like they should be,  ;D

I like the flexibility of being able to create, and yes it's not everyone.

Could be Mach4 is creating a whole new Revenue Stream for Programmers.

And can we be seeing you dreaming of; Ringing the Bell on Wall Street?  ;)

Brian & Steve you have to love the possibilities. but hate the loss of sleep!

All in jest  ::)

492
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 10:09:11 PM »
I cut 11' long parts that I put from corner to corner on my router and g68 on that found angle. Envision jogging up to an edge without it moving in both axis at a time? Will a MPG work like the Jog? How do I step up to an edge at 90degrees to the side face?  Kind of why I created the Polar function to solve my needs.

493
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 09:55:54 PM »
Then I would say that when a g68 is active, jog is off or your going to have to write code to keep track of where it jogged too during the g68 coords. Or things will be out of wack and you would see crashes.

494
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 09:43:08 PM »
That will work, thanks steve

495
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 09:28:44 PM »
should move in both, I use it a lot like that.
once i establish the coords I can use an indicator to follow the edge at the g68 angle

mach3 has been that way for years
Once you set g68 that is your coord system if I wanted to follow the linear ways I set g68 back to zero.
If you jog off coords you are no longer in reference to your set point. Your DRO will be incorrect. and you would have to jog back to the same point to be correct if you run a part again. all I can say is try it! Unless your keeping track during jogging where your g68 coords are. Once you move your way your screwed.




496
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 09:04:44 PM »
Your right if I do a
MDI: G1X1F10
it does move correctly
so it has to be in the jog routine.

I like the red DRO's  ;)

497
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 08:48:01 PM »
zero all axis's
MDI: G68 R45
sets coordinates to a 45 degree angle
DRO turn red in Mach3
if you jog in X you should see both X and Y move the same amount on a 45 degree angle
no luck at all in Mach4


498
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 10:22:49 AM »
Functions works much better, Thanks Steve ;D
have a lot more control of the displayed values this way.
this way I can control what quadrant the angle is in.
This took hours as my plugin took DAYS
hope others find it useful.

NOW don't forget to FIX G68 please.  :D

BTW: was expecting it to update when I went into Machine Coord mode but it only computes Fixture offsets, Still a few things to work out.
But I am having FUN

Code: [Select]
--Screen Load Script

function getHypot(axis1, axis2)
    local hypot = math.sqrt(math.pow(axis1,2) + math.pow(axis2,2));
        Hyp = hypot;
    return Hyp;
end

function getAngle(axis1, axis2)
    PI = math.pi;
    local radians = math.atan(axis1/axis2);
    local BaseAngle = radians * (180/PI)

if (axis1 == 0 and axis2 == 0) then
    angle = 0;
end
if (axis2 < 0 and axis1 > 0) then
    BaseAngle = -(90 + BaseAngle);
end
if (BaseAngle < 0) then
    angle = (BaseAngle + 360);
elseif (BaseAngle > 0) then
    angle = BaseAngle;
end
if (angle == 0 or angle == 90 or angle == 180 or angle == 270) then
    if (axis1 > 0 or (axis1 == 0 and axis2 == 0)) then angle = 0;
        elseif (axis1 < 0 and axis2 == 0) then angle = 180;
        elseif (axis1 == 0 and axis2 > 0) then angle = 90;
        elseif (axis1 == 0 and axis2 < 0) then angle = 270;
    end
end
return angle
end

Code: [Select]
--PLC Script

local Xval = mc.mcAxisGetPos(0,0);
local Yval = mc.mcAxisGetPos(0,1);
local Zval = mc.mcAxisGetPos(0,2);

getAngle(Xval,Yval);
scr.SetProperty('droXY', 'Value', tostring(angle));
getAngle(Xval,Zval);
scr.SetProperty('droXZ', 'Value', tostring(angle));
getAngle(Yval,Zval);
scr.SetProperty('droYZ', 'Value', tostring(angle));

getHypot(Xval,Yval);
scr.SetProperty('droXYhyp', 'Value', tostring(Hyp));
getHypot(Xval,Zval);
scr.SetProperty('droXZhyp', 'Value', tostring(Hyp));
getHypot(Yval,Zval);
scr.SetProperty('droYZhyp', 'Value', tostring(Hyp));

499
Mach4 General Discussion / Re: DRO Code differences
« on: April 27, 2014, 09:27:04 PM »
Thanks Steve

How would you use a function call from the PLC script, thought that would be better for computing the angles and distances. But fought that so guess I learned the hard way about the loops.

getAngle(Yval,Zval);
scr.SetProperty('droXY', 'Value', tostring(BaseAngle));

function getAngle(axis1, axis2)
PI=math.pi;
local radians = math.atan(axis1/axis2);
local BaseAngle=radians * (180/PI)
return BaseAngle
end

500
Mach4 General Discussion / Re: DRO Code differences
« on: April 27, 2014, 08:04:03 PM »
Thought others might like to see how easy it is done. :)
just add this to the PLC script at the end and the new DRO's get updated when any of the XYZ axis update.
It took me awhile to find where it was. So I circled it for you.
Little tedious to add the screen data but so much easier than macropump or adding a plugin
Thanks Steve & Brian
Did find that I tried to hide a button I created and it does not hide properly, don't need it any more, just used it to develop the script.
So that might be a bug.
I got all this done, and find that G68 does not work? :'(

The more we learn the better the life. :D
Code: [Select]
   local Xval = mc.mcAxisGetPos(0,0);
    local Yval = mc.mcAxisGetPos(0,1);
    local Zval = mc.mcAxisGetPos(0,2);
    
    local XYval = math.deg(math.atan(Xval/Yval));
    local XZval = math.deg(math.atan(Xval/Zval));
    local YZval = math.deg(math.atan(Yval/Zval));
    local XYvalhyp = math.sqrt(math.pow(Xval,2)+math.pow(Yval,2));
    local XZvalhyp = math.sqrt(math.pow(Xval,2)+math.pow(Zval,2));
    local YZvalhyp = math.sqrt(math.pow(Yval,2)+math.pow(Zval,2));
    
    scr.SetProperty('droXY', 'Value', tostring(XYval));
    scr.SetProperty('droXZ', 'Value', tostring(XZval));
    scr.SetProperty('droYZ', 'Value', tostring(YZval));
    scr.SetProperty('droXYhyp', 'Value', tostring(XYvalhyp));
    scr.SetProperty('droXZhyp', 'Value', tostring(XZvalhyp));
    scr.SetProperty('droYZhyp', 'Value', tostring(YZvalhyp));