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

!A
!A NAME:
!A
!A 	Entity Intersect Contour
!A
!A DESCRIPTION:
!A
!A 	This script creates a point at the intersection of a contour and an
!A 	entity.
!A
!A~ image location - images/entintcont.gif
!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
!B 		the contour to determine the point location.
!B

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

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


ActivateUndo
Pick_loop:!
Stat= SetInputFormat("n4","")
Contour=PickGroupEnt("PICK CONTOUR ")
IF (ExitScript(Destination$)) THEN Leave

Stat=Highlight(Contour,WsPickPen,WsDirArrowOff)

Pick_entity:!
Stat= SetInputFormat("n4a1",",N,")
Element=PickEntity("PICK INTERSECTING ELEMENT, New contour ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "N" THEN Pick_loop
IF NOT ValidGeometry(Element) THEN Pick_entity
Selectpt=LastPickPoint

Pt=EntIntCont(Element,Contour,Selectpt)

Stat=DeleteEntity(Selectpt)

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

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

