
! script name: parasolids.d/pktransparentbody
! solids: make a body transparent

!A
!A NAME:
!A
!A 	Transparent Body
!A
!A DESCRIPTION:
!A
!A 	This script makes a Body transparent.
!A
!B INSTRUCTIONS:
!B
!B 	TRANSLUCENCY: A value of zero and the body will
!B 		be opaque.  A value of 1.0 and it will be transparent.
!B
!B 	PICK BODY: Pick the body that will be transparent.
!B
!B NOTES:
!B
!B 	The transparency is a graphical effect only. The result may
!B 	vary with different graphics cards. It may not necessarily
!B 	be what is expected.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: make a body transparent ")

DIM Destination$[256]
DIM Answer$[256]

ActivateUndo

Stat= GLPlotOn

Ask_translucency:!
Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(.7)
Translucency=GetValue("TRANSLUCENCY: ( 0.0 opaque - 1.0 transparent )")
IF ExitScript(Destination$) THEN Leave

Face_loop:!

E1=WPKPickEntity("PICK BODY",WsPKPickFace)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Face_loop

Pkbody= WPKParentBody(E1)
Stat= WPKTranslucency(Pkbody,Translucency)
Stat= WPKUpdateBody(Pkbody)

ActivateUndo
Stat= AdvanceUndoNumber("body transparent")
Stat= AddItemToUndo(WsUBPKSessionMark)

GOTO Face_loop

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