
! script name: lines.d/connectcnturs
! topic: connect two contours by joining ends

!A
!A NAME:
!A
!A 	Z Connect Contours
!A
!A DESCRIPTION:
!A
!A 	This script connects two contours by joining the ends of their
!A 	respective elements with trimmed lines.  The contours to be
!A 	connected should have the same number of elements and should
!A 	have been described in the same direction.
!A
!B INSTRUCTIONS:
!B
!B 	PICK FIRST CONTOUR: Pick an element on one of the contours to
!B 		be connected.
!B
!B 	PICK NEXT CONTOUR: Pick an element on the other contour to be
!B 		connected.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: z connect contours ")

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

DeActivateUndo
Active_workplane=0
Work=CurrentWorkplane
IF (ValidGeometry(Work)) THEN Active_workplane=1

Blend_loop:!
stat= SetInputFormat("n4","")

StdWorkplane

E1=PickEntity("PICK FIRST CONTOUR ")
IF (ExitScript(Destination$)) THEN Leave

E2=PickEntity("PICK NEXT CONTOUR ")
IF (ExitScript(Destination$)) THEN Leave

Stat=BlendContours(E1,E2)


GOTO Blend_loop

Leave:!
IF Active_workplane THEN
	Stat=SetWorkplane(Work)
ELSE
	StdWorkplane
END IF
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
