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

!A
!A NAME:
!A
!A 	Offset: Box
!A
!A DESCRIPTION:
!A
!A 	This script will make offset surfaces from a group of surfaces in a box.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick the view that surfaces are to be
!B 		selected in.
!B
!B 	OFFSET: Enter the offset amount to be used for the group of 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]
DEG

ActivateUndo
Stat=SetInputFormat("n4","")
Active_workplane=0
Work=CurrentWorkplane
IF ValidGeometry(Work) THEN Active_workplane=1

StdWorkplane

Group=CreateGroup("TEMP")

Vnum=PickView("SELECT VIEW FOR SELECTION BOX")
IF ExitScript(Destination$) THEN Leave

Stat=PickBox(Group,Vnum,WsPickPen)
IF ExitScript(Destination$) THEN Leave

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

Offset_group:! 
G1=OffsetSurfGrp(Group,Offset)

ActivateUndo
Stat= AdvanceUndoNumber("offset surfaces")
Stat= AddGroupToUndo(WsUBModifyMode,G1,0,WsFalse)

Stat=DeleteEntity(G1)
Stat=DeleteEntity(Group)

Leave:!
IF Active_workplane THEN
	Stat=SetWorkplane(Work)
ELSE
	StdWorkplane
END IF
Stat=SetInputFormat("n4","")
Stat=DeleteEntity(Group)
Stat=DeleteEntity(G1)

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

