

START HEADER:
Strategy file name: /usr/weber/database/strategies/Grooving_ID_OD
Instruction 1:   
Instruction 2:   
END HEADER:

START ENTITY REFERENCES:
Xxx.Ext.Ent.Contour1: CONTOUR:   PICK THE CONTOUR TO GROOVE
Xxx.Ext.Ent.P100: POINT:   PICK THE GROOVE START POINT 
Xxx.Ext.Ent.P99: POINT:   PICK THE GROOVE END POINT
END ENTITY REFERENCES:

START TOOL REFERENCES:
END TOOL REFERENCES:
  
START VARIABLE REFERENCES:
END VARIABLE REFERENCES:

START OBJECT: O1
Object paths off:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: POINT: closest point on contour
Stat=NullReference("Xxx.Ext.Ent.Contour1")
Pc=ParameterReturnPt("Xxx.Ext.Ent.P100",0,WsGeomCenter)
Pt=ClosestPtOnCont("Xxx.Ext.Ent.Contour1",Pc)
Stat=NameEntity(Pt,"Xxx.Ent.P1")
Stat=DeleteEntity(Pc)
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: POINT: closest point on contour
Stat=NullReference("Xxx.Ext.Ent.Contour1")
Pc=ParameterReturnPt("Xxx.Ext.Ent.P99",0,WsGeomCenter)
Pt=ClosestPtOnCont("Xxx.Ext.Ent.Contour1",Pc)
Stat=NameEntity(Pt,"Xxx.Ent.P2")
Stat=DeleteEntity(Pc)
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: CONTOUR: Contour segment
Ps=ParameterReturnPt("Xxx.Ent.P1",0,WsGeomCenter)
Pe=ParameterReturnPt("Xxx.Ent.P2",0,WsGeomCenter)
C1=ContourSegment("Xxx.Ext.Ent.Contour1",Ps,Pe,WsFalse)
Stat=AutoNameGroup(C1,"Xxx.Ent.G3")
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: DELETE: Entities
Stat=DeleteEntity("Xxx.Ent.P1")
Stat=DeleteEntity("Xxx.Ent.P2")
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: POINT: Points along contour
V1=FreeParameter("Number points",2)
Group=ArcLengthPts("Xxx.Ent.G3",V1)
Stat=AutoNameGroup(Group,"Xxx.Ent.G5")
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: VARIABLE: Distance two points
Ps=ParameterReturnPt("Xxx.Ent.G5.P1",0,WsGeomCenter)
Pe=ParameterReturnPt("Xxx.Ent.G5.P3",0,WsGeomCenter)
L1=LineTwoPoints(Ps,Pe)
V1=NumericVariable("Xxx_var_groove_width",WsVariationVars,EntityLength(L1))
Stat=SetVariableDescr(V1,"Distance:")
Stat=DeleteEntity(L1)
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: ROUGH AND FINISH GROOVING OPERATION
A = NamedVarVal("Xxx_var_od_vec_value",WsVariationVars,0.0)
V1 = FreeParameter("Right side condition",0)
B = GetVariableVal(V1)
IF A >= B THEN 
Ps=ParameterReturnPt("Xxx.Ent.G5.P2",0,WsGeomCenter)
Pe=ParameterReturnPt("Xxx.Ent.G5.P1",0,WsGeomCenter)
P1=SubtractVectors(Pe,Ps)
V1=NumericVariable("Xxx_var_od_vec_value",WsVariationVars,YPointValue(P1))
Stat=SetVariableDescr(V1,"Y incremental coordinate:")
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
Stat=DeleteEntity(P1)
V2=StringConstant("gr.125_Q1")
V3=StringConstant("odgroove")
V4=StringConstant("/usr/weber/util/tooldata/ltools_in/")
V5=StringConstant(JoinStrings(V4,V3,"/",V2))
Tool_ent=ReadUserData(WsToolData,V2,V5)
Stat=NameEntity(Tool_ent,"Xxx.Ent.Gr.125_Q1")
Stat=PutUserString(Tool_ent,"Tool file name:",V5)
Ps=ParameterReturnPt("Xxx.Ent.G5.P1",0,WsGeomCenter)
Tool=FindUserData("Xxx.Ent.Gr.125_Q1",WsToolData)
V1=FreeParameter("Tool nose radius",ToolNoseRadius(Tool))
V2=FreeParameter("Tool quadrant",ToolQuadrant(Tool))
V3=FreeParameter("Face groove",0)
V4=FreeParameter("Id groove",0)
V5=FreeParameter("Groove width","Xxx_var_groove_width")
V6=FreeParameter("Groove depth","Xxx_var_od_vec_value")
V7=FreeParameter("Bottom radius",0.02)
V8=FreeParameter("Chamfer length",0.05)
V9=FreeParameter("Depth of cut",0.075)
V10=FreeParameter("Finish allowance",0.02)
V11=FreeParameter("Width of cut",0.1)
V12=FreeParameter("Cut type",2)
V13=FreeParameter("Chip clearance",0.01)
V14=FreeParameter("Outside cut",0)
V15=FreeParameter("Tool width",ToolWidth(Tool))
V16=FreeParameter("Tool clearance",0.05)
V17=FreeParameter("Groove type",1)
V20=FreeParameter("Negative diameter",NegDiaCheck(V3,V4,V2))
V18=FreeParameter("Outline color",20)
V19=FreeParameter("Rough path color",23)
Gdef=GrooveDefinition(V17,V3,V4,V20,V5,V6,V7,V8,V14)
Contour=TurnGrooveOutline(Gdef,Ps)
Stat=GrooveDefCutInfo(Gdef,V12,V2,V15,V1,V11,V9,V10,V16,V13)
Path=RoughGroove(Gdef,Ps)
Stat=DeleteEntity(Gdef)
Stat=DeleteEntity(Ps)
Stat=SetColor(Contour,V18)
Stat=SetColor(Path,V19)
Stat=AutoNameGroup(Contour,"Xxx.Ent.G13")
Stat=AutoNameGroup(Path,"Xxx.Ent.G12")
Stat=AssociateTool(Path,Tool)
Ps=ParameterReturnPt("Xxx.Ent.G5.P1",0,WsGeomCenter)
Tool=FindUserData("Xxx.Ent.Gr.125_Q1",WsToolData)
V1=FreeParameter("Tool nose radius",ToolNoseRadius(Tool))
V2=FreeParameter("Tool quadrant",ToolQuadrant(Tool))
V3=FreeParameter("Face groove1",0)
V4=FreeParameter("Id groove1",0)
V5=FreeParameter("Groove width","Xxx_var_groove_width")
V6=FreeParameter("Groove depth","Xxx_var_od_vec_value")
V7=FreeParameter("Bottom radius1",0.02)
V8=FreeParameter("Chamfer length1",0.05)
V10=FreeParameter("Finish allowance1",0)
V12=FreeParameter("Cut type1",0)
V13=FreeParameter("Chip clearance1",0.01)
V14=FreeParameter("Outside cut1",0)
V15=FreeParameter("Tool width",GetUserValue(Tool,"Tool width:"))
V16=FreeParameter("Tool clearance1",0.05)
V17=FreeParameter("Groove type1",1)
V23=FreeParameter("Negative diameter",NegDiaCheck(V3,V4,V2))
V18=FreeParameter("Outline color1",20)
V19=FreeParameter("Finish path color",21)
Gdef=GrooveDefinition(V17,V3,V4,V23,V5,V6,V7,V8,V14)
Contour=TurnGrooveOutline(Gdef,Ps)
Stat=DeleteEntity(Gdef)
P1=ContStartPt(Contour)
P2=ContEndPt(Contour)
L1=LineTwoPoints(P1,P2)
Psplit=ParameterPt(L1,0.5)
Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)
Stat=DeleteEntity(L1)
Gdef=GrooveDefinition(WsChamferGroove,V3,V4,V23,0,0,0,0,0)
Stat=GrooveDefCutInfo(Gdef,V12,V2,V15,V1,0,0,V10,V16,V13)
V20=FreeParameter("Overlap",0.02)
V21=FreeParameter("Lead in type",5)
V22=FreeParameter("Lead in dist",0.05)
Path=GrooveFinishCont(Gdef,Contour,Psplit,V20,V21,V22)
Stat=DeleteEntity(Psplit)
Stat=DeleteEntity(Gdef)
Stat=DeleteEntity(Ps)
Stat=SetColor(Contour,V18)
Stat=SetColor(Path,V19)
Stat=AutoNameGroup(Contour,"Xxx.Ent.G92")
Stat=AutoNameGroup(Path,"Xxx.Ent.G91")
Stat=AssociateTool(Path,Tool)
ELSE
Ps=ParameterReturnPt("Xxx.Ent.G5.P1",0,WsGeomCenter)
Pe=ParameterReturnPt("Xxx.Ent.G5.P2",0,WsGeomCenter)
P1=SubtractVectors(Pe,Ps)
V1=NumericVariable("Id_groove_depth",WsVariationVars,YPointValue(P1))
Stat=SetVariableDescr(V1,"Y incremental coordinate:")
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
Stat=DeleteEntity(P1)
V2=StringConstant("idgr.125_Q4")
V3=StringConstant("idgroove")
V4=StringConstant("/usr/weber/util/tooldata/ltools_in/")
V5=StringConstant(JoinStrings(V4,V3,"/",V2))
Tool_ent=ReadUserData(WsToolData,V2,V5)
Stat=NameEntity(Tool_ent,"Idgr.125_Q4")
Stat=PutUserString(Tool_ent,"Tool file name:",V5)
Ps=ParameterReturnPt("Xxx.Ent.G5.P1",0,WsGeomCenter)
Tool=FindUserData("Idgr.125_Q4",WsToolData)
V1=FreeParameter("Tool nose radius",ToolNoseRadius(Tool))
V2=FreeParameter("Tool quadrant",ToolQuadrant(Tool))
V3=FreeParameter("Face groove",0)
V4=FreeParameter("Id groove",1)
V5=FreeParameter("Groove width","Xxx_var_groove_width")
V6=FreeParameter("Groove depth","Id_groove_depth")
V7=FreeParameter("Bottom radius",0.02)
V8=FreeParameter("Chamfer length",0.05)
V9=FreeParameter("Depth of cut",0.075)
V10=FreeParameter("Finish allowance",0.02)
V11=FreeParameter("Width of cut",0.1)
V12=FreeParameter("Cut type",2)
V13=FreeParameter("Chip clearance",0.01)
V14=FreeParameter("Outside cut",0)
V15=FreeParameter("Tool width",ToolWidth(Tool))
V16=FreeParameter("Tool clearance",0.05)
V17=FreeParameter("Groove type",1)
V20=FreeParameter("Negative diameter",NegDiaCheck(V3,V4,V2))
V18=FreeParameter("Outline color",20)
V19=FreeParameter("Rough path color",23)
Gdef=GrooveDefinition(V17,V3,V4,V20,V5,V6,V7,V8,V14)
Contour=TurnGrooveOutline(Gdef,Ps)
Stat=GrooveDefCutInfo(Gdef,V12,V2,V15,V1,V11,V9,V10,V16,V13)
Path=RoughGroove(Gdef,Ps)
Stat=DeleteEntity(Gdef)
Stat=DeleteEntity(Ps)
Stat=SetColor(Contour,V18)
Stat=SetColor(Path,V19)
Stat=AutoNameGroup(Contour,"Xxx.Ent.G122")
Stat=AutoNameGroup(Path,"Xxx.Ent.G121")
Stat=AssociateTool(Path,Tool)
Ps=ParameterReturnPt("Xxx.Ent.G5.P1",0,WsGeomCenter)
Tool=FindUserData("Idgr.125_Q4",WsToolData)
V1=FreeParameter("Tool nose radius",ToolNoseRadius(Tool))
V2=FreeParameter("Tool quadrant",ToolQuadrant(Tool))
V3=FreeParameter("Face groove1",0)
V4=FreeParameter("Id groove1",1)
V5=FreeParameter("Groove width","Xxx_var_groove_width")
V6=FreeParameter("Groove depth","Id_groove_depth")
V7=FreeParameter("Bottom radius1",0.02)
V8=FreeParameter("Chamfer length1",0.05)
V10=FreeParameter("Finish allowance1",0)
V12=FreeParameter("Cut type1",0)
V13=FreeParameter("Chip clearance1",0.01)
V14=FreeParameter("Outside cut1",0)
V15=FreeParameter("Tool width",GetUserValue(Tool,"Tool width:"))
V16=FreeParameter("Tool clearance1",0.05)
V17=FreeParameter("Groove type1",1)
V23=FreeParameter("Negative diameter",NegDiaCheck(V3,V4,V2))
V18=FreeParameter("Outline color1",20)
V19=FreeParameter("Finish path color",21)
Gdef=GrooveDefinition(V17,V3,V4,V23,V5,V6,V7,V8,V14)
Contour=TurnGrooveOutline(Gdef,Ps)
Stat=DeleteEntity(Gdef)
P1=ContStartPt(Contour)
P2=ContEndPt(Contour)
L1=LineTwoPoints(P1,P2)
Psplit=ParameterPt(L1,0.5)
Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)
Stat=DeleteEntity(L1)
Gdef=GrooveDefinition(WsChamferGroove,V3,V4,V23,0,0,0,0,0)
Stat=GrooveDefCutInfo(Gdef,V12,V2,V15,V1,0,0,V10,V16,V13)
V20=FreeParameter("Overlap",0.02)
V21=FreeParameter("Lead in type",5)
V22=FreeParameter("Lead in dist",0.05)
Path=GrooveFinishCont(Gdef,Contour,Psplit,V20,V21,V22)
Stat=DeleteEntity(Psplit)
Stat=DeleteEntity(Gdef)
Stat=DeleteEntity(Ps)
Stat=SetColor(Contour,V18)
Stat=SetColor(Path,V19)
Stat=AutoNameGroup(Contour,"Xxx.Ent.G201")
Stat=AutoNameGroup(Path,"Xxx.Ent.G200")
Stat=AssociateTool(Path,Tool)
END IF
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: PROPERTY: Hide
Stat=HideEntity("Xxx.Ent.G3")
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: PROPERTY: Hide
Stat=HideEntity("Xxx.Ent.G5.P1")
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: PROPERTY: Hide
Stat=HideEntity("Xxx.Ent.G5.P2")
END RECORD:
     
START RECORD:
Record color: 15
Record layer: 5
Record descr: PROPERTY: Hide
Stat=HideEntity("Xxx.Ent.G5.P3")
END RECORD:
     
END OBJECT: O1
     

