
! script name: lines.d/projectline
! topic: project line in 3D space to workplane

!A
!A NAME:
!A
!A 	Project Line to Workplane
!A
!A DESCRIPTION:
!A
!A 	This script allows a line 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 line.
!B
!B 	PICK LINE: Pick the line 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 line to workplane ")

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

stat= SetInputFormat("n4","")
E1=PickEntity("PICK ENTITY FOR PLANE")
IF (ExitScript(Destination$)) THEN Leave

ActivateUndo
Line_loop:!

L1=PickSpecificEnt("PICK LINE",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave

L2=ProjectLine(L1,E1)

ActivateUndo
Stat= AdvanceUndoNumber("line")
Stat= AddItemToUndo(WsUBCreateMode,L2)
GOTO Line_loop

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