
! script name: parasolids.d/pkentsepline
! solids: line of separation between two parasolid entities.

!A
!A NAME:
!A
!A 	Two Entity Separation Line
!A
!A DESCRIPTION:
!A
!A 	This script gives a line connecting the closest points of two
!A	parasolid entities.
!A
!B INSTRUCTIONS:
!B
!B	PICK FIRST ENTITY:  Pick the first of the two entities.
!B
!B	PICK SECOND ENTITY: Pick the second of the two entities.
!B
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: ent separation ")

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

ActivateUndo

Stat= GLPlotOn
Body_loop:!

E1=WPKPickEntity("PICK FIRST ENTITY")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Body_loop

E2=WPKPickEntity("PICK SECOND ENTITY")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Body_loop

WPKClearErrorFlag
L1= WPKEntSeparation(E1,E2)

ActivateUndo
Stat= AdvanceUndoNumber("ent separation line")
Stat= AddItemToUndo(WsUBCreateMode,L1)

GOTO Body_loop

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