
! script name: hexajet.d/setfeedfactor
! VAR_TOPIC: set tangent and normal taper

!A
!A NAME:
!A
!A 	Set Taper	VARIATIONAL
!A
!A DESCRIPTION:
!A	
!A 	Set taper on a single element.
!A

stat=ChangeLabelStr("ScriptNameStatus","Function: set taper")

DIM Destination$[256]
DIM Answer$[256]
DIM Surface_dir$[80]
DIM Ntaper_var$[256]
DIM Ttaper_var$[256]
DIM Descr$[256]

Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

Start:!
ActivateUndo
Stat= SetInputFormat("n4=","")
Stat= SetEqualsValue(Normal_taper)
Normal_taper= GetValue("NORMAL TAPER ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
No_ntaper_var=LastVariableInput(Ntaper_var$)

Stat= SetInputFormat("n4=","")
Stat= SetEqualsValue(Tangent_taper)
Tangent_taper= GetValue("TANGENT TAPER ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
No_ttaper_var=LastVariableInput(Ttaper_var$)

Pick_ent:!
stat= SetInputFormat("a1",",N,")
E1=PickEntity("PICK ENTITY, New taper ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="N" THEN Start
IF NOT ValidDependency(E1) THEN Pick_ent
Stat=EntityNameCheck(E1,Name1$)

Stat= AdvanceUndoNumber("set taper")
Stat= AddItemToUndo(WsUBModifyMode,E1)

Descr$= "MACHINING: Set taper"
RecordFunctionOn
Stat=RecordDescr(Descr$)
IF No_ntaper_var THEN
	V1=FreeParameter("Normal taper",Normal_taper)
ELSE
	V1=FreeParameter("Normal taper",Ntaper_var$)
END IF
IF No_ttaper_var THEN
	V2=FreeParameter("Tangent taper",Tangent_taper)
ELSE
	V2=FreeParameter("Tangent taper",Ntaper_var$)
END IF
Stat= SetNormalTaper(Name1$,V1)
Stat= SetTangentTaper(Name1$,V2)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
GOTO Pick_ent



Leave:!
stat= SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
