
! script name: 3druled.d/rtranslation
! 3dtopic: generate ruled surface translation by moving a contour in XYZ

!A
!A NAME:
!A
!A 	Ruled Translation
!A
!A DESCRIPTION:
!A
!A 	This script generates a ruled surface translation.  This surface is 
!A	generated by taking a contour and moving it in XYZ.  
!A	Every point of the contour is moved simultaneously 
!A	in the same direction.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CONTOUR: Pick the contour to be used to generate a	translation.
!B
!B 	X SHIFT: Enter the amount the contour is to be shifted in X relative
!B 		to the workplane.
!B
!B 	Y SHIFT: Enter the amount the contour is to be shifted in Y relative
!B 		to the workplane.
!B
!B 	Z SHIFT: Enter the amount the contour is to be shifted in Z relative
!B 		to the workplane.
!B
!C NOTES:
!C
!C 	The U contours of a translation are the contours and the V contours
!C 	are the lines.
!C
!C 	If the contour 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 translation ")

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

ActivateUndo
Cloop:!
Stat=SetInputFormat("n4","")
Stat=SetPickMask(WsPickNoSurf)
Contour=PickGroupEnt("PICK CONTOUR ")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Contour) THEN Cloop
Stat=SetPickMask(WsPickAll)

Stat=Highlight(Contour,WsPickPen,WsDirArrowOff)

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Xshift)
Xshift=GetValue("X SHIFT",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Yshift)
Yshift=GetValue("Y SHIFT",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Zshift)
Zshift=GetValue("Z SHIFT",Answer$)
IF ExitScript(Destination$) THEN Leave

C1=RuledTranslation(Contour,Xshift,Yshift,Zshift)

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

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