! TITLE: mach_op.mac (SM_TOOL) ! ! ! OBJECTIVE: ! ! This sub-macro performs machining operations on a selected set of ! solid model volumes. ! ! ! COMMAND SYNTAX: ! ! (a) DRILLING / BORING (op_typ = 'd'): ! ! (1) (2) (3) (4) (5) (6) (7) ! MACH_OP, op_typ, tool_typ, d_tool, r_or_ang, depth, rcs, btol ! ! ! (b) MILLING (op_typ = 'm'): ! ! (1) (2) (3) (4) (5) (6) ! MACH_OP, op_typ, tool_typ, d_tool, r_or_ang, depth, rcs ! ! ! (c) TURNING (op_typ = 't'): ! ! (1) (2) (3) (4) (5) (6) (7) ! MACH_OP, op_typ, tool_typ, d_tool, r_or_ang, depth, rcs, rsurf ! ! (8) (9) (10) (11) ! stang, finang, zpos, btol ! ! ! ARGUMENTS: ! ! Arguments common to ALL machining operations: ! ! (1) op_typ = machining operation type: ! ! 'd' = drilling / boring ! 'm' = milling ! 't' = turning ! ! If left blank, the algorithm defaults to creating a ! cutting tool with no succesive operations. ! ! (2) tool_typ = tool type: ! ! 'f' = flat cutting tool ! 'b' = ball cutting tool ! 'c' = cone-shaped cutting tool ! ! (3) d_tool = tool diameter ! ! (4) r_or_ang = specification of cutting tool fillet radius OR ! angle ! ! (a) If 'tool_typ' = 'f', then this argument specifies ! the fillet radius of the flat cutting tool. ! ! (b) If 'tool_typ' = 'c', then this argument specifies ! the angle of the conic cutting tool. ! ! NOTE: For 'tool_typ' = 'b', this argument is ignored. ! ! (5) depth = drilling/milling cut depth ! ! (6) rcs = relative coordinate system. The drilling operation ! is performed relative to this C.S. such that: ! ! (a) the drilling/boring operation is normal to the XY plane, ! and centered along the Z axis of this coordinate system. ! ! (b) the drilling/boring operation is in the -Z direction, with ! the cut depth measured from the origin (Z=0) into a part ! volume a depth Z = -depth. (This implies that the +Z axis ! points out of the part volume) ! ! NOTE: 'rcs' may be any coordinate system type. ! ! Argument specific to DRILLING operations: ! ! (7) btol = boolean tolerance value: ! ! 0 (or blank) = 0.0001 (default) ! 1 = 0.001 ! 2 = 0.01 ! ! Note: This argument need only be specified when the volume addition ! or subtraction operations fail at the creation of the tool. ! If an operation fails, then simply go to the next higher level ! boolean tolerance (first 0, then 1, then 2), and reattempt the ! operation. ! ! (3) path_typ = cutting path type: ! ! 'p' = planar ! 't' = turning ! ! ! DESCRIPTION: ! ! The machining operations are of three possible types: ! ! 1.) drilling / boring ! 2.) milling ! 3.) turning ! ! Each machining operation has three possible options for the machine tool: ! ! 1.) flat end cutting tool ! 2.) ball end cutting tool ! 3.) cone-shaped end cutting tool ! ! 1.) DRILLING / BORING ! ! Drilling or boring creates a virtual 'drill bit' that penetrates a volume ! surface at a user-specified depth. The resulting hole profile is that of a ! revolved section of one of the three possible machine tool types. ! ! 2.) MILLING ! ! Milling creates a virtual 'cutting tool' that penetrates a volume surface ! at a user-specified depth and follows a specified cutting path through the ! volume. The resulting mill profile is that of a revolved section of one of ! the three possible machine tool types cutting a path in a volume. ! ! 3.) TURNING ! ! Turning creates a virtual 'cutting tool' that penetrates a volume surface ! at a user-specified depth and follows a circular cutting path around the Z ! axis of the relative coordinate system, 'rcs', and penetrating the volume ! surface. The resulting cut profile is that of a revolved section of one of ! the three possible machine tool types, cutting a circular path into a volume. ! The machine tool is oriented radially with the relative coordinate system. ! ! ! *get,prkey_,active,0,prkey /nopr ! cm,v2bcut_,volu ! optyp_=arg1 ttyp_=arg2 dtool_=arg3 dpth_=arg5 rcs_=arg6 ! *get,opptyp_,parm,optyp_,type ! *if,opptyp_,eq,0,then optyp_='x' *endif ! csys,rcs_ ! *get,acs_,active,,csys *get,acstyp_,cdsy,acs_,attr,kcs ! *if,optyp_,eq,'t',then rsrf_=arg7 sta_=arg8 fina_=arg9 zp_=ar10 ! *if,acstyp_,ne,1,then clocal,csn+10,1,0,0,0,0,0,0 rccs_=csn+10 *else rccs_=rcs_ *endif ! clocal,csn+11,0,rsrf_,sta_,zp_,0,0,90 rcs_=csn+11 *else *if,acstyp_,ne,0,then clocal,csn+10,0,0,0,0,0,0,0 rcs_=csn+10 *endif *endif ! *if,ttyp_,eq,'f',then rtool_=arg4 ! k,,0,0,-dpth_ k,,dtool_/2,0,-dpth_ k,,dtool_/2,0,1 k,,0,0,1 ! create_lines ! ln_fillet,km-2,rtool_ create_area-lines ! *if,optyp_,eq,'x',then asel,s,area,,am revolve_aset,km-2,km-5,360,4 *elseif,optyp_,eq,'d',then asel,s,area,,am revolve_aset,km-2,km-5,360,4 *else arsym,x,am,,,,1,0 *endif ! *set,rtool_, *elseif,ttyp_,eq,'b',then k,,dtool_/2,0,-dpth_+(dtool_/2) k,,dtool_/2,0,1 k,,0,0,1 k,,0,0,-dpth_ ! create_lines,,1 ! clocal,csn+12,1,0,0,-dpth_+(dtool_/2),0,90,0 l,km,km-3 ! init_entity_num ! csys,rcs_ ! create_area-lines ! *if,optyp_,eq,'x',then asel,s,area,,am revolve_aset,km,km-1,360,4 *elseif,optyp_,eq,'d',then asel,s,area,,am revolve_aset,km,km-1,360,4 *else arsym,x,am,,,,1,0 *endif ! csdele,csn+12 *elseif,ttyp_,eq,'c',then angtool_=arg4 ! k,,0,0,-dpth_ k,,dtool_/2,0,-dpth_+((dtool_/2)/tan((angtool_/2)*rconv)) k,,dtool_/2,0,1 k,,0,0,1 ! create_area ! *if,optyp_,eq,'x',then asel,s,area,,am revolve_aset,km-3,km,360,4 *elseif,optyp_,eq,'d',then asel,s,area,,am revolve_aset,km-3,km,360,4 *else arsym,x,am,,,,1,0 *endif ! *set,angtool_, *endif ! *if,optyp_,eq,'x',then bt_=arg7 ! *if,bt_,eq,1,then btol,0.001 *elseif,bt_,eq,2,then btol,0.01 *endif ! vadd,vm-3,vm-2,vm-1,vm btol,defa init_entity_num *elseif,optyp_,eq,'d',then bt_=arg7 ! *if,bt_,eq,1,then btol,0.001 *elseif,bt_,eq,2,then btol,0.01 *endif ! vadd,vm-3,vm-2,vm-1,vm btol,defa init_entity_num ! vsel,s,volu,,vm cm,vcut_,volu init_entity_num ! vsbv,v2bcut_,vcut_,,delete,delete init_entity_num *elseif,optyp_,eq,'m',then *elseif,optyp_,eq,'t',then csys,rccs_ ! k,,rsrf_-dpth_,fina_,zp_ init_entity_num ! l,kp(rsrf_-dpth_,sta_,zp_),km init_entity_num dln_=lm ! aadd,am-1,am init_entity_num ! vdrag,am,,,,,,dln_ ldele,dln_,,,1 ! init_entity_num v1_=vm ! bt__=ar11 ! acs__=acs_ ttyp__=ttyp_ optyp__=optyp_ dtool__=dtool_ dpth__=dpth_ rorang_=arg4 ! cmsel,s,v2bcut_ cm,v2bc__,volu init_entity_num ! csys,rccs_ clocal,csn+13,0,rsrf_,sta_,zp_,0,0,90 ! *if,bt__,eq,1,then btol,0.001 *elseif,bt__,eq,2,then btol,0.01 *endif ! mach_op,,'%ttyp__%',dtool__,rorang_,dpth__,csn+13,bt__ v2_=vm ! csys,rccs_ clocal,csn+13,0,rsrf_,fina_,zp_,0,0,90 ! mach_op,,'%ttyp__%',dtool__,rorang_,dpth__,csn+13,bt__ v3_=vm ! *if,bt__,eq,1,then btol,0.001 *elseif,bt__,eq,2,then btol,0.01 *endif ! vsel,s,volu,,v1_ vsel,a,volu,,v2_ vsel,a,volu,,v3_ cm,vcut_,volu ! init_entity_num vsbv,v2bc__,vcut_,,delete,delete init_entity_num ! *set,rccs_, *set,rsrf_, *set,sta_, *set,fina_, *set,zp_, *set,v1_, *set,v2_, *set,v3_, *set,bt__, *set,ttyp__, *set,dtool__, *set,dpth__, *set,rorang_, cmdele,v2bc__ *endif ! *if,acstyp_,ne,0,then csdele,rcs_ *endif ! init_entity_num ! *get,opptyp__,parm,optyp__,type ! *if,opptyp__,ne,-1,then csys,acs__ *set,acs__, *set,optyp__, *else csys,acs_ *set,acs_ *endif ! csdele,csn+10,csn+13,1 ! lplot ! *set,optyp_, *set,opptyp_, *set,opptyp__, *set,ttyp_, *set,dtool_, *set,dpth_, *set,rcs_, *set,bt_, *set,acstyp_, cmdele,v2bcut_, cmdele,vcut_, *if,prkey_,eq,1,then /go *endif