
! script name: vpksolids.d/vpkcontplnbody
! var_solids: construct a sheet body from a contour

!A
!A NAME:
!A
!A 	Contour Sheet   VARIATIONAL
!A
!A DESCRIPTION:
!A
!A	This script makes a sheet body which corresponds to the interior of
!A	a closed contour.
!A
!A~ image location - images/pkcontoursheet.gif
!A
!B INSTRUCTIONS:
!B
!B	PICK CONTOUR: Pick the synergy contour to be used.
!B 		This contour is unchanged by this operation.
!B
!C NOTES:
!C	
!C	The contour must not be self crossing. An open contour will
!C	automatically be closed by joining the end points.
!C
!C	The contour must be contained in a plane.
!C
!# see also - htdocs/help.d/parasolids.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: contour sheet body")

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

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

Stat= GLPlotOn
Pick_contour:!
Contour=PickGroupEnt("PICK CONTOUR ")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidDependency(Contour) THEN Pick_contour
Stat= EntityNameCheck(Contour,Contour$)

WPKClearErrorFlag
Stat= GenerateVarName("Body",Name$)
RecordFunctionOn
Stat= RecordDescr("SHEET: Contour sheet")
Pkbody=WPKContPlaneBody(Contour$)
Stat= WPKNameBody(Pkbody,Name$)
Stat= WPKSetBodyParent(Pkbody)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("contour sheet")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck
GOTO Pick_contour


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