
! script name: parasolids.d/vertexblend
! solids: replace a vertex with a blend

!A
!A NAME:
!A
!A 	Vertex Blend
!A
!A DESCRIPTION:
!A
!A 	This script replaces a vertex with a blend on a sheet or wire body.
!A
!B INSTRUCTIONS:
!B
!B	RADIUS: Input the blend radius.
!B
!B	PICK VERTEX: Pick the vertex to be blended.
!B
!B
!C NOTE:
!C
!C	The parent body of the vertex must be a sheet or wire body.
!C
!C	The edges which join at the vertex must have a common plane.
!C
!C	The face having the vertex on the edge must be planar.
!C
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: vertex blend ")

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

ActivateUndo

Stat= GLPlotOn
Ask_radius:!
Stat=SetInputFormat("n4=","")
Stat=SetRadiusEquals(Radius)
Radius=InputRadius("RADIUS")
IF ExitScript(Destination$) THEN Leave

Edge_loop:!
E1=WPKPickEntity("PICK VERTEX",WsPKPickEdge)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Edge_loop
Pt= LastPickPoint

Body= WPKParentBody(E1)
Body_type= WPKBodyType(Body)
IF Body_type= WsPKSolidBody THEN Edge_loop


WPKClearErrorFlag
Stat= WPKVertexBlend(E1,Radius,Pt)
Stat= DeleteEntity(Pt)

ActivateUndo
Stat= AdvanceUndoNumber("vertex blend")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck

GOTO Edge_loop

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