
! script name: points.d/projectpt
! topic: project point in 3D space to workplane

!A
!A NAME:
!A
!A 	Project to Workplane
!A
!A DESCRIPTION:
!A
!A 	This script allows a point in 3D space to be projected onto
!A 	a selected workplane.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY FOR PLANE: Pick an entity on the workplane to be
!B 		used for the projection of the point.
!B
!B 	PICK POINT: Pick the point in 3D space to be projected onto the
!B 		selected workplane.  This question will repeat until
!B 		another option is selected.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: project point to workplane ")

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

ActivateUndo
E1=PickEntity("PICK ENTITY FOR PLANE")
IF (ExitScript(Destination$)) THEN Leave

Pt_loop:!

P1=PickSpecificEnt("PICK POINT",WsPickPoints)
IF (ExitScript(Destination$)) THEN Leave

L2=ProjectPt(P1,E1)
ActivateUndo
Stat= AdvanceUndoNumber("point")
Stat= AddItemToUndo(WsUBCreateMode,L2)

GOTO Pt_loop

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