
! script name: rims.d/planeinvert
! topic: invert elements in XY plane

!A
!A NAME:
!A
!A 	Invert 2D
!A
!A DESCRIPTION:
!A
!A 	This script allows elements in the XY plane to be inverted about
!A 	a line through a reference point at an angle.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick the view that the elements
!B 		will be inverted in.
!B
!B 	REFERENCE POINT ABS X,Y,Z: Enter the X,Y,Z coordinates of the
!B 		reference point.  NOTE: See XYZ INPUT OPTIONS.
!B
!B 	ANGLE: Enter the angle of the line that the elements should be
!B 		inverted about.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: xy plane invert ")

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

ActivateUndo
stat= SetInputFormat("n4","")

Group=CreateGroup("TEMP")

Vnum=PickView("SELECT VIEW FOR SELECTION BOX")
IF (ExitScript(Destination$)) THEN Leave

Stat=PickBox(Group,Vnum,WsPickPen)
IF (ExitScript(Destination$)) THEN Leave


Pt=XyzInput("REFERENCE POINT ",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave


Angle=InputAngle("ANGLE")
IF (ExitScript(Destination$)) THEN Leave

T1=AngleTransform(Pt,90,0,Angle,WsWorkplaneVals)  ! point relative to workplane
T2=InvertInPlane(T1)

G1=TransformGroup(Group,T2,"TEMP1")
ActivateUndo
Stat= AdvanceUndoNumber("invert")
Stat= AddGroupToUndo(WsUBCreateMode,G1,2,WsTrue)

PlotAll
Leave:!
stat= SetInputFormat("n4","")
Stat=DeleteEntity(Pt)
Stat=DeleteEntity(T1)
Stat=DeleteEntity(T2)
Stat=DeleteEntity(Group)
Stat=DeleteEntity(G1)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END


