DMM Varkon® Tutorial
A Beginner's Guide to the Varkon
Parametric Modeling and CAD Application Development System
By David M. MacMillan
This page describes how I installed Varkon on my system. This is not necessarily how you should install Varkon on your system, and indeed the procedures described here may not work on your system. These procedures are presented here only in the hope that they may serve as useful hints in Varkon installation.
These procedures describe the installation of Varkon 1.15C. Varkon 1.16A was released in May 1998. I have not yet installed 1.16A on my system, and do not know how its installation may or may not differ from that described here.
I installed the shareware Linux Varkon 1.15C on a Linux 2.0.18 system running XFree86.
In addition to the standard GNU zip (gzip and gunzip) compression program, the Varkon distribution also requires a program that can uncompress the PK-ZIP format. The GNU zip format and the PK-ZIP format are different. I happen to use a program called UnZip (unzip), version 5.12, by "Info-ZIP," but I'm sure there must be several Linux un-PK-ZIPpers.
From the Linux download page reachable from Microform AB's website, download the following files to some appropriate temporary directory (e.g., /tmp)
These files comprise the Linux Varkon 1.15C distribution, the Varkon 1.15C Manual, and the Varkon 1.15C MBS Manual.
Then put permanent copies of the distribution in your source directory (e.g., /usr/local/src).
su -
umask 022
cd /usr/local/src
mkdir varkon_1.15C
cd varkon_1.15C
cp /tmp/varkon.tar.gz .
cp /tmp/v_man.zip .
cp /tmp/m_man.zip .
The umask 022 command is only necessary if you ordinarily set a more restrictive umask. If you're unfamiliar with "umask," then you're probably ok.
Because I use the "/usr/local" convention for isolating additions to my Linux system from the base system, I chose to install Varkon in /usr/local/varkon_1.15C. By installing in a directory named with the exact release of Varkon, other versions of Varkon can also be installed without interfering with this one.
su -
umask 022
cd /usr/local/src/varkon_1.15C
gunzip varkon.tar
cd /usr/local
tar -xvf /usr/local/src/varkon_1.15C/varkon.tar
cd varkon_1.15C
mkdir man
cd man
unzip /usr/local/src/varkon_1.15C/v_man.zip
unzip /usr/local/src/varkon_1.15C/m_man.zip
Note that both v_man.zip and m_man.zip have identical versions of:
So, when the unzip of m_man.zip asks you the following:
replace man.htm? [y]es, [n]o, [A]ll, [N]one, [r]ename:
replace whatis.htm? [y]es, [n]o, [A]ll, [N]one, [r]ename:
replace v3lg-s.jpg? [y]es, [n]o, [A]ll, [N]one, [r]ename:
you can reply y to each.
Then start a web browser such as Netscape, go to the File menu and Open the File:
/usr/local/varkon_1.15C/man/man.htm
and bookmark this page; it is the first page of both the Varkon and Varkon MBS manuals.
The links to the Varkon home page is coded on each page as a link to "index.html" - this won't work on your local copy. Also, in "whatis.htm" the link to Dr. Johan Kjellander's page won't work on your local copy.
Bring up another window under your normal login, and read the Varkon README file.
cd /usr/local/varkon_1.15C
vi README
Follow the instructions for installing Varkon in this README file. As I've set it up here, VARKON_ROOT is /usr/local/varkon_1.15C
Go to another window (so as to keep the README file visible; at which you're logged in as root is a good choice). Then, if you're not yet logged in as root:
su -
umask 022
Then:
cd /usr/local/varkon_1.15C/com/english
cp varkon varkon.0
vi varkon
and make the changes outlined below.
Change
VARKON_ROOT=/usr/varkon_1.15C
to
VARKON_ROOT=/usr/local/varkon_1.15C
Varkon writes it's applications, by default to VARKON_PRD, where
VARKON_PRD=$VARKON_ROOT/app
In my installation, this works out to /usr/local/varkon_1.15C/app
Unfortunately, this directory is writable only by root: drwxr-xr-x
Three options exist:
Applications in the Varkon System Installation Directories
To do this:
cd /usr/local/varkon_1.15C
chmod a+w app
Applications in Some Other World-Writeable Location
Not finished
Applications Local to You
Since the Varkon startup script is just a UNIX shell script, and the variables such as VARKON_PRD in the Varkon startup script are UNIX environment variables, set certain of these variables in your .bashrc file instead of the Varkon startup script. Delete (comment out) the setting of these variables in the Varkon startup script itself.
The Varkon environment variables that must be set are:
First, create the local directory structure that these variables will reference. Log on to your system using your normal user ID and then do something on the order of:
cd
mkdir varkon
cd varkon
mkdir app
mkdir tmp
mkdir pid
To set these variables in your local environment, log onto your normal user ID, then:
cd
vi .bashrc
Add these lines to your .bashrc file:
VARKON_PRD=/home/you/varkon/app; export VARKON_PRD
VARKON_TMP=/home/you/varkon/tmp; export VARKON_TMP
VARKON_PID=/home/you/varkon/pid; export VARKON_PID
Write this file and exit vi.
Then delete or comment out these definitions from the Varkon startup script.
su -
umask 022
cd /usr/local/src/varkon_1.15C/com/english
cp varkon varkon.1
vi varkon
Comment out the two application root definition lines thus:
# Project files (*.PID)
#VARKON_PID=$VARKON_ROOT/pid
#export VARKON_PID
# Temporary files
#VARKON_TMP=$VARKON_ROOT/tmp
#export VARKON_TMP
# Default root for applications
#VARKON_PRD=$VARKON_ROOT/app
#export VARKON_PRD
Write this file and exit vi.
Then the Varkon startup script to your UNIX PATH environment variable. Go to an ordinary window (logged in as you, not root). I use the bash shell (GNU Bourne Again SHell). The following applies only to bash; modify as appropriate for your shell.
cd
vi .bashrc
add the lines:
PATH=$PATH:/usr/local/varkon_1.15C/com/english;export PATH
then execute the command
source .bashrc
in all of the windows in which you'll be running Varkon, or just bring the X Window System down and up.
At this point, Varkon may be started by typing
varkon &
at the commend line.
Varkon comes with a sample project named projekt_1.
However, if you have set up Varkon to look for applications in a location other than the default one based on VARKON_ROOT (as is done in alternatives 2 and 3 above), then if you click on projekt_1 here, Varkon will attempt to look in this new location for projekt_1 and of course fail to find it. When Varkon fails in this way, it (rather confusingly) moves to a random screen on the display (at least it does so on my multi-screen XFree86 setup using the fvwm window manager). When I move back to the screen that I was on, Varkon has displayed the message:
In order to use projekt_1, you must first copy it to the application directory. Assuming that this has been set up in your home directory, do something like this:
su -
cd /home/you/varkon/app
cp -r /usr/local/varkon_1.15C/app/projekt_1/ .
find . -exec chmod a+r {} \;
find . -exec chown dmm.lemur {} \;
chmod a+x projekt_1/
cd projekt_1/
chmod a+x *
exit
The projekt_1 project does not come with a "PID" file. PID files are used to contain the information that tells Varkon where the various components of a project are located. To create a PID file for projekt_1, do the following under your normal user ID:
cd /home/you/varkon/pid
vi projekt_1.PID
Then place the following lines in the new file projekt_1.PID
$VARKON_PRD/projekt_1/job
$VARKON_PRD/projekt_1/lib
$VARKON_PRD/projekt_1/sym
$VARKON_PRD/projekt_1/doc
$VARKON_PRD/projekt_1/mdf/projekt_1.MDF
At present, projekt_1 uses only the job and mdf directories.
As distributed, the executable for the Varkon mbsc compiler is in a directory outside of the ordinary search path, and the environment variable, VARKON_ERM which specifies the location of the file containing the compiler's error message texts is not set. Further, in my version (at least), mbsc writes it's object file (.MBO file) to the current working directory. If MBS source code is kept in the mbs directory, this means that .MBO object code will be written into this directory as well. However, Varkon looks for compiled modules in the lib directory (it will also check the job directory, but I believe that lib is where these object files are intended to reside). It is thus necessary to move or copy the .MBO object file to the job directory after each compilation.
One way to deal with these issues is to create a shell script called mbsc in the executable search PATH:
su -
umask 022
cd /usr/local/varkon_1.15C/com/english
vi mbsc
Then put the following lines in this mbsc shell script:
VARKON_ERM=/usr/local/varkon_1.15C/erm;export VARKON_ERM
/usr/local/varkon_1.15C/bin/mbsc $1 $2 $3 $4 $5 $6 $7
mv $1.MBO ../lib
Then make this shell script executable and then exit root.
chmod a+x mbsc
exit
This shell script must be executed from a directory, such as the mbs directory, from which ../job makes sense. It also requires that when you invoke it the .MBS suffix not be typed.
(Note: using mv instead of cp clears the object file out of the mbs directory. This speeds the editing of MBS files as the bash shell's filename completion function can be used.)
This section contains notes on how I installed a printer driver on my system. This isn't necessarily how you should install it on your system. The printer driver installation process is described in a file included with the standard Varkon distribution. In my installation, this file ended up at:
/usr/local/varkon_1.15C/cnf/plt/CONFIG.TXT
In my particular setup, my preferred output format is the PostScript® page definition language. As distributed, the shareware Linux version of Varkon comes with only a driver for the HP 7475 plotter. (Actually, I can't seem to find this driver on my system; I'm probably not looking in the right place.) I obtained the Linux Postscript driver for Varkon by e-mailing Microform AB and asking for it.
Perhaps "driver" is the wrong term for this program. Obtaining graphical output from Varkon involves plotting the 2D drawing or 3D geometry into a "plot" (.plt) file. This file is a sort of device-independent numerical representation of the drawing or geometry. The Varkon printer and plotter "drivers" are really format conversion programs which transform this plot file into a the native format or language of the output device. They may be invoked from Varkon during the plotting/printing process, but they may also be invoked standalone to convert a plot file to PostScript.
The first step in installing the Varkon plotter/printer services is to read the "CONFIG.TXT" file mentioned above. Following the directions given therein, I chose to place the plotter files in a new directory called
/usr/local/varkon-plot
The Varkon plotter files are intended to be constant in their content and configuration over the various releases of the Varkon system. They are therefore placed outside of the current Varkon installation directories (/usr/local/varkon_1.15C, for example).
Then the plotter configuration files which are presently in their default location in the installed Varkon system directories,
/usr/local/varkon_1.15C/cnf/plt
should be copied (not moved) to this new directory. Finally, the PostScript plotter driver should be copied there as well. (In the example below, it will be assumed that this driver has been unpacked from its e-mail shipping and is temporarily residing in the /tmp directory.)
su -
umask 022
cd /usr/local
mkdir varkon-plot
cd varkon-plot
cp ../varkon_1.15C/cnf/plt/* .
cp /tmp/postscript .
chmod a+rx postscript
The "varkon-plot" directory is intended to be readable by all users on the system, so the environment variable which sets its location, "VARKON_PLT", is set in the global Varkon startup script. On my system, this is:
/usr/local/varkon_1.15C/com/english/varkon
To do this, first become root, as described previously, and move to the Varkon startup directory:
su -
umask 022
cd /usr/local/varkon_1.15C/com/english
Then copy the Varkon startup script to a safe location and edit the original:
cp varkon varkon.2 vi varkon
Change (or comment out) the line:
VARKON_PLT=$VARKON_ROOT/cnf/plt
to (or add):
VARKON_PLT=/usr/local/varkon-plot
The primary effect of this change is to cause the copy of the menu definition file "m135.INC" in this directory to be used instead of the standard one. The next step, then, is to edit this menu definition file so that it reflects this system. First, copy the file to a safe location in case you make a mistake.
cp m135.INC m135.INC.0
Then edit the original file. In my case, I changed this file so that it contained the following:m135 = "PLOTTER" "postscript",a15;
This menu definition file creates a (short) menu called "PLOTTER". This menu contains one item, a button named "postscript". This button invokes a printer/plotter configuration file named "a15". (This seems to be the Varkon conventional filename for a postscript configuration file.) When the "postscript" button is pressed, Varkon uses this "a15" configuration file to determine how to print in PostScript. This configuration file doesn't exist yet; creating it is the next step.
On my system, this a15 configuration file looks like this:
! a15 = postscript
/usr/local/varkon-plot/postscript <
| lpr -P 1ups
act_job
-pf
$VARKON_PLT/postscript.PEN
The first line of this file is a Varkon comment which identifies the file.
The second line specifies the name of the PostScript printer driver ("/usr/local/varkon-plot/postscript"). The "less than" ("<") sign is an indicator that the standard input of this file should be redirected from the Varkon system. (The Varkon printer drivers all read their input from stdin and write their output to stdout.) It is necessary here either to specify the full pathname to the driver's executable ("/usr/local/varkon-plot/postscript") or to ensure that this executable is in the user's search path. This is because while the Varkon system itself can find printer/plotter files such as a15 via the VARKON_PLT environment variable, the Varkon system invokes a UNIX shell script to do the actual printing, and this shell script needs the driver in its PATH environment variable, not in VARKON_PLT. It's safest to specify the full pathname here. However, if you plan to invoke the driver manually to do .PLT to PostScript conversions using driver parameters other than the standard ones you specify in /usr/local/varkon-plot/a15, then it might be a good idea to include /usr/local/varkon-plot in your standard executable search path as well. (E.g., in the PATH environment variable under sh or bash.)
The third line consists of a pipe (vertical bar, or "|") and a print command. It indicates that the output from the printer driver should be piped into the specified print command. On my system, I use the BSD style UNIX print daemon (lpr) and specify a printer named "1ups" (on my system, this printer is a "1-up" (one logical page per printed page) single-sided UNIX printcap filter associated with a PostScript printer).
The fourth line tells Varkon what .PLT file to use as the printer driver's input. "act_job" is a special filename which indicates that a file with the same name as the active job should be used.
The fifth line specifies the command-line options that are passed to the printer driver. In this example, only one option is used, the "-pf" option; this option specifies a file which contains definitions of pen numbers to be used when printing. As of Varkon 1.15C, pen numbers specify only color, not width; width is handled with the "width" attribute in the MBS source code.
In theory, the name of this file should be placed in an optional last line; e.g., a line consisting of:
$VARKON_PLT/varkon.PEN
However, on my system things don't seem to work quite in this fashion. If I specify:
-pf
$VARKON_PLT/varkon.PEN
Then Varkon tries to find not varkon.PEN, but rather postscript.PEN It fails to find this, and prints, instead of the drawing, the error message:
V3: Can't find plotter PEN-file /usr/local/varkon-plot/postscript.PEN
If I try to combine these last two lines into:
-pf $VARKON_PLT/varkon.PEN
then Varkon's behavior is unpredictable. (In doing a Manual Plot, Varkon crashed once, delivered a syntax error another time, and printed a postscript driver usage message a third time.
If I omit the last line, leaving only:
-pf
Then Varkon either crashes or reports a syntax error in line 5.
The workaround for this seems to be to specify:
-pf
$VARKON_PLT/postscript.PEN
and to create a postscript.PEN file. I created this file simply by copying varkon.PEN to postscript.PEN.
Note: Microform has indicated that both the "-pf" option and the penfile specification are obsolete, and should be omitted. I have yet to do this on my system.
The X Window System "resource" file for Varkon is not located in the standard systemwide X resource directory. Rather, it is located in VARKON_ROOT/cnf/ini/english (for the English language version) and it is named "linux". In my installation, this works out to the file:
/usr/local/varkon_1.15C/cnf/ini/english/linux
This file obeys the standard rules for the syntax of an X resource file.
Beyond the visual resources that this X resource file might
be expected to define, it also defines the colors of the Varkon pens.
On my system, this defaults to:
!*
!***Varkon pen colors.
!*
varkon.color_0: White
varkon.color_1: Black
varkon.color_2: DarkRed
varkon.color_3: DarkGreen
varkon.color_4: DarkBlue
varkon.color_5: Red
varkon.color_6: LightGreen
varkon.color_7: LightBlue
varkon.color_8: Brown
varkon.color_9: Yellow
varkon.color_10: Orange
varkon.color_11: Gray
The names of the colors (e.g., "DarkRed") must match those in the systemwide color name file. On my system this is:
/usr/X11R6/lib/X11/rgb.txt
The chances are very good that on your system either this file resides somewhere else or that color names are resolved through a different mechanism (e.g., Xlib searches of other databases).
The 0 color is used as the background of the drawing space, and the 1 color is the default drawing color if none is specified. This results in a default of black drawings on a white background.
Because I tend to prefer a black background, I experimented and reversed these two assignments, drawing in white on a black background. When I printed from this, I discovered that all drawn lines, regardless of their color, get plotted as something. Thus, a line drawn in the 0 color shows up on my printer (in full black, actually), as does a line of color 1, and lines of colors greater than those defined. Colors greater than those defined seem to default to black when used.
The X resource file defines the buttons which appear on the graphics window(s). (It defines, for example, the column of pushbuttons which appears along the left side of the standard drawing window.) Buttons may be positioned anywhere in a graphics window, and may consist either of text or of bitmapped graphics. (I've not experimented with the use of graphics, and so can't say more about this at present.)
I chose to add a new button which invokes interactive function f220, "Compile All Sources." This function compiles all source module; in some cases, this is faster than triggering a compilation by executing f216, "MBS edit," and autocompiling on the way out of the edit session.
To add this button, I performed the following steps:
su -
umask 022
cd /usr/local/varkon_1.15C/cnf/ini/english
cp linux linux.0
vi linux
Then to this file, I added the lines:
varkon.button_15.geometry: 48x20+1+308
varkon.button_15.text: Compile
varkon.button_15.action: f220
Then exit the vi editor and exit from root.
With the exception of any material noted as being in the public domain, the text, images, and encoding of this document are copyright © 1998 by David M. MacMillan.
The author has no relationship with Microform AB, and this Tutorial is neither a product of nor endorsed by Microform AB.
"Varkon" is a registered trademark of Microform AB, Sweden.
This document is licensed for private, noncommercial, nonprofit viewing by individuals on the World Wide Web. Any other use or copying, including but not limited to republication in printed or electronic media, modification or the creation of derivative works, and any use for profit, is prohibited.
This writing is distributed in the hope that it will be useful, but "as-is," without any warranty of any kind, expressed or implied; without even the implied warranty of merchantability or fitness for a particular purpose.
In no event will the author(s) or editor(s) of this document be liable to you or to any other party for damages, including any general, special, incidental or consequential damages arising out of your use of or inability to use this document or the information contained in it, even if you have been advised of the possibility of such damages.
In no event will the author(s) or editor(s) of this document be liable to you or to any other party for any injury, death, disfigurement, or other personal damage arising out of your use of or inability to use this document or the information contained in it, even if you have been advised of the possibility of such injury, death, disfigurement, or other personal damage.
All trademarks or registered trademarks used in this document are the properties of their respective owners and (with the possible exception of any marks owned by the author(s) or editor(s) of this document) are used here for purposes of identification only. A trademark catalog page lists the marks known to be used on these web pages. Please e-mail dmm@lemur.com if you believe that the recognition of a trademark has been overlooked.
Version
1.13, 1998/06/17.
Feedback to dmm@lemur.com
http://www.database.com/~lemur/vk-install.html
Go to the: