
! script name: lines.d/parallel
! topic: construct line parallel at specified perpendicular distance

!A
!A NAME:
!A
!A 	Parallel Line
!A
!A DESCRIPTION:
!A
!A 	This script constructs a line parallel to another line at a
!A 	specified perpendicular distance.
!A
!B INSTRUCTIONS:
!B
!B 	PARALLEL DISTANCE: The perpendicular distance between the
!B 		original line and the line that will be constructed
!B 		parallel to it.
!B
!B 	PICK PARALLEL LINE: Pick the line referenced for the parallel
!B 		distance.  This line has already been described.  It 
!B 		cannot be described in this script.
!B
!B 	PICK LEFT/RIGHT OF LINE: This indicates the side the parallel
!B 		line will be constructed on.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: parallel line ")

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

DEG

Distr=NamedVarVal("parallel distance",WsSystemVars,.25)

ActivateUndo
Line_loop:!
Stat=SetEqualsValue(Distr)
Stat=SetInputFormat("n4=","")

Distance=GetValue("PARALLEL DISTANCE",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Distr=Distance

E1=PickSpecificEnt("PICK PARALLEL LINE",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(E1) THEN Line_loop

Pt=InputFreePoint("PICK LEFT/RIGHT OF LINE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pt) THEN Line_loop

S1=PtLeftRight(E1,Pt)

Dist=S1*Distance

!C If the following line is unremmed the construction will be an untrimmed line.
!C L1=Parallel(E1,Dist,WsUNTRIMMED)
   L1=Parallel(E1,Dist,WsUNTRIMMED)

!C If the following line is unremmed the construction will be a trimmed line.
!C L1=Parallel(E1,Dist,WsTRIMMED)

Stat=DeleteEntity(Pt)

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

Leave:!
Vdist=CreateVariable("parallel distance",WsSystemVars,Distr)

Stat=DeleteEntity(Pt)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
