
! script name: pkgroups.d/pkshowbyattrib
! solids: show faces by attribute

!A
!A NAME:
!A
!A	Show Faces By Attribute
!A
!A DESCRIPTION:
!A
!A	This script establishes a viewing mode where faces matching
!A	an attribute are displayed as rendered with the rest of the 
!A	body displayed in wireframe mode.
!A
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: show faces by attribute ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM Datastr$[2000]

ActivateUndo


Start:!

Pick_loop:!
Stat=SetInputFormat("n4","")
E1=WPKPickEntity("PICK ENTITY")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Pick_loop

Stat= WPKListEntAttdefs(E1,"ATTDEFS","SELECT")
IF Stat THEN Pick_loop
Stat=SetInputFormat("a99","")
Stat=GetValue("ATTRIBUTE NAME",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Name$= Answer$


ON ERROR GOTO Start
Att_num= VAL(Name$)

Datastr$= WPKEntAttribStr(E1,Name$,Att_num)
Pkbody= WPKParentBody(E1)

WPKClearErrorFlag
Stat= GLPlotOn(0)
Stat= WPKShowByAttrib(Pkbody,Name$,Datastr$)


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