Sign in to follow this  

Recommended Posts

Hello, 

Is there any way to added trailing zero base on input  in fs2 

fs2 7   0 4 0 4t     #Integer, force four trailing 

fmt  "T"  7  t$

when i gives input to tool no. as below

input - output to be accepted 

1 - T1000  ( single digit input ) 

11- T1100 ( two digit input )

101 - T1010 ( Three digit input )

T1000 - T1000 ( 4 digit input ) as it's.

to meet above requirement. Any suggestion in above fs2 

 

 

Share this post


Link to post
Share on other sites
3 hours ago, Dhananjay @Mastercam India said:

Hello, 

Is there any way to added trailing zero base on input  in fs2 

fs2 7   0 4 0 4t     #Integer, force four trailing 

fmt  "T"  7  t$

when i gives input to tool no. as below

input - output to be accepted 

1 - T1000  ( single digit input ) 

11- T1100 ( two digit input )

101 - T1010 ( Three digit input )

T1000 - T1000 ( 4 digit input ) as it's.

to meet above requirement. Any suggestion in above fs2 

 

 

From MPMaster:

# --------------------------------------------------------------------------
# Format statements - n=nonmodal, l=leading, t=trailing, i=inc, d=delta
# --------------------------------------------------------------------------
#Default english/metric position format statements
fs2 1   0.7 0.6     #Decimal, absolute, 7 place, default for initialize (:)
fs2 2   0.4 0.3     #Decimal, absolute, 4/3 place
fs2 3   0.4 0.3d    #Decimal, delta, 4/3 place
#Common format statements
fs2 4   1 0 1 0     #Integer, not leading
fs2 5   2 0 2 0l    #Integer, force two leading
fs2 6   3 0 3 0l    #Integer, force three leading
fs2 7   4 0 4 0l    #Integer, force four leading
fs2 8   5 0 5 0l    #Integer, force five leading
fs2 9   0.1 0.1     #Decimal, absolute, 1 place
fs2 10  0.2 0.2     #Decimal, absolute, 2 place
fs2 11  0.3 0.3     #Decimal, absolute, 3 place
fs2 12  0.4 0.4     #Decimal, absolute, 4 place
fs2 13  0.5 0.5     #Decimal, absolute, 5 place
fs2 14  0.3 0.3d    #Decimal, delta, 3 place
fs2 15  0.2 0.1     #Decimal, absolute, 2/1 place (feedrate)
fs2 16  1 0 1 0n    #Integer, forced output
fs2 17  1.4 1.3lt   #Decimal, absolute, 4/3 trailing
#Custom format statements
fs2 22  4 0 4 0lt   #Integer, force leading & trailing

Make a new FS and define it like you need.

Share this post


Link to post
Share on other sites
8 hours ago, Dhananjay @Mastercam India said:

Hello, 

Is there any way to added trailing zero base on input  in fs2 

fs2 7   0 4 0 4t     #Integer, force four trailing 

fmt  "T"  7  t$

when i gives input to tool no. as below

input - output to be accepted 

1 - T1000  ( single digit input ) 

11- T1100 ( two digit input )

101 - T1010 ( Three digit input )

T1000 - T1000 ( 4 digit input ) as it's.

to meet above requirement. Any suggestion in above fs2 

 

 

This isn't really an "output formatting issue". This is an "input formatting issue".

There isn't a fs or fs2 function available (nor is there another of the 400 or so Functions), which would convert a value based on, 1's, 10's, 100's, or 1,000's place, into the format you would like.

You want to manipulate leading zeros, not trailing. By definition, trailing zeros always occur after a decimal point, not before.

Whenever you manipulate before the decimal, you want "leading" zeros.

Moreover, you want to convert all "input values" into a 'scaled 1000's place value'. (or something along those lines.)

Here is what I would do:

      # Create a variable named 'tool_num'.
	  # Format as "integer"
	  if t$ < 10, tool_num = t$ * 1000 #Convert to 1000's
	  if t$ > 9 & t$ < 100, tool_num = t$ * 100 #Convert to 100's
	  if t$ > 99 & t$ < 1000, tool_num = t$ * 10 #Convert to 10's place
	  if t$ > 999, tool_num = t$
	  pbld, n$, *tool_num, sm06, e$

Notice that I replaced the "*t$" on the Tool Change Line, with the manipulated variable.

Also note; you'll need to modify 'pwrtt$' (ptooltable), in order to get your Tool List to match the output tool values.

 

Tool "8", output as T8000

( T8 | 0.03937 FIN-BALL 1MM-DIA 4MM-SHK LIST 8510 | H8 | XY STOCK TO LEAVE - -.144 | Z STOCK TO LEAVE - 0. )
( T35 | 0.5 FLAT ENDMILL | H35 | XY STOCK TO LEAVE - -.144 | Z STOCK TO LEAVE - 0. )
( T10 | 0.11811 BULL 3MM-DIA X .75MM-CR 6MM-SHK LIST 4572 | H10 | XY STOCK TO LEAVE - -.144 | Z STOCK TO LEAVE - 0. )
( T105 | 0.5 FLAT ENDMILL | H105 | XY STOCK TO LEAVE - -.144 | Z STOCK TO LEAVE - 0. )
( T1205 | 0.5 BULL-NOSED ENDMILL | H1205 | XY STOCK TO LEAVE - .02 | Z STOCK TO LEAVE - 0. )
N100 G20
N110 G0 G17 G40 G49 G80 G90
( ROUGH MATERIAL ABOVE CLAMPS +0.020 STOCK )
N120 T8000 M6
N130 G0 G90 G54 X2.27 Y-.7537 A0. S12121 M3
N140 G43 H8 Z5.235 M8
N150 Z4.235
N160 G1 Z3.784 F48.

Tool "35", output as T3500:

N780 M01
( ROUGH MATERIAL ABOVE CLAMPS +0.020 STOCK )
N790 T3500 M6
N800 G0 G90 G54 X-.996 Y-1.335 A0. S12121 M3
N810 G43 H35 Z5.235 M8

Tool "1205", output as T1205:

N3670 M01
( ROUGH PROFILE ABOVE JAWS +0.020 STOCK )
N3680 T1205 M6
N3690 G0 G90 G54 X-3.1108 Y-1.0387 A0. S12121 M3
N3700 G43 H1205 Z5.25 M8

 

  • Like 1

Share this post


Link to post
Share on other sites

Thank You Sir, 

# Create a variable named 'tool_num'.
	  # Format as "integer"
	  if t$ < 10, tool_num = t$ * 1000 #Convert to 1000's
	  if t$ > 9 & t$ < 100, tool_num = t$ * 100 #Convert to 100's
	  if t$ > 99 & t$ < 1000, tool_num = t$ * 10 #Convert to 10's place
	  if t$ > 999, tool_num = t$
	  pbld, n$, *tool_num, sm06, e$

above script i have already implemented . My intention is there should provision in fs2 

For example program number -   fs2 7 4 0 4 0l  #Integer, force four leading

when i enter program no 1 output is O0001 ( Right - Left  ).

Program no. fs2  is completely  reverse in my case. ( output should be  - O1000 )  

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • 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