
! script name: 3druled.d/twoentruled
! 3dtopic: construct ruled surface between two entities

!A
!A NAME:
!A
!A 	Ruled: Two Entities
!A
!A DESCRIPTION:
!A
!A 	This script will make a ruled surface between two entities.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY # 1: Pick the entities in order.  
!B
!B 	PICK ENTITY # 2: Pick the entities in order.  
!B
!C NOTES:
!C
!C 	A ruled surface is a linear blend between two entities.  
!C

Stat=ChangeLabelStr("ScriptNameStatus","Function: ruled surface two elements ")

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


ActivateUndo
Blend_loop:!

Pick_entity1: !
Stat=SetInputFormat("n0","")
Stat=SetPickMask(WsPickNoSurf)
E1=PickEntity("PICK ENTITY #1")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(E1) THEN Blend_loop
T1= LastPickPara
Dir1= (T1<= 0.5)*WsForward+ (T1> 0.5)*WsReverse

Stat=SetPickMask(WsPickAll)

Pick_entity2: !
Stat=SetInputFormat("n0","")
Stat=SetPickMask(WsPickNoSurf)
E2=PickEntity("PICK ENTITY #2")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(E2) THEN Blend_loop
T2= LastPickPara
Dir2= (T2<= 0.5)*WsForward+ (T2> 0.5)*WsReverse

Stat=SetPickMask(WsPickAll)

!  WsEqualElementSurf
Ruled_type=1   
Surf1=RuledSurface(Ruled_type,E1,E2,"RULED SURFACE",0,Dir1,Dir2)

ActivateUndo
Stat= AdvanceUndoNumber("ruled surf")
Stat= AddItemToUndo(WsUBCreateMode,Surf1)
GOTO Blend_loop

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