Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Ending in single digit spindle speed warning, that isn't 0


Recommended Posts

Our spindles don't like when we have a speed ending in a single digit, that isn't 0.

We do however want the posted code to match the mastercam file

Any idea the best way to throw a warning at posting to let the programmer know the spindle speed needs to be rounded?

Link to comment
Share on other sites
31 minutes ago, cncgotoguy said:

Our spindles don't like when we have a speed ending in a single digit, that isn't 0.

We do however want the posted code to match the mastercam file

Any idea the best way to throw a warning at posting to let the programmer know the spindle speed needs to be rounded?

It might be better to just round it up or down but I have no idea how to do that

Link to comment
Share on other sites
37 minutes ago, cncgotoguy said:

Any idea the best way to throw a warning at posting to let the programmer know the spindle speed needs to be rounded?

Which mastercam version?

Link to comment
Share on other sites

Implement a modulo post block in your post, something like this should get you started...

modulo_result : 0
int_a         : 0
int_n         : 0
remainder     : 0

p_modulo(int_a, int_n, !remainder)
	modulo_result = int_a / int_n
	modulo_result = int(modulo_result)
	modulo_result = modulo_result * int_n
	remainder = int_a - modulo_result

Then call it passing in your spindle speed as int_a, 10 as int_n, and use any numeric value for the returning value (the remainder)

p_modulo(ss$, 10, !result)

If the remainder returns 0, your spindle speed is evenly divisible by ten, so it ends in zero. 

Here are a few test cases

	  p_modulo(20000, 10, !result)
	  "->", ~result, e$
	  //Output 
          // -> result 0.
	  
	  p_modulo(123456, 10, !result)
	  "->", ~result, e$
	  //Output 
          // -> result 6.
	  
	  p_modulo(45000, 10, !result)
	  "->", ~result, e$
	  //Output 
          // -> result 0.
	  
	  p_modulo(1776, 10, !result)
	  "->", ~result, e$
	  //Output 
          // -> result 6.
	  
	  p_modulo(1852, 10, !result)
	  "->", ~result, e$
	  //Output 
          // -> result 2.
	  
	  p_modulo(105, 10, !result)
	  "->", ~result, e$
	  //Output 
          // -> result 5.

 

  • Thanks 1
  • Like 1
Link to comment
Share on other sites

Have the post alter the variable 'speed' so a spindle speed not ending in zero won't happen, such as:

change the least significant digit to zero.

speed = (int(speed/10)) * 10

 

or

 

define a new variable, say, alt_speed  then a new postblock:

pfixspeed         # spindle speed to end in zero

             alt_speed = (int(speed/10)) * 10

             speed = alt_speed

              *speed

 

or

 

pfixspeed         # spindle speed to end in zero

             alt_speed = (int(speed/10)) * 10

              *alt_speed

then substitute pfixspeed where speed is output

 

 

  • Like 1
Link to comment
Share on other sites

Thanks everybody, especiialy  Zaffin_D for the help on this. I went with the following code and got it to work. Probably not the prettiest code around

 

fmt     4  modulo_result
fmt     4  int_a
fmt     4  int_n
fmt     4  remainder

 

modulo_result : 0
int_a         : 0
int_n         : 10
remainder     : 0

 

p_modulo
    int_a = speed
    modulo_result = int_a / int_n
    modulo_result = int(modulo_result)
    modulo_result = modulo_result * int_n
    remainder = int_a - modulo_result
    if remainder <>0, result=mprint(ssingledigitspindle)
    If remainder <>0, "(TOOLPATH SPINDLE SPEED ENDS IN SINGLE DIGIT)", e$

 

 

Then I ran the post block p_modulo after each toolchange. 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...