
! script name: lines.d/orientline3d
! topic: orients line in direction specified by a vector.

!A
!A NAME:
!A
!A 	3D Orient Line
!A
!A DESCRIPTION:
!A
!A 	This script orients a line in the direction af another line.
!A
!B INSTRUCTIONS:
!B
!B 	PICK LINE: Pick the line to be oriented.
!B
!B 	PICK DIRECTION LINE: Pick the direction line.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: vector orient line ")

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

ActivateUndo
DEG
Line_loop:Stat=SetInputFormat("n4","")
Pick_line1:Eline1=PickSpecificEnt("PICK LINE",WsPickLines)
IF ExitScript(Destination$) THEN Leave

Pick_line2:Eline2=PickSpecificEnt("PICK DIRECTION LINE",WsPickLines)
IF ExitScript(Destination$) THEN Leave

ActivateUndo
Stat= AdvanceUndoNumber("orient line")
Stat= AddItemToUndo(WsUBModifyMode,Eline1)

Stat=OrientLine3D(Eline1,Eline2)
Stat= PlotEntity(Eline1)
Stat= PlotEntity(Eline2)

GOTO Line_loop

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


