
! script name: contours.d/entintcontour
! topic: create point at intersection of contour and entity

!A
!A NAME:
!A
!A 	entintcontour
!A
!A DESCRIPTION:
!A
!A 	This script creates a point at the intersection of a contour and an
!A 	entity.
!A
!B INSTRUCTIONS:
!B
!B 	PICK AN ELEMENT OF CONTOUR: Pick an element on the contour.
!B
!B 	PICK INTERSECTING ELEMENT: Pick the element that intersects the
!B 		contour to determine the point location.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: entintcontour ")

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


ActivateUndo
Pick_loop:!
Contour=PickEntity("PICK AN ELEMENT OF CONTOUR")
IF (ExitScript(Destination$)) THEN Leave

Selectpt=LastPickPoint

Stat=Highlight(Contour,WsPickPen,WsDirArrowOff)

Element=PickEntity("PICK INTERSECTING ELEMENT ")
IF (ExitScript(Destination$)) THEN Leave


Pt=EntIntCont(Element,Contour,Selectpt)

ActivateUndo
Stat= AdvanceUndoNumber("point")
Stat= AddItemToUndo(WsUBCreateMode,Pt)

Stat=DeleteEntity(Selectpt)
GOTO Pick_loop

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

