
! script name: parasolids.d/pkcheckbodyfaces
! solids: perform a face check on a solid body

!A
!A NAME:
!A
!A 	Check Body Faces
!A
!A DESCRIPTION:
!A
!A 	This script does a face check on the solid body.
!A 	Faces which fail a check may produce errors on some operations. 
!A	Not every fault is a fatal error. If the face can be interrogated
!A	in synergy then we can work with the face to produce cutterpaths.
!A	If the fault is such that the face's trimmed surface cannot be 
!A	obtained from the parasolid modeler then synergy cannot
!A	perform any surface operations on that face. An inquire of that
!A	face will fail and it will yield an error message.	
!A	Some modeling functions may still be available.
!A
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: check body faces")

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

ActivateUndo
Pen_color= CurrentColor
IF ARGC<2 THEN RaiseColorBox

Stat= GLPlotOn
Pick_loop:!

E1=WPKPickEntity("PICK BODY TO BE CHECKED")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Pick_loop

Pkbody= WPKParentBody(E1)
Pen_color= CurrentColor
Stat= WPKCheckBodyFaces(Pkbody,Pen_color)
Stat= WPKCheckBodyEdges(Pkbody,Pen_color)

ActivateUndo
Stat= AdvanceUndoNumber("check body faces")
Stat= AddItemToUndo(WsUBPKSessionMark)

GOTO Pick_loop

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