
! script name: solids.d/planeparapt
! 3dtopic: construct plane or disk parallel to existing plane or disk through point

!A
!A NAME:
!A
!A 	Parallel Point
!A
!A DESCRIPTION:
!A
!A 	This script allows a plane to be defined through a point parallel to an
!A 	existing plane or disk.
!A
!B INSTRUCTIONS:
!B	
!B	PICK PARALLEL PLANE: Pick the parallel plane or disk.
!B
!B 	INPUT ABS X,Y,Z: Enter the X,Y,Z coordinates of
!B 		the point, through which the parallel plane or disk
!B 		will be constructed.  NOTE: See XYZ INPUT OPTIONS.
!B
!C NOTES:
!C
!C 	The U contours of a plane are the lines parallel to the length of
!C 	the plane ( parallel to X axis in an unoriented plane ) and the V
!C 	contours are the lines parallel to the width of the plane ( parallel
!C 	to Y axis in an unoriented plane ).
!C
!C 	The U contours of a disk are the circles and the V contours are the
!C 	radial lines.
!C
!# see also - points.d/xyzinput.hlp

Stat=ChangeLabelStr("ScriptNameStatus","Function: plane parallel pt ")

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

ActivateUndo
Plane_loop:!

Stat=SetInputFormat("n4","")
Plane1=PickEntity("PICK PARALLEL PLANE")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(plane1) THEN Line_loop
Etype=EntityType(Plane1)
IF NOT ((Etype=WsPlaneSolidEnt) OR (Etype=WsDiskSolidEnt)) THEN Plane_loop

Stat=SetInputFormat("n4","")
Pe=XyzInput("INPUT ",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

Ps=SurfParameterPt(Plane1,0.0,0.0)
V1=VectorTwoPts(Ps,Pe)
Plane2=VectorCopyEntity(Plane1,V1)
Stat=DeleteEntity(V1)
Stat=DeleteEntity(Ps)
Stat=DeleteEntity(Pe)

ActivateUndo
Stat= AdvanceUndoNumber("plane")
Stat= AddItemToUndo(WsUBCreateMode,Plane2)
GOTO Plane_loop

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