
! topic: construct parallel line through point

! *************** PARALLEL LINE VARIATION 2 ***************
! 
!    To modify a SYNERGY script, the first item is to copy (cp) the original
!    script to another location with a new name ( 14 character limit ).  For
!    example, it might be called parallelvar2
!    To prevent confusion, change the  name of the script in the new script.
!    The name at the top of the original script is:
!        script name: lines.d/parallel
!    Change this line to read:
!        script name: lines.d/parallelvar2
!    The name must also be added to the directory.
!    The original SYNERGY script constructs a line parallel to another line
!    at a specified perpendicular distance, the perpendicular distance
!    question is asked in each question sequence.
!    The new script, parallelvar2 will construct a line parallel to another
!    line through a specified point.
! 
! script name: lines.d/parallelvar2
! 
!    The help file should be modified to accomodate the changes made to the
!    script.  ( If someone, other than the author of the modified script,
!    accesses the script, they will still be able to receive help. )
! 
!A
!A NAME:
!A
!A 	Parallel Line, variation 2
!A
!A DESCRIPTION:
!A
!A 	This script constructs a line parallel to another line through
!A 	a specified point, not on the line.
!A
!B INSTRUCTIONS:
!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 	INPUT ABS X,Y,Z: Enter the X,Y,Z coordinates of the point, through
!B 		which the parallel line will be constructed.
!B

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

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

DEG

! 
!    The section of the script called Line_loop has been modified in
!    parallelvar2.  The point question was added and the distance question
!    ( PARALLEL DISTANCE ) and the pick side question ( PICK LEFT/RIGHT
!    OF LINE ) were eliminated.  The DistPtEntity function was added to
!    calculate the distance between the point and the line.  The Parallel
!    function was used in both.
! 

ActivateUndo
Line_loop:! 

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

Stat=SetInputFormat("n4","")
Pt=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pt) THEN Line_loop

Dist=DistPtEntity(Pt,E1)

L1=Parallel(E1,Dist,WsUNTRIMMED)


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

! 
!    The section called Leave is a necessary section, and in this particular
!    case remained the same in parallel and parallelvar2.
!    The Leave section should ALWAYS include a section for cleaning up
!    unwanted geometry.  In this case, the point used to construct the
!    parallel line is deleted.  In the original script, the point deleted is
!    the point picked to indicate the side the parallel line should be
!    constructed on.
! 

Leave:! 

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

! 
!       The "Leave" section of a script should also include a place to go.
!       The "typecontrol" is a default to wait for further instructions.
!       The "Destination$" is the location of a script that was selected
!       while in this script.
! 

END
