
! script name: vsolids.d/solidaxis
! var_topic: construct axis line of picked solid

!A
!A NAME:
!A
!A 	Solid Axis	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script will construct the axis line of the picked solid.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SOLID: Pick the solid to have its axis line constructed.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: solid axis ")

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

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

ActivateUndo
Sloop:!
S1=PickEntity("PICK SOLID")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidDependency(S1) THEN Sloop
Stat= EntityNameCheck(S1,Surface$)

Stat= GenerateVarName(WsLineEnt,Name$)
RecordFunctionOn
Stat= RecordDescr("LINE: Solid axis line")
Stat= SetRecDelLastExec
L1= SolidAxis(Surface$)
Stat= NameEntity(L1,Name$)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord
IF NOT ValidGeometry(L1) THEN
        DelLastVarRecord
ELSE
	ActivateUndo
	Stat= AdvanceUndoNumber("axis line")
	Stat= AddItemToUndo(WsUBCreateMode,L1)
	Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
END IF
GOTO Sloop

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