2017 Screenset - Probing Issue

If you created a new screenset and want to share it with others then please post it here. You can talk about screens here.

Re: 2017 Screenset - Probing Issue

Postby ger21 » Sun Jan 07, 2018 4:40 am

I was reading too fast, and missed the part about it being random.
You might want to try installing 1.2047, which is the current stable release.

You can post the whole macro.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

Re: 2017 Screenset - Probing Issue

Postby ger21 » Sun Jan 07, 2018 4:41 am

I'm guessing that it's the last part of what you posted that is where the crash occurs?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

Re: 2017 Screenset - Probing Issue

Postby spumco » Sun Jan 07, 2018 4:45 am

Now I'm really confused.

I tried a simple X-only pocket, and it just crashed after the X- move. It moved in the wrong direction this time. Usually it crashes by moving in an expected direction but not stopping.

Start position, then X+, then X-, then instead of moving X+ to center it moved (G0) in the X- direction and crashed.

Again, the probe trigger LED was lit, but the G31 (#24) LED was not lit.
spumco
 
Posts: 306
Joined: Mon Oct 03, 2016 10:10 pm

Re: 2017 Screenset - Probing Issue

Postby spumco » Sun Jan 07, 2018 4:49 am

This is three different macros that have resulted in a crash (inside pocket, outside boss, inside X-pocket), and crashes have happened at different points throughout the macros. All during G0 moves, however.

I'm going to update to 1.2047 right now and see what happens.

UPDATE - still happens with 1.2047. Same thing issues. First pocket cycle was fine, repeat was fine. Third crashed.
spumco
 
Posts: 306
Joined: Mon Oct 03, 2016 10:10 pm

Re: 2017 Screenset - Probing Issue

Postby ger21 » Sun Jan 07, 2018 5:21 am

Post the code so that Balazs can look at it.
I don't have an answer, and I haven't heard of this from anyone else, although I don't know how many have used it.
I never saw this when I was writing the macros, but that was a year ago, and there have been a lot of versions of UCCNC since then.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

Re: 2017 Screenset - Probing Issue

Postby spumco » Sun Jan 07, 2018 5:42 am

Thanks Gerry. I really don't know if the macro is at fault or something else.

Here's the inside pocket X-only macro. The X/Y pocket is basically the same, only longer, so I added it as an attachment.

// X Axis Pocket Probing Macro


int originalmodalmode = exec.actualmodal; // Modal mode (G0, G1, ...)
int originaldistancemode = exec.actualdistmode; // Distance mode (G90, G91)
double CurrentFeed = AS3.Getfielddouble(867); // Current Feedrate
string FeedOR = AS3.Getfield(232); // Current Feedrate Override
double CurrentFeedOR = Convert.ToDouble(FeedOR.Replace("%", String.Empty));
double FeedFactor = 100/CurrentFeedOR; // Feedrate scale factor is Feedrate Overide is not 100%

bool ZeroYN = AS3jog.Getbuttonstate(20540); // Auto Zero
double Frate1 = AS3jog.Getfielddouble(20333); // First Probe Feedrate
double Frate2 = AS3jog.Getfielddouble(20334); // Slow Probe Feedrate
double X1; //X axis Probe Point
double X2; //X axis Probe Point
double Xhit; //X axis Probe Point
double XCenter; // X Center Location
double XLength; // X axis Pocket Length
double XStart; // X axis Start Position
double Dmax = AS3jog.Getfielddouble(20335); // Probing Distance
double ProbeL ; // Probe Distance
double ZStart = AS3.Getfielddouble(228); // Current Z axis Work Coordinate
double XYClear = AS3jog.Getfielddouble(20337); // XY Clearance
double ProbeD = AS3jog.Getfielddouble(20338); // Probe Diameter
double Retract = AS3jog.Getfielddouble(20340); // Pullback Distance
double PlateOff = AS3jog.Getfielddouble(20341); // Plate Offset

string XC; // X Center String Value
string XL; // X Length String Value
int StrLength; // String Length
int Precision = AS3.Getfieldint(195) + 1;// Number of decimal places
string Dotstr = "."; // Decimal Separator
int DotLoc; // Location of decimal place
int DecLength; // # of decimals


if (Frate1 == 0) // Check Initial Feedrate
{
MessageBox.Show (exec.mainform, "Initial Feedrate is currently set to 0." + "\n" + "Set Initial Feedrate value and try again.", "Invalid Feedrate!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
exec.AddStatusmessage("Macro aborted - Initial Feedrate = 0");
exec.Stop();
return;
}

if (Dmax == 0) // Check Probing Distance
{
MessageBox.Show (exec.mainform, "Probe Distance is currently set to 0." + "\n" + "Set Probe Distance value and try again.", "Invalid Probing Distance!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
exec.AddStatusmessage("Macro aborted - Probe Distance = 0");
exec.Stop();
return;
}

if (XYClear == 0) // Check Probing Distance
{
MessageBox.Show (exec.mainform, "X-Y Clearance is currently set to 0." + "\n" + "Set X-Y Clearance value and try again.", "Invalid X-Y Clearance!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
exec.AddStatusmessage("Macro aborted - X-Y Clearance = 0");
exec.Stop();
return;
}

if (ProbeD == 0) // Check Probing Diameter
{
MessageBox.Show (exec.mainform, "Probe Diameter is currently set to 0." + "\n" + "Set Probe Diameter value and try again.", "Invalid Probe Diameter!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
exec.AddStatusmessage("Macro aborted - Probe Diameter = 0");
exec.Stop();
return;
}

if (Retract == 0) // Check Retract Distance
{
MessageBox.Show (exec.mainform, "Pullback Distance is currently set to 0." + "\n" + "Set Pullback Distance value and try again.", "Invalid Pullback Distance!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
exec.AddStatusmessage("Macro aborted - Pullback Distance = 0");
exec.Stop();
return;
}

Frate1 = Frate1 * FeedFactor; // Scale Feedrate if FRO is not 100%
Frate2 = Frate2 * FeedFactor; // Scale Feedrate if FRO is not 100%


exec.Code("G90");
while(exec.IsMoving()){}

if (AS3.GetLED(37)) // Check Probe Input
{
MessageBox.Show (exec.mainform, "Probe Input is currently active." + "\n" + "Check connections and try again.", "Probe Active!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
exec.AddStatusmessage("Macro aborted - Probe Active");
exec.Stop();
return;
}

exec.AddStatusmessage(" ");
exec.AddStatusmessage(" ");

// Probe X+ axis

XStart = AS3.Getfielddouble(226); // Current X axis Work Coordinate
ProbeL = XStart + Dmax; // Probe Length

//exec.Code("F" + Frate1); // Set First Probe Feedrate

exec.AddStatusmessage(" ");
exec.AddStatusmessage("Probing for X+ Position...");

exec.Code("G31 X" + ProbeL + " F" + Frate1); // Do First Probe move
while(exec.IsMoving()){}

Xhit = exec.Getvar(5061); // Read the touch point
X1 = Xhit + ProbeD/2 + PlateOff; // Tool Center Position at X=0

if (Frate2 != 0)
{
exec.Code("G0 X" + (Xhit - Retract)); // Back away from edge
while(exec.IsMoving()){}

exec.AddStatusmessage("Slow Probing for X+ Position...");

//exec.Code("F" + Frate2); // Set Slow Probe Feedrate

exec.Code("G31 X" + ProbeL + " F" + Frate2); // Do Slow Probe move
while(exec.IsMoving()){}

Xhit = exec.Getvar(5061); // Read the touch point
X1 = Xhit + ProbeD/2 + PlateOff; // Tool Center Position at X=0

} // End Slow Probing

exec.Code("G0 X" + (Xhit - Retract)); // Back away from edge
while(exec.IsMoving()){}

exec.Code("G0 X" + XStart); // Rapid back to Start Position
while(exec.IsMoving()){}

// Probe X- axis

XStart = AS3.Getfielddouble(226); // Current X axis Work Coordinate
ProbeL = XStart - Dmax; // Probe Length

//exec.Code("F" + Frate1); // Set First Probe Feedrate

exec.AddStatusmessage(" ");
exec.AddStatusmessage("Probing for X- Position...");

exec.Code("G31 X" + ProbeL + " F" + Frate1); // Do First Probe move
while(exec.IsMoving()){}

Xhit = exec.Getvar(5061); // Read the touch point
X2 = Xhit - ProbeD/2 - PlateOff; // Tool Center Position at X=0

if (Frate2 != 0)
{
exec.Code("G0 X" + (Xhit + Retract)); // Back away from edge
while(exec.IsMoving()){}

exec.AddStatusmessage("Slow Probing for X- Position...");

//exec.Code("F" + Frate2); // Set Slow Probe Feedrate

exec.Code("G31 X" + ProbeL + " F" + Frate2); // Do Slow Probe move
while(exec.IsMoving()){}

Xhit = exec.Getvar(5061); // Read the touch point
X2 = Xhit - ProbeD/2 - PlateOff; // Tool Center Position at X=0

} // End Slow Probing

exec.Code("G0 X" + (Xhit + Retract)); // Back away from edge
while(exec.IsMoving()){}

// Calculate X Center and Pocket Length
XCenter = (X1 + X2) / 2;
XLength = X1 - X2;

// Convert X Center Position to String and reduce # of decimal places

XC = XCenter.ToString(); // Convert to String
StrLength = XC.Length; // Find String Length
DotLoc = XC.IndexOf(Dotstr); // Find location of decimal place
DecLength = StrLength - (DotLoc + 1); // # of decimal digits

if (DecLength > (Precision - 1))
{
XC = XC.Remove(DotLoc + Precision); // Trim extra digits from end, only if needed
}

// Convert X Length Position to String and reduce # of decimal places

XL = XLength.ToString(); // Convert to String
StrLength = XL.Length; // Find String Length
DotLoc = XL.IndexOf(Dotstr); // Find location of decimal place
DecLength = StrLength - (DotLoc + 1); // # of decimal digits

if (DecLength > (Precision - 1))
{
XL = XL.Remove(DotLoc + Precision); // Trim extra digits from end, only if needed
}

if (ZeroYN) // Zero X axis if enabled
{
exec.Code("G0 X" + XCenter); // Move to X Center
while(exec.IsMoving()){}
AS3.Setfield(0, 226); // Set X axis DRO to new zeroed position
AS3.Validatefield(226);
exec.AddStatusmessage(" ");
exec.AddStatusmessage("X axis is now Zeroed at Pocket Center");
}
else
{
exec.Code("G0 X" + XStart); // Rapid back to Start Position
while(exec.IsMoving()){}
}


AS3jog.Setfieldtext(XC, 20347); // Write X Center Position to DRO
AS3jog.Setfieldtext(XL, 20345); // Write X Length Position to DRO
exec.AddStatusmessage(" ");
exec.AddStatusmessage("Pocket Length = " + XL);
exec.AddStatusmessage("Pocket Center located at X = " + XC);


exec.Code("F" + CurrentFeed); // Set Feedrate back to previous
exec.Wait(200);

if (originaldistancemode == 91)
{
exec.Code("G91");
}

if (originalmodalmode == 1)
{
exec.Code("G1");
}

Attachments
M20537.txt
(11.73 KiB) Downloaded 845 times
spumco
 
Posts: 306
Joined: Mon Oct 03, 2016 10:10 pm

Re: 2017 Screenset - Probing Issue

Postby cncdrive » Sun Jan 07, 2018 1:02 pm

I have tested the macro with a UC100 and also with a UC300-5LPT and it works fine here.
Also I've checked the code through quickly and I do not see a problem for first sight.

Did you try to debug the issue yet with trying to see how the issue exactly happens?
I would check which code is exactly causing the issue.
From your description if I understand it correctly the X+ fast and slow probing both finishes OK and the X- fast probing also finishes OK and the issue happens somewhere after that, when the X- slow probing should happen, right?

So, you should investigate that code part a bit.
For example, do you see this message in the status field when the problematic movement happens? "Slow Probing for X- Position..."
It would be interesting to know, because if you do not see that yet when the problematic movement is ongoing, then what is causing the issue is not the X- slow G31, but the prior command, this:
exec.Code("G0 X" + (Xhit + Retract)); // Back away from edge

So, if that's the case then I would put the "G0 X" + (Xhit + Retract) also into a Statusmessage to see what their values are and so what command is exactly sent to the UCCNC and go on from there with the debugging.

Or if you see the above mentioned message already when the problematic movement is happening then print the G31 command into a statusmessage, this one "G31 X" + ProbeL + " F" + Frate2
To see what exactly is the string which goes into the command when the issue happens.

However from the information you gave previously I guess that you do not see that message, because you said the Probing LED is inactive when the issue happens and from this I think the issue will be with the prior G0 command...
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: 2017 Screenset - Probing Issue

Postby ger21 » Sun Jan 07, 2018 1:35 pm

I would think the issue is with one of these moves:

Code: Select all
exec.Code("G0 X" + (Xhit - Retract)); // Back away from edge
while(exec.IsMoving()){}

exec.Code("G0 X" + XStart); // Rapid back to Start Position
while(exec.IsMoving()){}


But he's saying that it works some times, but not every time.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

Re: 2017 Screenset - Probing Issue

Postby cncdrive » Sun Jan 07, 2018 2:08 pm

Gerry,

I think one possible issue is if the result number is small and it goes represented in exponents.
In G-code exponent format is not correct, so if that happens that can cause issues, that the number for example 1E-004 could be understood by the UCCNC as value 1, while in reality the number is 0.0001.
Ofcourse this is just an idea, I did not see the issue, but the possibility is there that it could happen.
This is why I thought to print out the full commands into the statusfield to see what exact command is passed to the UCCNC executer when the issue happens.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: 2017 Screenset - Probing Issue

Postby cncdrive » Sun Jan 07, 2018 2:29 pm

And if that's the problem then you could for example fix the number of digits in the number to avoid exponents format to happen, like:
Code: Select all
string mynumber = String.Format("{0:F6}", originalnumber);
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

PreviousNext

Return to Custom Screensets

Who is online

Users browsing this forum: No registered users and 1 guest

cron