
! script name: surfaces.d/offsetpart
! 3dtopic: make offset surfaces from a group of surfaces

!A
!A NAME:
!A
!A 	Offset: Part
!A
!A DESCRIPTION:
!A
!A 	This script will make offset surfaces from a group of surfaces.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE GROUP: Pick the group of surfaces.
!B
!B	OFFSET: Enter the offset amount to be used for the surfaces.
!B
!C NOTES:
!C
!C 	An offset surface is one of the standard surfaces offset in the normal
!C 	direction by the offset amount.
!C

Stat=ChangeLabelStr("ScriptNameStatus","Function: offset surface group ")

DIM Answer$[256]
DIM Destination$[256]
DIM Name$[256]
DEG

ActivateUndo
Stat=SetInputFormat("n4","")

Current_pen= CurrentColor
Current_layer= CurrentLayer


Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n4","")
Part_group=PickGroupEnt("PICK SURFACE GROUP",WsSurfaceGroup)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Part_group) THEN Pick_loop

Stat=Highlight(Part_group,WsPickPen,WsDirArrowOff)

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(1.0)
Offset=GetValue("OFFSET",Answer$)
IF ExitScript(Destination$) THEN Leave

Offset_group:! 
G1=OffsetSurfGrp(Part_group,Offset)

Stat=GroupName(Part_group,Name$)
Stat=ChangeGrpName(G1,"Offset "&Name$)

Stat= SetColor(G1,Current_pen)
Stat= SetLayer(G1,Current_layer)

ActivateUndo
Stat= AdvanceUndoNumber("offset surface")
Stat= AddGroupToUndo(WsUBCreateMode,G1,1,WsTrue)

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

