
! script name: parasolids.d/pkrepairface
! solids: tries to repair a face with a fault

!A
!A NAME:
!A
!A 	Repair Face
!A
!A DESCRIPTION:
!A
!A 	This script tries to repair a face with a fault.
!A
!B INSTRUCTIONS:
!B
!B	PICK FACE: Pick the face to be repaired.
!B
!B OPTIONS:
!B
!B	This script calls a parasolids function which tries
!B	to repair a faulty face. If is looking for self-intersections
!B	and edges which deviate from the surface of the face.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: repair face ")

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

ActivateUndo

Stat= GLPlotOn
Face_loop:!

E1=WPKPickEntity("PICK FACE",WsPKPickFace)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Face_loop

WPKClearErrorFlag
E2= WPKRepairFace(E1)

ActivateUndo
Stat= AdvanceUndoNumber("repair face")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck

GOTO Face_loop

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