
! script name: vpkconvert.d/vpkboundaryedges
! var_solids: explodes the bounding edges of a sheet body

!A
!A NAME:
!A
!A 	Convert Bounding Edges  VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script explodes the bounding edges of a sheet body. The boundary
!A 	edges are those edges which have only one face abutting.
!A
!A~ image location - images/pkboundingedges.gif
!A
!B INSTRUCTIONS:
!B
!B 	PICK SHEET BODY: Pick a sheet body.
!B
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: explode bounding edges ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM Body$[256]

ActivateUndo
Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

Pick_loop:!
E1=WPKPickEntity("PICK SHEET BODY")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Pick_loop

Body= WPKParentBody(E1)
Body_type= WPKBodyType(Body)
IF Body_type<> WsPKSheetBody THEN Pick_loop
Stat= EntityNameCheck(Body,Body$)


Stat= GenerateVarName(WsGroupEnt,Name$)
RecordFunctionOn
Stat= RecordDescr("CONTOUR: boundary edges")
Group= WPKLaminarEdges(Body$)
Stat= AutoNameGroup(Group,Name$)
RecordFunctionOff
IF ValidGeometry(Group) THEN
        Stat= PlotEntity(Group)
        ActivateUndo
        Stat= AdvanceUndoNumber("boundary edges")
        Stat= AddGroupToUndo(WsUBCreateMode,Group,0,WsTrue)
        Keep_record= WsTrue
ELSE
        Keep_record= WsFalse
END IF
RecordFunctionOn
Stat= DeleteEntity(Group)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

IF Keep_record= WsFalse THEN
        DelLastVarRecord
ELSE
        Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
END IF
GOTO Pick_loop

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