[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vmszoo::rc

Title:Welcome To The Radio Control Conference
Notice:dir's in 11, who's who in 4, sales in 6, auctions 19
Moderator:VMSSG::FRIEDRICHS
Created:Tue Jan 13 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1706
Total number of notes:27193

578.0. "Quick & Dirty Instrument Panels" by MAMIE::SCHRADER (Buddy can you Paradigm?) Thu Jun 23 1988 16:21

    A while back, there was some mention of a few of you having p*stsript
    printers. Well, about a month ago one showed up here. For the past
    couple of weeks i've been pecking away at the following piece of
    p*stscript code and have finally gotten it to work. What does this have
    to do with RC, you ask? The subject that I chose for my first
    p*stscript program is an aircraft instrument panel! Anybody with a LN03
    scriptprinter or an LPS40 should be able to print the following code
    and get something that looks like instruments. The nice thing about
    p*stscript is that the position, size, and number of the instruments
    can be changed at will. Each instrument type is defined as a macro and
    as arguments these macros take instrument position, size, and indicator
    positions. I currently have macros defined for an altimeter, a
    tachometer, a clock, a fuel gauge, a compass, and an artificial
    horizon. These are very preliminary and somewhat crude but they're
    probably good enough to make an instrument panel for a sport model.
    With a bit of work they could be improved to be VERY realistic. I've
    got a 3/4 built Aeromaster that i'm going to use one of these instruemt
    panels on. If anybody has comments, suggestions, or wants to improve my
    code then feel free to put them on the table.

    One final point, the last 40 lines or so are where everything important
    is done. EVERYTHING else is either for housekeeping or just sets up
    macros for these last 40 lines to use. 

                     !
                   --+--
G. Schrader     o___<0>___o
                  *  *  *

------------------------ cut here ------------------------------------
save
%%Title: inst_panel.ps
%%Creator: G. Schrader
%%CreationDate: 20-JUN-1988
%%EndComments
/BS {/SV save def % 0.0 792.0 translate .01 -.01 scale
    300 700 translate 1 -1 scale } bind def
/FMTX matrix def
/RDF {WFT SLT 0.0 eq
  {SSZ 0.0 0.0 SSZ neg 0.0 0.0 FMTX astore}
  {SSZ 0.0 SLT sin SLT cos div SSZ mul SSZ neg 0.0 0.0 FMTX astore}
  ifelse makefont setfont} bind def
/SLT 0.0 def
/SI { /SLT exch cvr def RDF} bind def
/WFT /Courier findfont def
/SSZ 1000.0 def
/SS { /SSZ exch 100.0 mul def RDF} bind def
/AF { /WFT exch findfont def /SSZ exch 100.0 mul def RDF} bind def
/MT /moveto load def

/DISC {gsave newpath 0 exch 0 exch 0 359 arc closepath fill grestore} bind def
/XST {exch store} bind def

%local variable definitions
/Inst_x 0.0 def
/Inst_y 0.0 def
/Inst_r 0.0 def
/Inst_ind1 0.0 def
/Inst_ind2 0.0 def
/Inst_ind3 0.0 def
/Scale_start 0.0 def
/Scale_end 0.0 def
/Font_factor 0.003 def

%this macro prints a string on a dial
/PSTRC 
{gsave 
 newpath MT %go to the initial point
 currentpoint 2 index %save the start point and get the string back
 dup stringwidth
 pop SSZ 0.25 mul 
 exch -0.5 mul exch 
 rmoveto %make start point=center
 show %display the string
 moveto %go back to starting point
 pop %discard the original string
 grestore
} bind def

%draw an instrument scale using PSTRC
/Rscale 0.0 def
/Angscale 0.0 def
/Delscale 10.0 def
/INSTSCALE
{gsave
 /Rscale XST
 /Delscale XST
 /Angscale XST
 Rscale Font_factor mul SS
 dup length Delscale exch div /Delscale XST
 {
  {
   dup (|) eq 
    {Angscale rotate 0 Rscale neg PSTRC Angscale neg rotate exit}
    if
   dup (-) eq 
    {Angscale 90 add neg rotate Rscale 0 PSTRC Angscale 90 add rotate exit}
    if
   Angscale sin Rscale mul
   Angscale cos Rscale mul neg
   PSTRC
   exit
  }
  loop
  /Angscale Angscale Delscale add store
 }
 forall
} bind def

%make a needle on an instrument face
/Ind_r 0.0 def
/INDICATOR
{
 /Ind_r XST
 save
 Scale_end Scale_start sub Inst_ind1 mul Scale_start add rotate

 newpath
 0 0 moveto Ind_r 20 div neg 0 lineto
 Ind_r 10 div neg Ind_r 2 div neg lineto 0 Ind_r neg lineto
 Ind_r 10 div Ind_r 2 div neg lineto Ind_r 20 div 0 lineto
 closepath 1 setgray fill 0 setgray stroke

 newpath 0 0 Ind_r 10.0 div 0 359 arc closepath 1 setgray fill 0 setgray stroke
 Scale_end Scale_start sub Inst_ind1 mul Scale_start add neg rotate
 restore
} bind def

%entry setup macro for instrument macros
/PARAM
{
 /Inst_ind1 XST
 /Inst_r XST
 /Inst_y XST
 /Inst_x XST
 save
 Inst_x Inst_y translate
 0 setgray
 /Scale_start 0.0 store
 /Scale_end 360.0 store
} bind def

%use this if 2 parameters are needed
/PARAM2
{
 /Inst_ind2 XST
 PARAM
} bind def

%cleanup macro for instrument macros
/WRAP { 0 setgray Inst_x neg Inst_y neg translate restore } bind def

%make an altimeter
/ALTIMETER
{
 PARAM
 Inst_r DISC
 0.75 setgray
 Inst_r 0.95 mul DISC
 1 setgray
 [ (0) (|) (1) (|) (2) (|) (3) (|) (4) (|) 
   (5) (|) (6) (|) (7) (|) (8) (|) (9) (|) ] 
    Scale_start dup neg Scale_end add Inst_r 0.8 mul INSTSCALE
 %small pointer moves 1 rev per 10K ft
 Inst_ind1 10000.0 div dup truncate sub /Inst_ind1 XST
 Inst_r 0.50 mul INDICATOR
 %long pointer moves 1 rev per 1K ft
 Inst_ind1 10.0 mul dup truncate sub /Inst_ind1 XST
 Inst_r 0.75 mul INDICATOR
 WRAP
} bind def

%make a tachometer
/TACHOMETER
{
 PARAM
 Inst_r DISC
 0.75 setgray
 Inst_r 0.95 mul DISC
 1 setgray
 [ (0) (|) (2) (|) (4) (|) (6) (|) (8) (|) 
   (10) (|) (12) (|) (14) ( ) ] 
   Scale_start dup neg Scale_end add Inst_r 0.8 mul INSTSCALE
 Inst_r 0.75 mul INDICATOR
 WRAP
} bind def

%make a compass
/COMPASS
{
 PARAM
 Inst_r DISC
 0.75 setgray
 Inst_r 0.95 mul DISC
 1 setgray
 [ (N) (-) (|) (-) (E) (-) (|) (-) (S) (-) (|) (-) (W) (-) (|) (-) ]
   Scale_start dup neg Scale_end add Inst_r 0.8 mul INSTSCALE
 Inst_r 0.75 mul INDICATOR
 WRAP
} bind def

%make a clock
/CLOCK
{
 PARAM2
 Inst_r DISC
 0.75 setgray
 Inst_r 0.95 mul DISC
 1 setgray
 [ (12) (|) (1) (|) (2) (|) (3) (|) (4) (|) (5) (|) (5) (|) (7) (|) (8) (|)
   (9) (|) (10) (|) (11) (|) ]
   Scale_start dup neg Scale_end add Inst_r 0.8 mul INSTSCALE
 %small pointer moves 1 rev per 12 hours
 Inst_ind1 12.0 div dup truncate sub /Inst_ind1 XST
 Inst_r 0.50 mul INDICATOR
 %long pointer moves 1 rev per 1K ft
 Inst_ind2 60.0 div dup truncate sub /Inst_ind1 XST
 Inst_r 0.75 mul INDICATOR
 WRAP
} bind def

%make an artificial horizon
/HORIZON
{
 PARAM2
 0.00 setgray Inst_r DISC
 0.30 setgray Inst_r 0.95 mul DISC

 0 setgray newpath 
  Inst_r neg 0 moveto Inst_r 0 lineto
  30 rotate
  Inst_r neg 0 moveto Inst_r 0 lineto
  -60 rotate
  Inst_r neg 0 moveto Inst_r 0 lineto
  -60 rotate
  Inst_r neg 0 moveto Inst_r 0 lineto
  90 rotate
 stroke

 0.75 setgray
 Inst_r 0.75 mul DISC
 newpath 0 0 Inst_r 0.75 mul 0 360 arc closepath 0 setgray stroke

 newpath 0 0 Inst_r 0.70 mul 0 180 arc closepath 0.5 setgray fill

 0 setgray
 newpath currentlinewidth dup 3 mul setlinewidth
  Inst_r 0.50 mul neg 0 moveto Inst_r 0.50 mul 0 lineto 
  0 Inst_r 0.25 mul neg moveto 0 Inst_r 0.25 mul lineto
  setlinewidth stroke
 WRAP
} bind def

%make a fuel gage
/FUEL1
{
 PARAM
 /Scale_start -60.0 store
 /Scale_end    60.0 store
 Inst_r DISC
 0.75 setgray
 Inst_r 0.95 mul DISC
 1 setgray
 [ (E) (-) (-) (-) (|) (-) (-) (-) (F) ]
   Scale_start dup neg Scale_end add Inst_r 0.8 mul INSTSCALE
 Inst_r 0.75 mul INDICATOR
 WRAP
} bind def

%%EndProlog
%%Page: 0 1 

%general setup stuff
BS
0 SI % character slant angle = 0 degrees
15 /Times-Roman AF % character size and font
100 100 moveto % initial point

/inch {72 mul}def

%switch to a finer fill pattern pitch
currentscreen
3 2 roll
2 mul
3 1 roll
setscreen

%make the instrument panel background
 newpath 0 inch 2 inch 1.75 inch 0 180 arcn closepath 0.5 setgray fill
 newpath
-1.75 inch 2 inch moveto
 1.75 inch 2 inch lineto
 1.75 inch 3.5 inch lineto
-1.75 inch 3.5 inch lineto
 closepath
 fill

%put instruments on the panel
 0.00 inch  1.25 inch 0.5 inch 0.00      ALTIMETER
 1.00 inch  1.25 inch 0.3 inch 0.75      FUEL1
-1.00 inch  1.25 inch 0.3 inch 6.00 20.0 CLOCK

-1.10 inch  2.25 inch 0.3 inch 0.70      COMPASS
 0.00 inch  2.35 inch 0.5 inch 0.00 0.00 HORIZON
 1.10 inch  2.25 inch 0.5 inch 0.70      TACHOMETER

showpage
restore

T.RTitleUserPersonal
Name
DateLines
578.1ThanksSNOC01::BROWNTONYTony Brown Sydney, AustraliaThu Jun 30 1988 20:109
    
    What a great idea! I found a Postcript printer the other night and
    printed your panel. Looks pretty good for a sport plane.
    
    Please keep adding to this.  Anyone else interested?
    
    Regards
    Tony
    
578.2Me Me Me...VTMADE::SOUTIEREFri Jul 01 1988 08:456
    I am!  I've got access to a postscript printer, so if you don't
    mind, I'd surely appreciate the info....
    
    Thanx...
    
    Ken
578.3Don't stop now.K::FISHERThere&#039;s a whale in the groove!Fri Jul 01 1988 08:5614
I printed it also.  Neat idea.  I would like to read the code
and figure out how to change things but for lack of time I just
printed one and took it home for my Aeromaster.  This could
get interesting if it became menu driven and you could select
a panel for a J3, F14, etc. plus custom build them.  Along
those lines it would be nice to have a good human interface to
the background color, and size.  The custom menu could list
all the gauges (and radios etc.) available and you could
build up a panel.  Anyone out there want to take on this task?

Bye          --+--
Kay R. Fisher  |
---------------O---------------
================================================================================
578.4BZERKR::DUFRESNEVAXKLR - You make&#039;em, I break&#039;emFri Jul 01 1988 10:216
    decwindows has a POSTCRIPT display feature.  sounds like this would
    be a need little demo ..
    
    md
    
    and no, I'm _not_ volunteering for the task
578.5I'm gonna do more but I dunno whenWOODRO::SCHRADERBuddy can you Paradigm?Fri Jul 01 1988 13:0640
RE: -.*

It's not that hard to get whatever panel layout you want. The way that I
structured the file each instrument "type" is done by what amounts to a
Postscript (tm) subroutine. What this means is that at the end of the file you
just feed one of the subroutines with instrument position, size, indicator
position, etc... for each instrument of each type you want. If you want more
than one of the same time, no problem, just call the subroutine once for each
instrument with different parameters and SHAZAM! the instrument appears. The
thing that makes it REAL easy to get it set up right is the the values you feed
in are the physical size which comes out on the paper (a neat feature of
Postscript). What i'm getting at is that to completely re-do an instrument panel
requires changing only the last few lines in the file so if you're ever wrote
code then modifying the file to do what you want isn't that big of a deal. And,
once you have a good panel for a particular aircraft type, archive it and it's
there forever. If you need a different size, there are some scaling factors at
the beginning of the file that will take the image from pinhead to full page. 

I'd orginally thought that the file was simple enough that i'd just hand modify
it but the flip side is that the structure is fairly clean and a simple menu
system of some sort wouldn't be all THAT hard either. I'll look at it... 

It seems to me that the place to spend time on this thing is developing a
wider/better/more scalelike collection of instruments to choose from.
I havn't had a lot of time to spend but I've been looking at some full
scale pilot's manuals to get a better feel for the panel and instrument
layouts. If I can break any time loose then i'll probably do something like
a radio, maybe some switches and knobs, a glovebox would be easy...
If I come up with anything worthwile then i'll post it.

BTW - "Postscript" is a registered trademark of Adobe so we have to be just
a little careful about using the word indiscriminately. That's why the
(tm) is there. I don't think that there's a problem as long as you throw
in at (tm) every now and then. Could our friendly neighborhood moderator
please look into this????

                     !
                   --+--
G. Schrader     o___<0>___o
                  *  *  *
578.6HELP!VTMADE::SOUTIEREFri Jul 01 1988 14:177
    	I just tried to print this file to the postscript copier, but
    I have to translate it first.  Well I got a message back saying
    that this was not a binary plo file, program terminated!
    	What am I suppose to do?
    
    Ken
578.7Try this...WOODRO::SCHRADERBuddy can you Paradigm?Fri Jul 01 1988 15:2731
re .6

Ken,

    Hmmmmm... I've never seen that message, but a few suggestions...

    First, did you cut my text from the beginning of the file? If you just
    extract it and feed it to the printer as-is then you'll get all sorts
    problems when the printer trys to interpret the text as a postscript
    program. A postscript file is not a file that "prints" in the normal
    sense. It's a program that executes and generates pages of text
    (with all of the good and bad things that this implys).

    Make sure that you are using the right command line to start the printer.
    What I use is ...

	$PRINT/QUE=whatever/FORM=1109/PARAM=(DATA=POSTSCRIPT)/NOTIFY filename

    Have you printed any postscript docuements before? If not then grab
    somebody who knows what print parameters work on your system and see
    if that's the problem.

    If this doesn't solve the problem then i'd go beat up on the system
    manager.

	Good Luck!

                     !
                   --+--
G. Schrader     o___<0>___o
                  *  *  *
578.9You have to work with what you've got!WILKIE::SCHRADERBuddy can you Paradigm?Tue Jul 05 1988 10:1232
RE .8

> What about using VAXsight on any VAX Station . You could generate a any panel
> quickly and then file the produced output in a public access account.
> Interested noters could then copy it to there node, and then by using "Render"
> generate Postscript(tm){if we must} lno3-A3 LA75 or even LJ250 color output
> from the UIS file. 

> FYI if you print that (tm) type stuff on a LN03R it if a better quality than
> the LPS40. 

    I'd thought about doing this and it's a more elegant solution, but
    there were a couple of things that stopped me... 

    One thing is that I don't have access to a VAXstation (or GPX, etc).
    What i've got to work with is nothing but VT100 & 200 class
    non-graphics terminals. 

    The other thing that i'm concerned with is portability. I'm certainly
    not going to wind up with a DEC laser printer at home. But, I most
    certainly might wind up with either an HP or Apple Postscript printer.
    On top of this, the general modeling public is more likely to have
    access to Postscript printers than to DEC printers (due to the
    proliferation of desktop publishing software).

    In short, the tool that is available, uses the equipment that I have
    handy, and meets my forward migration requirements is ... Postscript.

                     !
                   --+--
G. Schrader     o___<0>___o
                  *  *  *
578.11The Postscript Only Rings Once!MJOVAX::BENSON__Frank Benson, DTN 348-2244__Tue Jul 05 1988 16:576
    Any chance of a sixel version of this stuff???
    
                             |                      
   \	       	         ____|____                      /   Regards,
    \________________________O_________________________/    Frank.
    
578.12There isn't a good way to do itWILKIE::SCHRADERBuddy can you Paradigm?Tue Jul 05 1988 18:0224
RE: .11

>    Any chance of a sixel version of this stuff???

Frank,

    I'm not sure. There's supposed to be something (i'm not sure if it's
    actually available yet) called "display Postscript". This is supposed
    to display Postscript images in VAXstations windows. If you could
    get the image into a window then it shouldn't be all that much of a
    problem to get a sixel dump of what's in the window. Even so, the
    image resolution that you'll get this way won't be very good do to
    the relatively poor pixel resolution of the CRT.

    The thing that I don't like about sixels, though, is that you've either 
    got to live with whatever the image looks like or get into bit editing 
    the data to change it (yuck). At least with Postscript you can get
    into the file and re-arrange things at will.

                     !
                   --+--
G. Schrader     o___<0>___o
                  *  *  *