
! script name: parasolids.d/edgeendpts
! solids: edge end points

!A
!A NAME:
!A
!A 	Edge end points.
!A
!A DESCRIPTION:
!A
!A 	This script returns the end points of an edge.
!A
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: edge end points ")

OPTION BASE 1
DIM Destination$[256]
DIM Answer$[256]
REAL Edge_array(100,2)


ActivateUndo
Stat= GLPlotOn
Start:!

Edge_loop:!
Stat=SetInputFormat("n4"")
E1=WPKPickEntity("PICK EDGE",WsPKPickEdge)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Edge_loop

Ps= WPKEdgeEndPoint(E1,WsStart)
Pe= WPKEdgeEndPoint(E1,WsEnd)

ActivateUndo
Stat= AdvanceUndoNumber("edge end points")
IF ValidGeometry(Ps) THEN
	Stat= AddItemToUndo(WsUBCreateMode,Ps)
END IF
IF ValidGeometry(Pe) THEN
	Stat= AddItemToUndo(WsUBCreateMode,Pe)
END IF

GOTO Start

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