
! script name: invert.d/2dinvdelcont
! topic: 2D invert group of entities and delete original

!A
!A NAME:
!A
!A 	2D Invert and Delete Group
!A
!A DESCRIPTION:
!A
!A 	This script allows a group of entities or a single entity to be
!A 	inverted and the option of the original being deleted.
!A
!B INSTRUCTIONS:
!B
!B 	PICK GROUP TO BE INVERTED: Pick an element on the group to be inverted.
!B
!B 	REFERENCE POINT ABS X,Y,Z: Enter the X,Y,Z coordinates of the point
!B 		to be used as the reference for the invert.
!B 		NOTE: See XYZ INPUT OPTIONS.
!B
!B 	INVERSION ANGLE: Enter the angle about which the entities should be
!B 		inverted.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: 2d invert and delete group ")

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

ActivateUndo
Start: !

stat= SetInputFormat("n4","")

C1=PickGroupEnt("PICK GROUP TO BE INVERTED")
IF ExitScript(Destination$) THEN Leave

IF NOT ValidGeometry(C1) THEN Start
Stat=Highlight(C1,WsPickPen,WsDirArrowOff)

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

stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Angle)
Angle=InputAngle("INVERSION ANGLE")
IF ExitScript(Destination$) THEN Leave

ActivateUndo
Stat= AdvanceUndoNumber("invert")
Stat= AddGroupToUndo(WsUBModifyMode,C1,1,WsTrue)

T1=AngleTransform(Pt,90,0,Angle,WsWorkplaneVals)
T2=InvertInPlane(T1)
Stat= EraseEntity(C1)
Stat=TransGroupTrans(C1,T2,0,1)

Stat= DeleteEntity(Pt)

PlotAll
GOTO Start

Leave: !
stat= SetInputFormat("n4","")
Stat= DeleteEntity(Pt)

!    TransformCleanUp

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