
! script name: 3druled.d/dynrldenttrans
! 3dtopic: generate solid of translation by moving an entity in XYZ

!A
!A NAME:
!A
!A 	Dynamic Ruled Entity Translation
!A
!A DESCRIPTION:
!A
!A 	This script generates a ruled translation.  This surface is generated
!A 	by taking an entity and moving it in XYZ.  Every point of the entity
!A 	is moved simultaneously in the same direction.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY: Pick the contour to be used to generate a solid of
!B 		translation.
!B
!C NOTES:
!C
!C 	The U contours of a translation are along the entity and the V contours
!C 	are the lines.
!C
!C 	If the entity is in another workplane, the workplane must be
!C 	established before doing the translation.  The shift questions are
!C 	relative to that workplane.
!C

Stat=ChangeLabelStr("ScriptNameStatus","Function: ruled entity translation ")

DIM Destination$[256]
DIM Answer$[256]
REAL Params(0:10)

ActivateUndo
Start:!
Stat=SetPickMask(WsPickNoSurf)
Element=PickEntity("PICK ENTITY ")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Element) THEN Start
Stat=SetPickMask(WsPickAll)


PlotOff
length1= 1.0
P1= ParameterPt(Element,0.0)
X1= XPointValue(P1)
Y1= YPointValue(P1)
Stat= DeleteEntity(P1)
Ps= PointXYZ(X1,Y1,0.0)
Pe= PtIncrXyz(Ps,Length1,0.0,0.0)
C1=RuledTranslation(Element,Length1,0.0,0.0)
Stat= MakeInvisible(C1)
Stat= MakeInvisible(Pe)
PlotOn
Stat= PlotEntity(Ps)
Stat= SetLastPoint(Ps)

Vnum= LastPickView
Params(0)= 0.0
Num_params=1
Stat=SetInputFormat("n4b","")
Stat=DynamicEntity(Vnum,C1,Ps,Pe,WsDynRuledTrans,"PICK ENDPOINT ",Params,Num_params,Element)
IF (ExitScript(Destination$)) THEN
        Stat=DeleteEntity(C1)
        GOTO Leave
END IF
Stat= MakeVisible(Axis_line)
Stat= MakeVisible(Ps)
Stat= MakeVisible(Pe)

Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
Stat= PlotEntity(C1)

ActivateUndo
Stat= AdvanceUndoNumber("ruled surf")
Stat= AddItemToUndo(WsUBCreateMode,C1)
GOTO Start

Leave:!
Stat=SetInputFormat("n4","")
Stat=SetPickMask(WsPickAll)
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
IF NOT LEN(Destination$) THEN
        LOAD "typecontrol"
ELSE
        IF Destination$= "SCRIPTSTART" THEN Start
        IF Destination$= "BACKUP" THEN Start
        LOAD Destination$
END IF
END
