DMM Varkon® Tutorial
A Beginner's Guide to the Varkon Parametric Modeling and CAD Application Development System
By David M. MacMillan


12. Utility Models

  1. Show Widths
  2. Show Pen Colors
  3. Show lfonts (Line Styles)
  4. Square 2D Grid
  5. Square 3D Grid
  6. Visible Coordinate System in 2D
  7. Visible Coordinate System in 3D

12.1 Show Widths

The following MBS module shows a vertical stack of lines through a range of line widths. Lines are displayed with the width number on the left and the Y coordinate of the line, relative to the middle of the first line displayed, on the right. A small line on the right of each line indicates the line's centerline.

The calling syntax is:

showwidth (firstline, numlines, linespacing, linelength);

All parameters are integers.

On my system, pens that draw on the screen seem to be circular in shape, resulting in a radius at each end of the line. However, the pens that plot seem to be lines, and there is no radius on these lines as plotted.

! showwidth.MBS
!
! Draw examples of all line widths
!

global drawing module showwidth(
   int firstline; 
   int numlines; 
   int linespacing;
   int linelength
   );

   vector start, stop;
   float  x1,  y1;
   float  x2,  y2;
   float  dx,  dy;
   int    ix;
   vector textpos;

beginmodule

  dx := linelength;
  dy := linespacing;

  x1 := 0;
  y1 := 0;
  x2 := x1 + dx;
  y2 := 0;

  start := vec (x1, y1);
  stop  := vec (x1, y2 + dy);
  lin_free (#1, start, stop: width=0);
  start := vec (x2, y1);
  stop  := vec (x2, y2 + dy);
  lin_free (#2, start, stop: width=0);

  for ix := firstline to (firstline + numlines - 1) do
     y1 := y1 + dy;
     y2 := y2 + dy;

     start := vec (x1, y1);
     stop  := vec (x2, y2);
     textpos := vec (x1 - 20, y1);
     text (#3, textpos, 0, str(ix, 2, 0));

     lin_free (#4, start, stop: width=ix);
     start := vec (x1, y1);
     stop  := vec (x1, y2 + dy);
     lin_free (#5, start, stop: width=0);
     start := vec (x2, y1);
     stop  := vec (x2, y2 + dy);
     lin_free (#6, start, stop: width=0);

     start := vec (x2 + 5, y2);
     stop  := vec (x2 + 55, y2);
     lin_free (#7, start, stop: width=0);
     textpos := vec (x2 + 20, y2);
     text (#8, textpos, 0, str((ix * 20), 3, 1));
  endfor;

endmodule

To invoke this module to display the lines from 0 to 4 (5 lines total), use, for instance, an active module containing:

GLOBAL DRAWING MODULE test2d();
BEGINMODULE
  part(#1,showwidth(0, 5, 20, 200));
ENDMODULE

showwidth2

To invoke this module to display the lines from 7 to 16 (10 lines total), use, for instance, an active module containing:

GLOBAL DRAWING MODULE test2d();
BEGINMODULE
  part(#1,showwidth(7, 10, 30, 300));
ENDMODULE

showwidth2


Legal Matters

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.4, 1998/06/17. Feedback to dmm@lemur.com
http://www.database.com/~lemur/vk-penwidth.html


Go to the: