
! script name: v4axisturn.d/renumber
! var_topic: renumber sync points

!A
!A NAME:
!A	
!A	Renumber Sync Points on a Contour VARIATIONAL
!A
!A DESCRIPTION:
!A
!A	This script will renumber the sync points on a contour.
!A
!B INSTRUCTIONS:
!B
!B	PICK CONTOUR: Pick the contour with the sync points.
!B
!B	STARTING SYNC NUMBER: Input the starting number.
!B
!C NOTE:
!C
!C	if two contours are to be machined on a four axis lathe then
!C	both contours must have the same number of sync points. The numbers
!C	assigned here are for reference only, they are not used by
!C	the turbo post.
!C
!C
!C	This script is not set up to allow the Starting Number to be
!C	a variable. This may be done after the record is created by
!C	changing the free parameter into a variable.
!C
!# see also - htdocs/help.d/fouraxisturn.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: Renumber sync points ")

DIM Answer$[256]
DIM Destination$[256]
DIM Contour$[256]
DEG

Var_object=CheckVarObject
IF ExitScript(Destination$) THEN Leave

Pen_color= 2
Start_num= 100
Increment= 1

ActivateUndo
Pick_contour: !
Stat=SetInputFormat("n4","")
Contour=PickGroupEnt("PICK CONTOUR")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidDependency(Contour) THEN Pick_contour
Stat=EntityNameCheck(Contour,Contour$)

Stat=SetEqualsValue(Start_num)
Stat=SetInputFormat("n4=","")
Start_num=GetValue("STARTING SYNC NUMBER",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Stat= DeleteGroup(Group,WsTrue)

ActivateUndo
Stat= AdvanceUndoNumber("renumber sync pts")
Stat= AddGroupToUndo(WsUBModifyMode,Contour$,1,WsTrue)

RecordFunctionOn
Stat=RecordDescr("FOUR AXIS TURN: Number Sync Points")
V1= FreeParameter("Start number",Start_num)
V2= FreeParameter("Increment",Increment)
Stat= NumberSyncPoints(Contour$,V1,V2)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= AddItemToUndo(WsUBCreateMode,Curr_record)

Group= ContourSyncPoints(Contour)
Stat= SetForceVisible(Group,WsTrue)
Stat= SetColor(Group,Pen_color)

GOTO Pick_contour

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


