
! script name: contours.d/contoursegment
! topic: create a segment of a contour

!A
!A NAME:
!A
!A      Contour Segment 
!A
!A DESCRIPTION:
!A
!A      This script creates a segment contour of a contour.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CONTOUR: Pick the contour.
!B
!B 	START POINT ABS X,Y,Z: Enter the X,Y coordinates of the
!B 		start point of the segment.
!B
!B 	END POINT ABS X,Y,Z: Enter the X,Y coordinates of the
!B 		end point of the segment.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: contour segment ")

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



ActivateUndo
Change_loop:!

Contour=PickGroupEnt("PICK CONTOUR ")
IF (ExitScript(Destination$)) THEN Leave

Ps= XyzInput("START POINT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

Pe= XyzInput("END POINT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

New_contour= ContourSegment(Contour,Ps,Pe,WsFalse)
IF ValidGeometry(New_contour) THEN
	Stat=AutoNumberCont(New_contour)
END IF

ActivateUndo
Stat= AdvanceUndoNumber("contour segment")
Stat= AddgroupToUndo(WsUBCreateMode,New_contour,1,WsTrue)

Stat= DeleteEntity(Ps)
Stat= DeleteEntity(Pe)


GOTO Change_loop

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