
! script name: pksolids.d/pktaperbody
! solids: apply taper to a body

!A
!A NAME:
!A
!A 	One Sided Taper Body
!A
!A DESCRIPTION:
!A
!A 	This script applies taper to a body
!A
!A
!B INSTRUCTIONS:
!B
!B
!B NOTES:
!B
!B	The taper direction is determined by the positive z axis of
!B	the current workplane.
!B
!B	The following methods are available:
!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 body ")

OPTION BASE 1
DIM Destination$[256]
DIM Answer$[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

Reference_loop:!
E1=WPKPickEntity("PICK REFERENCE EDGE GROUP",WsPKPickEdges)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Start

Pkbody= WPKParentBody(E1)
Pkgroup= WPKContainingGroup(E1,1)
IF NOT WPKIsEntity(Pkgroup) THEN Start

Stat=SetInputFormat("n4","")
E1=WPKPickEntity("PICK PARTING BODY")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Start
Pkparting= WPKParentBody(E1)

WPKClearErrorFlag
Stat= WPKTaperBody(Pkbody,Pkparting,Pkgroup,0,Angle,0.0,Method)

ActivateUndo
Stat= AdvanceUndoNumber("taper body")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck

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