
! script name: vpksolids.d/vpktaperfaceedges
! var_solids: apply taper faces adjacent to the faces edges

!A
!A NAME:
!A
!A 	Taper Face Edges  VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script applies taper to the adjacent faces attached to
!A	the selected face. A positive angle will taper faces below
!A	the selected face outward and faces above inward. 
!A	For example, to taper a block, select the top face.
!A
!A
!A~ image location - images/pktaperfaceedges.gif
!A
!B INSTRUCTIONS:
!B
!B	TAPER ANGLE: Input the taper angle.
!B
!B	PICK FACE: Select the face to be used.
!B
!B NOTES:
!B
!B	The taper direction is determined by the positive z axis of
!B	the current workplane.
!B
!B		0,1) PK_taper_method_isocline_c (default)
!B		2)   PK_taper_method_curve_c
!B		3)   PK_taper_method_surface_c
!B		4)   PK_taper_method_offset_c
!B
!B
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: taper face edges")

OPTION BASE 1
DIM Destination$[256]
DIM Answer$[256]
DIM Face$[256]
DIM Body$[256]
DIM Taper_var$[256]

ActivateUndo


Stat= GLPlotOn
Start:!
Method=NamedVarVal("solid taper face method",WsPKSolidsVars,1.0)

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Angle)
Angle=GetValue("TAPER ANGLE",Answer$)
IF ExitScript(Destination$) THEN Leave
IF ABS(Angle)= 0.0 THEN Start
No_taper_var= LastVariableInput(Taper_var$)

Stat=SetInputFormat("n4","")
E1=WPKPickEntity("PICK FACE",WsPKPickFace)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Start
Stat= EntityNameCheck(E1,Face$)
Body$= WPKBodyName(Face$)

WPKClearErrorFlag
RecordFunctionOn
Stat= RecordDescr("SOLIDS: taper face edges")
IF No_taper_var THEN
        V1= FreeParameter("Taper angle",Angle)
ELSE
        V1= FreeParameter("Taper angle",Angle_var$)
END IF
V2= FreeParameter("Method",Method)
E2= WPKTaperFaceEdges(Face$,V1,V2)
Stat= WPKNameBody(Body$,Body$)
Stat= WPKSetBodyParent(Body$,1)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("taper face edges")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck
GOTO Start


Leave:!
V1=CreateVariable("solid taper face method",WsPKSolidsVars,Method)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
