
! script name: vpksolids.d/vpkbsurf
! var_solids: convert synergy surface to a sheet body

!A
!A NAME:
!A
!A 	Convert Synergy Surface to Sheet VARIATIONAL
!A
!A DESCRIPTION:
!A
!A	This script will make a sheet body from a synergy surfaces.
!A
!B INSTRUCTIONS:
!B
!B	PICK SURFACE: Pick the synergy surface.	
!B
!C NOTES:
!C
!C	Can be used to convert existing surfaces into a parasolids
!C	sheet body. 
!C
!# see also - htdocs/help.d/parasolids.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: convert surface to sheet ")

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

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

Stat= GLPlotOn
Pick_surface:!

E1=PickEntity("PICK SURFACE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(E1) THEN Pick_surface
Stat= EntityNameCheck(E1,Surface$)

WPKClearErrorFlag
Stat= GenerateVarName("Body",Name$)
RecordFunctionOn
Stat= RecordDescr("SHEET: sheet from synergy surface")
G1=WPKMakeBsurf(Surface$)
Stat= WPKNameBodyGroup(G1,Name$)
Stat= WPKSetBodyParent(G1)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("sheet from synergy surf")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck

GOTO Pick_surface

Leave:!
Stat=SetInputFormat("n4","")
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
