
! script name: turbopost.d/turbo_examples
! topic: TurboPost examples

!B NAME:
!B
!B 	FREQUENTLY USED TurboPost EXAMPLES
!B
!B CUTTER DIAMETER COMPENSATION
!B
!B 	To turn Cutter Diameter Compensation on in the first move of a
!B 	cutterpath, and shut it off on the last move, go into the output_format
!B 	file and add the following lines. 
!B
!B 	compensation switches: force_full left= 41  right= 42  cancel= 40
!B
!B 	canned cycle setup:		
!B 	RAPID:		gcode= 0  rapid		std blk= N*G*X*Z
!B 	LINEAR:		gcode= 1  feed		std blk= N*G*X*Z*F
!B 	FEED:		gcode= 1  feed		std blk= N*G*X*Z*F
!B 	CIRCLE_CW:	gcode= 2  feed		std blk= N*G*X*Z*I*K*F
!B 	CIRCLE_CCW:	gcode= 3  feed		std blk= N*G*X*Z*I*K*F
!B 	ROTARY_POS:	gcode= 0  rapid		std blk= N*G*X*Y*Z*A
!B 	ROTARY_FEED:	gcode= 1  feed		std blk= N*G*X*Y*Z*A*F
!B 	DCOMP_ON:	gcode= 1  feed		std blk= N*G*g*X*Z*D*F	<<<<< ADD THIS
!B 	DCOMP_OFF:	gcode= 1  feed		std blk= N*G*g*X*Z	<<<<< ADD THIS
!B
!B 	Also go into cut_contour and add the following variable:
!B
!B 	FEED: Z= Rap_level- Finish_depth; Feed= Zfeed;		
!B 	ASSIGN: Feed= Tfeed;		
!B 	ASSIGN: Dia_comp_mode= 1;    <<<<< ADD THIS		
!B 	CUTPATH:		
!B 	ASSIGN: Pathendpt		
!B
!B 	The variable that Dia_comp_mode uses for the 40,41 or 42 is Comp_dir.
!B 	The variable used for the diameter compensation number is Dia_comp.
!B 	These variables need to be set in the post.
!B
!B 	This is an example of a contour question file setting the Comp_dir
!B 	variable to either 41 or 42.
!B
!B 	# contour_ques		
!B 	Dia_comp	force		prompt= "CUTTER DIAMETER COMP #";
!B 	Comp_dir	force		prompt= "CUTTER COMP DIRECTION ( 41 )Left ( 42 )Right";		
!B 	Rap_level	default		prompt= "RAP LEVEL";
!B 	Tool_clearance	default		prompt= "TOOL CLEARANCE";
!B 	Finish_depth	force		prompt= "FINISH DEPTH";
!B 	Zfeed		default		prompt= "Z FEED RATE";
!B 	ASSIGN: Plot_pen= 5; Depth_of_cut= Finish_depth;		
!B
!B 	By setting Dia_comp_mode to 0,1,2 or 3 you will get these results:
!B
!B 	Dia_comp_mode=0; Dia compensation not used.
!B
!B 	Dia_comp_mode=1; Dia compensation turned on in the first
!B 	move of the path, and canceled on the last move of the path.
!B
!B 	Dia_comp_mode=2; Dia compensation turned on in the first move of the
!B 	path, and not canceled.
!B
!B 	Dia_comp_mode=3; Dia compensation is canceled on the last move of
!B 	the path.
!B
!B SETTING TOOL NUMBERS IN THE POST
!B
!B 	To get the post to pre-stage the tools you can set the Tool_num 
!B 	variable and the Next_tool variable. Here is an example of a post that 
!B 	prestages tools.
!B
!B 	# startup_ques		
!B
!B 	Cus_name	force		prompt= "ENTER THE CUSTOMER NAME";
!B 	Prog_desc	force		prompt= "ENTER THE PROGRAM DESCRIPTION";
!B 	Prog_id		force		prompt= "ENTER THE PROGRAM NUMBER";
!B 	Tool_num	force		prompt= "ENTER THE TOOL NUMBER";
!B 	Next_tool	force		prompt= "ENTER THE NEXT TOOL NUMBER";
!B 	ASSIGN: Time2=0;		
!B 	ASSIGN: Length_comp= Tool_num; Dia_comp= Length_comp		
!B
!B 	# s_up macro		
!B
!B 	NOTEPAD.TOOLS:		
!B 	NOTEPAD.TIME:		Time Analysis for Program  {Prog_desc}.
!B 	NOTEPAD.TOOLS:		ENTER THE CUSTOMER NAME  {Cus_name}
!B 	NOTEPAD.TOOLS:		ENTER THE  PROGRAM  DESCRIPTION  {Prog_desc}
!B 	NOTEPAD.TIME:		
!B 	MACRO: cyc_tool_data		
!B 	OUTPUT: **O000 {Prog_id}		
!B 	TOOLSYMBOL:		
!B 	OUTPUT: **(*** T{Tool_num}***  {Tool_desc} ***)		
!B 	OUTPUT: T{Tool_num}M06		
!B 	OUTPUT: S{Speed} {Spindle}T{Next_tool}		
!B
!B 	# tool_ques		
!B
!B 	ASSIGN: Tool_num= Next_tool;		
!B 	Next_tool	force		prompt= "ENTER THE NEXT TOOL_NUM";
!B 	Initial_z	force		prompt= "INITIAL Z LEVEL";
!B 	Plot_symbol	default		prompt= "CHOOSE FIXURE SYMBOL";
!B 	Symbol_address	default		prompt= "STORAGE DEVICE FOR SYMBOL";
!B 	Tool_symbol	default		prompt= "CHOOSE REQUIRED TOOL SYMBOL";
!B 	ASSIGN: Length_comp= Tool_num;		
!B 	ASSIGN: Dia_comp= Tool_num;		
!B
!B 	# tool_change macro		
!B
!B 	MACRO: calc_cyc_time		
!B 	MACRO: cycle_time_out		
!B 	MACRO: cyc_tool_data		
!B 	OUTPUT: **G0G91G28Z0.M09		
!B 	OUTPUT: ** (*** T{Tool_num} ***  {Tool_desc} ***)		
!B 	OUTPUT: T{Tool_num}M06		
!B 	OUTPUT: S{Speed} {Spindle}T{Next_tool}		
!B 	TOOLSYMBOL:		
!B
!B DRILLING AS A MACRO
!B
!B 	The standard post processor uses the drill command as a canned cycle.
!B 	This means that the only block of code you have control over is the G81
!B 	block. If your machine requires you to position to the first hole, turn
!B 	on the Length_comp, and then do the G81 canned block, you will need
!B 	to change the canned cycles to macros.
!B
!B 	The first thing that you need to do is change the cycles in the
!B 	user_commands file from canned cycles to macros.
!B
!B 	# user_commands		
!B
!B 	DRILL:		pick_type= H	macro	file= drill	ques_file= drill_ques
!B 	PECK(G83):	pick_type= H	macro	file= peck	ques_file= peck_!B	ques		
!B 	PECK(G73):	pick_type= H	macro	file= peck73	ques_file= peck_!B	ques		
!B 	COUNTERBORE:	pick_type= H	macro	file= bore	ques_file= bore_!B	ques		
!B 	TAP:		pick_type= H	macro	file= tap	ques_file= tap_ques
!B
!B 	Next create a file called drill. It should look like this.
!B
!B 	# drill macro		
!B 	ASSIGN: Rap_level= Zstart; Finish_depth= Hole_depth;		
!B 	MACRO: pre_drill	Repeats= (Tl_ch> 0);
!B 	DRILL: X= Xstart; Y= Ystart;		
!B
!B 	The macro pre_drill will look like this.
!B
!B 	# pre_drill		
!B 	OUTPUT: G0X{Xstart}Y{Ystart}S{Speed}M3		
!B 	OUTPUT: G43Z{Tool_clearance}H{Length_comp}M8		
!B 	ASSIGN: Tl_ch= 0;		
!B
!B 	You need to assign the Tl_ch variable to 1 in the user_variables file
!B 	and in the tool_ques file.
!B
!B 	#user_variables		
!B
!B 	Tl_ch= 1;		
!B 	S_retract= .1;		
!B 	Angle_b= 0;		
!B 	Num_holes= 5;		
!B 	New_angle= 0;		
!B 	Part_rotate= 1;		
!B 	Diameter1= 0;		
!B
!B 	#tool_ques		
!B
!B 	ASSIGN: Tool_num= Next_tool;		
!B 	Next_tool	force		prompt= "ENTER NEXT TOOL NUMBER";
!B 	Plot_symbol	default		prompt= "CHOOSE FIXURE SYMBOL";
!B 	Symbol_address	default		prompt= "STORAGE DEVICE FOR SYMBOL";
!B 	Tool_symbol	default		prompt= "CHOOSE REQUIRED TOOL SYMBOL";
!B 	Sym_size	default		prompt= "ENTER THE TOOL SYMBOL SIZE";
!B 	Tool_on		default		prompt= "TOOL PLOT ( 1 )ON ( 0 )OFF";
!B 	Initial_z	default		prompt= "INITIAL Z LEVEL";
!B 	ASSIGN: Length_comp= Tool_num;		
!B 	ASSIGN: Tl_ch= 1;		
!B
!B CYCLES IN THE TurboPost
!B
!B 	STARTUP: Choose this in the beginning of the program. It will
!B 	output the codes to start the program and includes the first tool
!B 	change.
!B
!B 	END_CODES: This cycle will output the codes that you need to end
!B 	the program.
!B
!B 	TOOLCH: This cycle will output the codes to perform a tool change.
!B 	if you have tools loaded in, the Speed, Feed, Tool_desc, Tool_dia,
!B 	and Tool_symbol will be taken from the tool. If no tools are loaded,
!B 	you will be prompted to answer this information.
!B
!B 	ANALYZE_COST:  This is a macro that sends cost analysis information to
!B 	a file called NOTEPAD.COST.
!B
!B 	CUT_CONTOUR:  This is a cycle to cut a single 2D cutterpath to one
!B 	specified depth.
!B
!B 	MCUT_CONTOUR: Same as above but will take more than one depth of cut. 
!B
!B 	CUT_PATH_GRP: This cycle will cut the roughing cutter paths to one
!B 	to one specified depth. The roughing paths include Follow Pocket,
!B 	Zig-Zag and Boundary.
!B
!B 	MCUT_PATH_GRP: Same as above but will take more than one depth of cut.
!B
!B 	RAMP_CONTOUR:  This cycle will cut a roughing cutter path feeding in
!B 	Z to the start point at a specified maximum ramp angle per inch, or a 
!B 	maximum Z step per inch.
!B
!B 	MRAMP_CONTOUR: Same as above but will take more than one depth of cut.
!B
!B 	ROUNDCUT: This cycle will mill the outside or the inside of a hole.   
!B
!B 	ROUND_MCUT:  Same as above but will do more than one depth of cut.
!B
!B 	SLOT:       
!B
!B 	CBORE_ROUND: 
!B
!B 	CUTSURF_UNIDIR: This is a cycle that will cut a 3D cutterpath moving in 
!B 	one direction.
!B
!B 	CUTSURF_BIDIR: This is a cycle that will cut a 3D cutterpath 
!B 	bidirectionally. The variable 3D zig-zag cuts must be set to 1 when
!B 	creating the cutterpaths.
!B
!B 	3D_POCKET: This cycle will cut a 3D pocket.
!B
!B 	CLAMP_AVOID: This cycle will rapid to a specified position in Z.
!B
!B 	DRILL: Standard G81 canned drilling cycle.
!B
!B 	PECK_DRILL: Standard G83 canned peck drilling cycle.
!B
!B 	COUNTERBORE: Standard G82 canned boring cycle.
!B
!B 	TAP: Standard G84 canned tapping cycle.
!B
!B 	BORE(G85): Standard G85 canned boring cycle.
!B
!B 	NEW_ZERO: This cycle will shift the origin of a part to a specified
!B 	location. Standard G92 origin shift.
!B
!B 	RESET_ZERO: This will reset the origin back to the original.
!B
!B 	RAPID: This is a command that will rapid to specified locations.
!B
!B 	FEED: This is a command that will feed to specified locations.
!B
!B 	CUTPATH: This command will cut a 2D cutterpath.
!B
!B 	MAN_CODES:  Command to output operator information. 
!B
!B ROTARY TABLE CONFIGURATION
!B
!B 	The Synergy horiz_mill is set up for a machine that rotates the B Axis.
!B 	If you are creating a post processor for a horizontal or a vertical
!B 	machine need to start from the horiz_mill.
!B
!B 	The following sections must be in the output_format file in the post
!B 	directory.
!B
!B 	# ROTARY ANGLE COMPUTATION TYPE		
!B 	# A  0-360		+CW -CCW
!B 	# B  0-360		machine determines shortest distance
!B 	# C  no range		+CW -CCW
!B 	# D  no range		machine determines shortest distance
!B 	# E  windup		+CW -CCW
!B 	# F  windup		machine determines shortest distance
!B 	# G  incremental	+CW -CCW		
!B 	# H  incremental	unsigned		
!B
!B 	rotary B axis: available on shortest comp_type= A  angle_addon= 0.0
!B
!B 	A-H are the different ways that the post can rotate the table. This
!B 	example is set for type A or 0-360 +CW -CCW. The comp_type is what
!B 	needs to be changed for the different methods of rotating the table.
!B 	If this is a vertical machine, you need to change the rotary B axis to
!B 	rotary A axis.
!B
!B 	You must also have the ROTARY_POS and ROTARY_FEED commands in the
!B 	output_format file.
!B
!B 	RAPID:			gcode= 0  rapid     std blk= N*G*X*Y*Z
!B 	RAPID_Z:		gcode= 0  rapid     std blk= N*G*Z
!B 	POSITION_XY:		gcode= 0  rapid     std blk= N*G*X*Y
!B 	LINEAR:			gcode= 1  feed      std blk= N*G*X*Y*Z*F
!B 	FEED:			gcode= 1  feed      std blk= N*G*X*Y*Z*F
!B 	CIRCLE_CW:		gcode= 2  feed      std blk= N*G*X*Y*Z*I*J*K*F
!B 	CIRCLE_CCW:		gcode= 3  feed      std blk= N*G*X*Y*Z*I*J*K*F
!B 	ROTARY_POS:		gcode= 0  rapid     std blk= N*G*X*Y*Z*A
!B 	ROTARY_FEED:		gcode= 1  rapid     std blk= N*G*X*Y*Z*A*F
!B
!B 	You need to draw the geometry in the correct workplane. The post will 
!B 	automatically rotate the table to the workplane that you have your
!B 	geometry drawn in. Following is an example of the pre_cont_cut macro
!B 	in the hori_mill post processor:
!B
!B 	# macro pre_cont_cut		
!B 	ASSIGN: Pathstartpt		
!B 	ROTARY_POS: B= Bstart;		
!B 	POSITION_XY: X= Xstart; Y= Ystart;		
!B 	RAPID: Z= Rap_level+ Tool_clearance;		
!B
!B 	The Pathstartpt command calculates the angle of rotation to the
!B 	startpoint of the geometry. The Variable that holds this value is
!B 	called Bstart on a horizontal machine, and Astart for a vertical
!B 	machine. The ROTARY_POS command will output the angle to the tapecode.
!B
