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

!A
!A NAME:
!A
!A 	Reverse Z Pick Workplane	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script reverses the z axis on a picked workplane.
!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]
DIM Ename$[256]


Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

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

Pick_ent:E1=PickEntity("PICK ENTITY FOR WORKPLANE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidDependency(E1) THEN Pick_ent
Stat= EntityNameCheck(E1,Ename$)

RecordFunctionOn
Stat= RecordDescr("WORKPLANE: Existing Workplane")
Work= ReverseZTrans(Ename$)
Stat=SetWorkplane(Work)
RecordFunctionOff
CloseVarRecord

Stat= PlotEntity(Ename$)
IF IsRulerOn THEN PlotAll

Leave:!
stat= SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END

