
! script name: drawings.d/drawviewplot
! topic:  plot a drawing view

!A
!A NAME:
!A
!A 	Plot Drawing View
!A
!A DESCRIPTION:
!A
!A 	This script will plot a view in a drawing. It does not set the
!A 	current workplane to this view. The effect of this script
!A 	is essentially like plotting by layers or colors.
!A 	Show all data will return to normal plot mode.
!A
!A
!B INSTRUCTIONS:
!B
!B 	DRAWING NAME: Enter the name to be used for the drawing.
!B
!B 	VIEW NUMBER, Pick: Either input the view to be clipped or
!B 		select P to pick the view. Warning picking may be
!B 		difficult especially on an iges drawing.
!B


stat=ChangeLabelStr("ScriptNameStatus","Function: plot drawing view")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM A$[256]

DeActivateUndo
Start:!

Stat=UserSelectBox("DRAWINGS","selected drawing",WsDrawingSelect,WsDrawingSelect)
IF Stat=1 THEN Leave

Stat=SetInputFormat("a99","")
Stat=GetValue("INPUT DRAWING NAME",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="CANCEL" THEN 
	Stat= SetActiveDrawing
END IF
Name$=Answer$
Drawing= FindNamedEntity(Name$)
IF NOT ValidGeometry(Drawing) THEN Start
LowerSelectBox

View_loop:!
Nviews= NumberDrawingViews(drawing)
IF Nviews=0 THEN Leave
A$= "1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 "
IF Nviews< 15 THEN
        N1= 3*(Nviews-1)+1
        A$= A$[1,N1]
END IF

Stat= SetInputFormat("n0","")
View_num=GetValue("VIEW NUMBER  "&A$,Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF View_num< 1 THEN View_loop

IF ValidGeometry(Drawing) THEN
	Stat= SetActiveDrawing
	Stat= DrawingViewPlot(Drawing,View_num,1,WsTrue)
! 	Stat= SetActiveDrawing(Drawing)
ELSE
	Stat= SetActiveDrawing
END IF
GOTO View_loop

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