
! script name: vpksolids.d/vpkbodyisoclines
! var_solids: imprint isocline curves on faces.

!A
!A NAME:
!A
!A 	Imprint isocline curves on a body. VARIATIONAL
!A
!A DESCRIPTION:
!A
!A	This script will create isocline curves on a body. The isocline
!A	curves are the curves which correspond to the place on a face
!A	where tapered draft should start. 
!A 	
!A
!B INSTRUCTIONS:
!B
!B	ANGLE: Enter the draft angle. Measured from the vertical.
!B
!B	PICK BODY: Pick the body.
!B
!B OPTIONS:
!B
!B	The isocline curves are used when draft is to be put on a 
!B	solid for a mold or casting. Faces which are curved in z 
!B	need the isocline curves installed before tapered draft
!B	can be applied. The face is split in two by the isocline
!B	curve, taper is applied to the lower face with the isocline
!B	curve edge as the reference entity.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: body isocline curves ")

OPTION BASE 1
DIM Destination$[256]
DIM Answer$[256]
DIM Body$[256]
DIM Angle_var$[256]


ActivateUndo
Stat= GLPlotOn
Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave
Start:!
Stat= SetAngleEquals(Angle)
Angle=InputAngle("ANGLE")
IF ExitScript(Destination$) THEN Leave
No_angle_var= LastVariableInput(Angle_var$)

Pick_loop:!
Pkbody= WPKCurrentBody
IF NOT WPKIsEntity(Pkbody) THEN
        Stat=SetInputFormat("n4","")
        E1=WPKPickEntity("PICK BODY")
        IF (ExitScript(Destination$)) THEN Leave
        IF NOT WPKIsEntity(E1) THEN Pick_loop
        Pkbody= WPKParentBody(E1)
END IF
Stat= EntityNameCheck(Pkbody,Body$)

WPKClearErrorFlag
RecordFunctionOn
Stat= RecordDescr("BODY: isocline curves")
IF No_angle_var THEN
         V1= FreeParameter("Angle",Angle)
ELSE
         V1= FreeParameter("Angle",Angle_var$)
END IF
E1= WPKBodyIsoclines(Body$,V1)
Stat= WPKNameBody(Body$,Body$)
Stat= WPKSetBodyParent(Body$,1)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("body isocline curves")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck


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