
! script name: pkattributes.d/vpkcolorbodyedges
! var_solids: assign color to the edges in a  solid body

!A
!A NAME:
!A
!A 	Color Body Edges  VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script colors the edges in a solid body.
!A
!B INSTRUCTIONS:
!B
!B 	PICK BODY TO BE COLORED: Pick the body that will be colored.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: color body edges")

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

ActivateUndo
Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

Pen_color= CurrentColor
IF ARGC<2 THEN RaiseColorBox

Stat= GLPlotOn
Pick_loop:!

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

Pkbody= WPKParentBody(E1)
Stat= EntityNameCheck(Pkbody,Body$)
Pen_color= CurrentColor

WPKClearErrorFlag
RecordFunctionOn
Stat= RecordDescr("BODY: color edges")
V1= FreeParameter("Pen",Pen_color)
Stat= WPKColorEntity(Body$,V1,0,WsTrue)
PlotOn
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord


Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("color edges")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck

GOTO Pick_loop

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