
! script name: circles.d/radcenter
! topic: construct circle defined by radius and center

!A
!A NAME:
!A
!A 	Rad: Center
!A
!A DESCRIPTION:
!A
!A 	This script constructs a circle of a known radius about a point.
!A
!B INSTRUCTIONS:
!B
!B 	CIRCLE RADIUS: Enter radius of circle to be constructed.
!B
!B 	INPUT ABS X,Y,Z: Enter the X,Y,Z coordinates of the center point
!B 		of the circle.  NOTE: See XYZ INPUT OPTIONS.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: rad: center ")

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

ActivateUndo
Circle_loop:Stat=SetInputFormat("n4=","")
Radius=InputRadius("CIRCLE RADIUS")
IF (ExitScript(Destination$)) THEN Leave

Stat=SetInputFormat("n4=","")
Pc=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

C1=RadiusCenter(Radius,Pc)


Stat=SetEqualsValue(Radius)
Stat=SetLastPoint(Pc)
Stat=DeleteEntity(Pc)
ActivateUndo
Stat= AdvanceUndoNumber("circle")
Stat= AddItemToUndo(WsUBCreateMode,C1)

GOTO Circle_loop

Leave:!
Stat=DeleteEntity(Pc)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
