
! script name: surfaces.d/offsetsurf
! 3dtopic: make offset surface from a  surface

!A
!A NAME:
!A
!A 	Offset: Single
!A
!A DESCRIPTION:
!A
!A 	This script allows a surface to have an offset surface made from it.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE: Pick the surface.
!B
!B	OFFSET: Enter the offset amount to be used for the surface.
!B
!C NOTES:
!C
!C 	An offset surface is one of the standard surfaces offset in the
!C 	normal direction by the offset amount.

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

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

ActivateUndo
Start:!
Stat=SetInputFormat("n4","")

Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n0","")
Surf=PickEntity("PICK SURFACE",Answer$)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Surf) THEN Start
Stat=SetPickMask(WsPickAll)

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

Offset:! 
G1=OffsetSurface(Surf,Offset)

ActivateUndo
Stat= AdvanceUndoNumber("offset surface")
Stat= AddItemToUndo(WsUBCreateMode,G1)
GOTO Start

Leave:!
Stat=SetPickMask(WsPickAll)
Stat=SetInputFormat("n4","")

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

