
! script name: points.d/groupintcont
! topic: create points at intersection of contour and group

!A
!A NAME:
!A
!A 	Group Intersect Contour	
!A
!A DESCRIPTION:
!A
!A 	This script creates points at the intersection of a contour and a
!A 	group of entities.
!A
!A
!B INSTRUCTIONS:
!B
!B 	PICK AN ELEMENT OF CONTOUR: Pick an element on the contour.
!B
!B 	PICK INTERSECTING GROUP: Pick the intersecting group.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: group intersect contour ")

DIM Destination$[256]
DIM Answer$[256]
DIM Contour$[256]
DIM Name$[256]
DIM Group$[256]


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

Stat=Highlight(Contour,WsPickPen,WsDirArrowOff)

Pick_group:!
Stat= SetInputFormat("n4","")
Group=PickGroupEnt("PICK GROUP ")
IF (ExitScript(Destination$)) THEN Leave
Stat=Highlight(Group,WsPickPen,WsDirArrowOff)

G1=GroupIntContour(Group,Contour)
IF ValidGeometry(G1) THEN
   N1=CurrHoleGrpNum
   Name$="Point_group"&VAL$(N1)
   Stat=ChangeGrpName(G1,Name$)
   Stat=SetHoleGrpNum(N1+1)
END IF

Stat= PlotEntity(Group)
Stat= PlotEntity(Contour)
Stat= PlotEntity(G1)
IF ValidGeometry(G1) THEN
	ActivateUndo
	Stat= AdvanceUndoNumber("intersect pts")
	Stat= AddGroupToUndo(WsUBCreateMode,G1,1,WsFalse)
END IF
GOTO Pick_contour

Leave:!
Stat= SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END

