
! script name: circles.d/centerpoint
! topic: construct circle defined by center and tangent point

!A
!A NAME:
!A
!A 	Center: Point
!A
!A DESCRIPTION:
!A
!A 	This script constructs a circle of unknown radius about a point
!A 	tangent to a known point.
!A
!A~ image location - images/centerandpoint.jpg
!B INSTRUCTIONS:
!B
!B 	INPUT CENTER ABS X,Y: Enter the X,Y coordinates of the center point
!B 		of the circle.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	INPUT ABS X,Y: Enter the X,Y coordinates of the known point which
!B 		will be used to construct the circle tangent to this point.
!B
!# see also - points.d/xyzinput.hlp

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

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


DEG

ActivateUndo
stat= SetInputFormat("n4","")
Circle_loop:!
Pt=XyzInput("INPUT CENTER",WsXyOnly)
IF (ExitScript(Destination$)) THEN Leave


E1=XyzInput("INPUT",WsXyOnly)
IF (ExitScript(Destination$)) THEN Leave

C1=CenterTangent(Pt,E1,E1)

Stat=DeleteEntity(Pt)
Stat=DeleteEntity(E1)

ActivateUndo
Stat= AdvanceUndoNumber("circle")
Stat= AddItemToUndo(WsUBCreateMode,C1)

GOTO Circle_loop

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