
! script name: zplanes.d/pickworkplane
! topic: pick workplane from element

!A
!A NAME:
!A
!A 	Pick Workplane
!A
!A DESCRIPTION:
!A
!A 	This script allows a workplane to be picked from an element.  This is
!A 	useful for making sure the correct workplane is being used.  NOTE: A
!A 	circle always has a workplane attached to it, a line may not.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY FOR WORKPLANE: Pick an element on the desired workplane.
!B

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

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

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

Stat=SetWorkplane(E1)
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
