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

!A
!A NAME:
!A
!A 	Entity Translation
!A
!A DESCRIPTION:
!A
!A 	This script generates a solid of translation.  This solid 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 	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
!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: entity translation ")

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

ActivateUndo
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

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

C1=Translation(0,E1,Xshift,Yshift,Zshift)

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

Leave:!
Stat=SetPickMask(WsPickAll)

IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
