
! script name: 3dintersect.d/sradiallimits
! 3dtopic: limit points for a 3D surface 

!A
!A NAME:
!A
!A	3D Surface radial limits
!A
!A DESCRIPTION:
!A
!A	This function finds the radial limits for a surface.
!A	The function creates circles for the maximum and minimum radii
!A	of the surface relative the the axis line. It also creates points
!A	which represent the maximum and minimum extend along the axis
!A	line of the surface.
!A
!B INSTRUCTIONS:
!B
!B	PICK SURFACE: Pick the surface.
!B
!B	PICK AXIS LINE: Pick the axis line.
!B
!C NOTE:
!C
!C	This function can be used to find the maximum radius that a
!C	surface makes from a rotary axis.
!C	The minimum radius can find the size of an opening in a surface.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: surface radial limits ")

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

Tol=NamedVarVal("3D Part Limits Tol",Ws3DSystemVars,0.040)

ActivateUndo
Start:!

Pick_loop:!

Stat= SetPickMask(WsPickSurfOnly)
stat= SetInputFormat("n4","")
Surface=PickEntity("PICK SURFACE ")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Surface) THEN Pick_loop

Axis_line:Axis_line=PickSpecificEnt("PICK AXIS LINE",WsPickLines)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Axis_line) THEN Axis_line

Group1=SurfRadialLimits(Surface,Axis_line,Tol)
IF NOT ValidGeometry(Group1) THEN Pick_loop

ActivateUndo
Stat= AdvanceUndoNumber("limit points")
Stat= AddGroupToUndo(WsUBCreateMode,Group1,0,WsTrue)
Stat= DeleteEntity(Group1)

GOTO Start


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

END

