
! script name: contours.d/chcornerrad
! topic: change radius on contour corner

!A
!A NAME:
!A
!A 	Change Radius on Contour Corner
!A
!A DESCRIPTION:
!A
!A 	This script allows a corner radius on a contour to be
!A 	changed.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CORNER CIRCLE : Pick an corner radius on the contour.
!B
!B 	NEW RADIUS: Input the new radius to be used on the corner.
!B
!B NOTES:
!B
!B	This function only works on corner circles with the adjacent
!B	elements being lines or circles.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: change corner radius")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]


ActivateUndo
Pick_loop:!
Stat= SetInputFormat("n4","")
Ecircle=PickSpecificEnt("PICK CORNER CIRCLE",WsPickCircles)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Ecircle) THEN Pick_loop
IF IsTypeElement(Ecircle) THEN Pick_loop

Contour= ParentGroup(Ecircle,0)
IF NOT ValidGeometry(Contour) THEN Pick_loop
Element_num=ElementGrpNum(Contour,Ecircle)
IF NOT Element_num THEN Pick_loop
Radius= ABS(CircleRadius(Ecircle))

Stat= SetRadiusEquals(Radius)
Stat= SetInputFormat("n4=","")
Radius= InputRadius("NEW RADIUS ")
IF (ExitScript(Destination$)) THEN Leave

Contour1= CopyGroup(Contour)
ActivateUndo
Stat= AdvanceUndoNumber("change corner rad")
Stat= AddGroupToUndo(WsUBDeleteMode,Contour,1,WsTrue)

Stat= ChContCornerRad(Contour1,Radius,Element_num)

stat= GroupName(Contour,Name$)
Stat= DeleteGroup(Contour,WsTrue)
stat= ChangeGrpName(Contour1,Name$)
Stat= AddGroupToUndo(WsUBCreateMode,Contour1,1,WsTrue)

Stat= PlotEntity(Contour1)

GOTO Pick_loop

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