
! script name: plot.d/plotbytools
! topic: plot geometry associated with a particular tool

!A
!A NAME:
!A
!A 	Plot By Tool
!A
!A DESCRIPTION:
!A
!A 	This script allows geometry associated with a particular tool
!A 	to be plotted.
!A
!B INSTRUCTIONS:
!B
!B 	INPUT TOOL ID NAME: The TOOLS selection box will appear at this
!B 		time.  Select the tool associated with the geometry to
!B 		be plotted from the select box.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: plot by tool ")

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

Start:!
Stat= RemoveDupTools
Stat=ToolSelectBox("TOOLS","selected tool")
IF Stat=1 THEN Leave

Stat=SetInputFormat("a99","")
E1=PickEntity("INPUT TOOL ID NAME",Answer$)
IF ExitScript(Destination$) OR Answer$= "CANCEL" THEN Leave

IF ValidGeometry(E1) THEN
	Tool=GetAssocTool(E1)
ELSE
        Tool=FindUserData(Answer$,WsToolData)
END IF
IF NOT ValidGeometry(Tool) THEN Start

ClearAll
Stat=PlotToolAssoc(Tool)

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