
! script name: vzplanes.d/pickworkplane
! var_topic: pick workplane from element

!A
!A NAME:
!A
!A 	Pick Workplane	VARIATIONAL
!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]
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")
Stat=SetWorkplane(Ename$)
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

