GRIP subroutine that finds drawings in a file and sets it active
PROC/RSP1
$$ PROGRAM NAME: RETV_DWG.GRS
$$
$$ PURPOSE: Retrieves dwg layout & makes dwg workview.
$$ A return value of 0 for RSP1 indicates no drawings.
$$___________________________________________________________________
$$
NUMBER/RSP1,V,s
STRING/DN1(10,10),LN1(10),size(10),ds1(1),siz(4,1),dwsz(9)
data/siz,'B','C','D','E'
$$
V=0 $$ find all the drawings in the part file...
INEXTN/62
$$
BGN: DN1(V+1)=NEXTN/IFEND,END:
V=V+1
JUMP/BGN:
$$
END: IF/V-1,ER2:,L01:,L00: $$ handle 0, 1, or multiple dwgs
$$___________________________________________________________________
$$
L00: CHOOSE/'SELECT DRAWING',DN1(1..V),DRSP1
JUMP/ER1:,ER1:,,,,,,,,,,,,DRSP1
V=DRSP1-4
$$
L01:
IF/&CURDRW==DN1(V),JUMP/L02: $$ is dwg already active ?
&CURDRW=DN1(V)
$$
L02:
RSP1=1
$$ check for drawing size and units
size=&ATTVL(PART,'D1-DWGSIZ',iferr,er3

$$ dwg size attribute
DS1=substr(size,1,1) $$ get drawing size
$$ set &csize based on drawing size
ifthen/&unit==1
ifthen/DS1=='B' or DS1=='C'
&csize=.125
elseif/DS1=='D' or DS1=='E'
&csize=.156
endif
elseif/&unit==2
ifthen/DS1=='B' or DS1=='C'
&csize=3.2
elseif/DS1=='D' or DS1=='E'
&csize=4.0
endif
endif
JUMP/TRM:
$$___________________________________________________________________
ER1: MESSG/'NO DRAWING SELECTED'
RSP1=0
JUMP/TRM:
$$
ER2: MESSG/'NO DRAWING IN FILE'
RSP1=0
JUMP/TRM:
er3:
drawv/,,,,h,,iferr,er4:
s=intf(h/7.3)
dwsz=siz(s)+'--------'
asatt/part,'D1-DWGSIZ',dwsz
jump/l02:
er4:
messg/'NO DRAWINGS'
jump/trm:
$$
trm:
VIEWLC/VSBL,1..256
$$ &dstate=1
$$ &dstate=2
return
"Wildfires are dangerous, hard to control, and economically catastrophic."
Ben Loosli