
! script name: pkswept.d/pksweepent
! solids: construct body by sweeping an entity along a line

!A
!A NAME:
!A
!A 	Sweep: Translate Entity
!A
!A DESCRIPTION:
!A
!A 	This script sweeps an entity a distance in the x,y,z direction. 
!A 	The resulting body is a sheet body.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY TO BE SWEPT: Select the entity to be swept.
!B
!B 	X SHIFT: Amount to be swept in the x direction.
!B
!B 	Y SHIFT: Amount to be swept in the y direction.
!B
!B 	Z SHIFT: Amount to be swept in the z direction.
!B
!# see also - htdocs/help.d/parasolids.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: sweep entity")

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

ActivateUndo

Stat= GLPlotOn
Pick_entity:!
E1=PickEntity("PICK ENTITY TO BE SWEPT")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(E1) THEN Pick_entity

Solid_body= WsFalse

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Xshift)
Xshift=InputDepth("X SHIFT")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Yshift)
Yshift=InputDepth("Y SHIFT")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Zshift)
Zshift=InputDepth("Z SHIFT")
IF ExitScript(Destination$) THEN Leave

Ps= PointXYZ(0,0,0)
Pe= PointXYZ(Xshift,Yshift,Zshift)
L1=LineTwoPoints(Ps,Pe,WsTRIMMED)


WPKClearErrorFlag
Pkbody=WPKSweepContour(E1,L1,Solid_body)

Stat=SetLastPoint(Pe)
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)
Stat=DeleteEntity(L1)
ActivateUndo
Stat= AdvanceUndoNumber("swept entity")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck
GOTO Pick_entity

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