
! script name: zplanes.d/zrevpickwork
! topic: reverse the z axis on a picked workplane

!A
!A NAME:
!A
!A 	Reverse Z Pick Workplane
!A
!A DESCRIPTION:
!A
!A 	This script reverses the z axis on a workplane picked from an entity.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY FOR WORKPLANE: Pick an element on the desired workplane.
!B
!C NOTE:
!C
!C	This script can be most useful when dealing with an iges file
!C	or a solid model. The workplane attached to an entity like a
!C	circle may not have the z axis pointing in the correct direction.
!C	This script creates a workplane with a reversed z axis orientation
!C	to the entities workplane.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: reverse z pick workplane ")

DIM Answer$[256]
DIM Destination$[256]
stat= SetInputFormat("n4","")

E1=PickEntity("PICK ENTITY FOR WORKPLANE")
IF (ExitScript(Destination$)) THEN Leave

T1= ReverseZTrans(E1)
Stat=SetWorkplane(T1)
IF IsRulerOn THEN PlotAll

WplaneEnt= FindNamedVar("current work area",123456)
IF ValidGeometry(WplaneEnt) THEN Stat= DeleteEntity(WplaneEnt)

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