
! script name: milacron.d/profilesheet
! var_topic: creates a conical profile sheet body

!A
!A NAME:
!A
!A 	Profile Sheet Body VARIATIONAL
!A
!A DESCRIPTION:
!A
!A	Creates a sheet body for simulation. The body matches the od diameter of the
!A	screw sliced along the axis.
!A
!B INSTRUCTIONS:
!B
!B
!B
!C NOTES:
!C
!C

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

DIM Destination$[256]
DIM Answer$[256]
DIM Section_name$[256]
DIM SectionID$[256]
DIM Name$[256]

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


ActivateUndo
Start:!


Stat= GenerateVarName("Body",Name$)
RecordFunctionOn
Stat= RecordDescr("SHEET BODY: profile sheet ")
Prop_grp= GrpOfUserProps(20000,21000)
P1= GroupElement(Prop_grp,1)
P2= GroupElement(Prop_grp,9999)
V1= FreeParameter("Start Diameter",GetUserValue(P1,"Starting outer diameter:"))
V2= FreeParameter("End Diameter",GetUserValue(P2,"Ending outer diameter:"))
V3= FreeParameter("Total length",(GetUserValue(P2,"Xstart:")+GetUserValue(P2,"Section length:")))
Pc=PointXYZ(0,0,0)
C1= TrapezoidContour(Pc,V3,V1,V2,0.0,0,0)
Pkbody=WPKContPlaneBody(C1)
Stat= WPKNameBody(Pkbody,Name$)
Stat= WPKSetBodyParent(Pkbody)
Stat= DeleteEntity(Pc)
Stat= DeleteEntity(Prop_grp)
Stat= DeleteGroup(C1,WsTrue)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("profile sheet body")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck

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

END

