Hello Guest it is April 19, 2024, 11:02:12 PM

Author Topic: Display WHOLE # Only in DRO  (Read 11309 times)

0 Members and 1 Guest are viewing this topic.

Re: Display WHOLE # Only in DRO
« Reply #10 on: December 06, 2012, 10:09:14 PM »
That works ... sort of.
Stepping through w/the editor is OK.
Won't run on its own.
There is more in the pump. Care to take a look ? Might need some waits in there. ?
Thanks Ger,
Russ

MaxStroke = GetUserDRO (1105)
CutLength = GetUserDRO (1100)
SawKerf = GetUserDRO (1104)
NumberOfCuts = GetUserDRO (1106)
Divider = GetUserDRO (1107)

'  This divides the available stroke by the Feed Increment
SetUserDRO (1107,MaxStroke / (CutLength + SawKerf) )

 
 
 '  This rounds it down to the nearestWhole number of Increments
 
DROInteger=CStr(GetUserDro(1107))
Length = Len(DROInteger)
For X = 1 To Length Step 1
lstring=Left(DROInteger,X)
If Right(lstring,1) = "." Then
NewLength = x-1
Exit For
End If
Next X

WholeNo=CInt(Left(DROInteger, NewLength))

SetUserDRO(1106,WholeNo)                 

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Display WHOLE # Only in DRO
« Reply #11 on: December 06, 2012, 10:14:21 PM »
Try
DROInteger=CStr(MaxStroke / (CutLength + SawKerf))
That way you're not trying to read the DRO right after you right to it.

I don't know if you can wait in a macropump, because you don't have much time.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Display WHOLE # Only in DRO
« Reply #12 on: December 06, 2012, 10:24:17 PM »
not quite right yet Ger.
Last suggestion did not work at all, even commented out the previous code and stepping through.

Back as it was, steps through OK but won't run auto.

Russ

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Display WHOLE # Only in DRO
« Reply #13 on: December 06, 2012, 10:38:56 PM »
Try   SetUserDro(##, Fix(GetOemDro(##) )    ' Where the ## are the DRO numbers

Just a thought, (;-) TP

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Display WHOLE # Only in DRO
« Reply #14 on: December 06, 2012, 10:41:27 PM »
I was playing with Fix in the editor and it kept giving me bad syntax errors, and I couldn't figure it out.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Display WHOLE # Only in DRO
« Reply #15 on: December 06, 2012, 10:42:20 PM »
IF you are going to use the macro pump you need to loop out IF the 2 dros are the same number to prevent all the overwriting going on THAT eats up processor time.

(;-) TP
Re: Display WHOLE # Only in DRO
« Reply #16 on: December 06, 2012, 10:48:26 PM »
Tried TP's w/ Fix and Int ...neither worked.
Tried these plus Ger's in a button. So as to not conflict with the pump

Ger's worked 1 time, the returned a 0

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Display WHOLE # Only in DRO
« Reply #17 on: December 06, 2012, 11:14:06 PM »
Here's  what I HAVE running in the macropump here.

 Works fine tracks the Xdro exactly to the whole number. The IF statement checks to see IF the 2 values are the same if they are then it ends otherwise it writes thenew value to the UserDRO(1555).

If Fix(GetDro(0)) = GetUserDro(1555) Then

End
End If


SetUserDro(1555, Fix(GetDro(0)))
While Ismoving()
Wend

End   
Re: Display WHOLE # Only in DRO
« Reply #18 on: December 06, 2012, 11:34:40 PM »
That works fine in a Button,( after changing all to UserDRO's) but it wont run in my pump along with the other line.
Might just have to leave it in a button ? ? ? Just 1 extra step I was trying to avoid.
Thanks TP

MPmp
MaxStroke    = GetUserDRO (1105)
CutLength    = GetUserDRO (1100)
SawKerf      = GetUserDRO (1104)
NumberOfCuts = GetUserDRO (1106) 'Interger, actual cut increments
Divider      = GetUserDRO (1107) 'raw decimal # xx.*********x

'  This divides the available stroke by the Feed Increment
SetUserDRO (1107,MaxStroke / (CutLength + SawKerf) )
 
'TP's Goody....................
If Fix(GetUserDro(1107)) = GetUserDro(1106) Then

End
End If

SetUserDro(1106, Fix(GetUserDro(1107)))
While Ismoving()
Wend

End                              

Re: Display WHOLE # Only in DRO
« Reply #19 on: December 06, 2012, 11:54:51 PM »
Thanks Guys for the points to the right direction.
Can it possibly be this simple ? ??
This one line does it all ... perfectly , so far.

SetUserDRO(1106,Fix(GetMaxStroke)/(CutLength+SawKerf))  


Right in the pump, no button needed.

Fingers crossed.
Thanks again !
Russ
« Last Edit: December 06, 2012, 11:57:36 PM by Overloaded »