patterns

Moderator: Mike Everman

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: patterns

Post by WebPilot » Tue Dec 15, 2009 5:54 pm

 My drawing skills are an odd blend of the old and new. I remember taking drawing lessons in HS using T-squares et al. That served me well since I loved math anyway. There are times I find when using CAD programs, there is no cute way to do something. So I have to do it the old fashioned way and construct it. I sometimes think I have an advantage over one who only started drawing by using computer programs.

 I still have a lot of the stuff you mention, Joe. I bought several sets of KOH-I-NOORs at the fleas for less than the cost of one brand new pen. I only had to buy the cleaning fluid at an arts store to free the clogged wires.

 I try to keep somewhat "up" with modernization, but as cheaply as possible.

 The interested reader will find on the Tools and Construction forum, links to some free cad programs on the thread entitled, CAD Programs - Some free tools, and links. I've used CadStd on win '98 SE and now use QCAD when I do not need all of capabilities found in BricsCAD.

 Now all you have to do is grab a beginner's guide CAD book from your local library or have them borrow it for you and learn how to do something. I've taught myself quite a bit over the years with nothing but a good book.

 Yes, Simon, I'm programming in PS. I did a search, Re: FWE Scalable Cone Patterns, and found you're the only (other) person up here that knows about this wonderful programming language for graphics illustration. I picked up the essentials ... from a book.
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: patterns

Post by WebPilot » Tue Dec 15, 2009 6:18 pm

 Here is a frustum of cone pattern for a B-12 that I did three years ago in PS. I see more efficient ways of programming it, now, but I was just a fledgeling then.

Code: Select all

%!PS-Adobe-3.0

%%Creator: Forrest Eckstein

%%Title:   CC and Tailpipe Frustum Pattern for B-12

%%CreationDate: February 20, 2006



%attempt to draw a cone pattern



72 72 scale % convert from pixels to inches

1 72 div setlinewidth % 1/72 of an inch

%8.182 2.0 translate

4.75 2.0 translate

-55 rotate



0 0 1 setrgbcolor %draw center cross-hairs

0.125 0 moveto

-0.125 0 lineto

0 0.125 moveto

0 -0.125 lineto

stroke



[.0625 .0625] 0 setdash %draw dashed lines to actual pattern

newpath

0 0 moveto

3.7032 121.871 cos mul 3.7032 121.871 sin mul lineto

stroke



newpath

0 0 moveto

3.7032 171.9963 cos mul 3.7032 171.9963 sin mul lineto

stroke



[ ] 0 setdash



newpath %draw the frustum pattern

3.7032 121.871 cos mul 3.7032 121.871 sin mul moveto

0 0 7.182 121.871 171.9963 arc

3.7032 171.9963 cos mul 3.7032 171.9963 sin mul lineto

0 0 3.7032 171.9963 121.871 arcn

gsave

% reset these to fill the pattern with a red color

%1 0 0 setrgbcolor

%fill

grestore

0 setgray

stroke



55 rotate

3.432 0  translate

0.5 setgray



/Times-Roman findfont

%0.167 scalefont % (remember that a point is 1/72 inch and x 12 pts. = 0.167 to get correct size)

% (12 point font is 12/72 = 0.167)

2 12 1 72 div mul mul scalefont

setfont



% Title

-5.5 8.0 moveto

(CC and Tailpipe Frustum) show

-4.9 7.5 moveto

(Pattern for B-12) show



-8.182 -2.0 translate

newpath

0.5 0.5 moveto

7.5 0 rlineto

0 10 rlineto

-7.5 0 rlineto

closepath

stroke



%~~~~~~~~~~~~~~~~

% Draw the Axes

%~~~~~~~~~~~~~~~~



%draw major xtics

% assumes origin is at global coordinates 0.5,0.5 from left corner of paper

/s 0.25 def % the height of the major tic marks



% define a procedure for drawing the tics

/draw-xmajtic{

  /h exch def

  newpath

  .5 h add .5 s 2 div add moveto

  0 s neg rlineto

  stroke

  

  /Times-Roman findfont % have to reduce the size from the title size

  12 72 div scalefont

  % (12 point font is 12/72)

  setfont

  

  % draw x labels

  /xlab 1 array def % define it

  xlab 0 h put % put h in the 1st position - starts with 0

  .5 h add .2 .5 add moveto 

  xlab 0 get ( ) cvs show %http://www.math.ubc.ca/~cass/reed05/ps2.html

} def



0.0 setgray %set to black



%now call the procedure and draw and lable the xtics

%1.5 .625 moveto 0 -.25 rlineto stroke

1 1 7{

  /i exch def

  i draw-xmajtic

  %2.5 .625 moveto 0 -.25 rlineto stroke

} for



%draw minor xtics from 0 to 1

% define a procedure for drawing the minor tics

% again assume the origin is at 0.5,0.5

/draw-xmintic{

  /u exch def % the number of the division, passed

  /t 0.125 def % the height of the minor tic marks

  newpath

  .5 u t mul add .5 t 2 div add moveto

  0 t neg rlineto

  stroke

} def



% now draw the minor tics

%.625 .5625 moveto 0 -.125 rlineto stroke

1 1 7{

  /i exch def

  i draw-xmintic

} for



% now label the Origin

/Times-Roman findfont   

12 72 div scalefont  % (12 point font is 12/72 = 0.167)

setfont

.40 .35 moveto (0) show



%draw ytics

% set up a procedure 

/draw-yticlabel{  

      /u exch def   

      newpath  

      .5 .2 add u .5 add moveto

%-----------------

% draw y labels

%  /tchar 2 string def %this works, too!  from http://www.fho-emden.de/

% ~hoffmann/pstutor22112002.pdf, ppgs. 16-17 of 8.1 Drawing Numbers

%  u tchar cvs show

%-----------------------

% draw y labels - this works, remember 2 spaces in (  ) for the final number 10! 

      /ylab 1 array def % define it

      ylab 0 u put % put u in the 1st position - starts with 0

      ylab 0 get (  ) cvs show %http://www.math.ubc.ca/~cass/reed05/ps2.html

%----------------------- 

      } def  

% now actually draw the y tics and label them   

1 1 10{

      /i exch def

      .5 .125 add i .5 add moveto -.25 0 rlineto stroke  

% now label them 

      i draw-yticlabel

%  i cvs show          

      } for



newpath 

% minor y tics are now drawn



1 1 7 {

      /i exch def      

      .5625 .5 i .125 mul add moveto -.125 0 rlineto stroke

      } for

      

% establish copyright

/Symbol findfont

12 72 div scalefont %0.1667

% (12 point font is 12/72)

setfont

5.5 1.3 moveto (Ó) show %the © symbol has to be shown this way for now ??



/Times-Roman findfont

12 72 div scalefont %0.1667

% (12 point font is 12/72)

setfont

5.65 1.30 moveto (2006 Forrest D. Eckstein) show



showpage
Image

BTW An interpreter and viewer for Postscript are free. For µSoft windows users download Ghostscript and GSView and install it. Copy and Paste the above code in your favorite text editor and save the file as "B-12.ps". Now find the file and 'double left mouse click' it. You will see the pattern. This file can easily be changed to .pdf file format.

 To begin programming, all you need now is a text editor (you already have one) and Google for some beginner's tutorials.
Image

tufty
Posts: 845
Joined: Wed Dec 24, 2003 12:12 pm
Antipspambot question: 0
Location: France
Contact:

Re: patterns

Post by tufty » Tue Dec 15, 2009 8:25 pm

Been a while since I did much with postscript, but I had a play.

I nearly got the tiger jet valve down pat (couldn't find the dynajet valve sizes easily)

Code: Select all

/petal {
	r1 interradius sub 0 moveto			% move to start point
	halfinter rotate				% rotate by half interspacing angle
	r1 interradius sub 0 r1 0 interradius arct	% add a tangent arc
	r2 0 lineto					% and a line
	halfvalve rotate
	r2 tipradius add 0 moveto
	halfvalve neg rotate
	r2 tipradius add 0 r2 0 tipradius arct		% half a tip curve
	halfvalve rotate
	r2 tipradius add 0 moveto
	halfvalve rotate
	r2 tipradius add 0 r2 0 tipradius arct		% half a tip curve
	r1 0 lineto					% and a line
	halfinter rotate
	r1 interradius sub 0 moveto
	halfinter neg rotate
	r1 interradius sub 0 r1 0 interradius arct	% final half arc
	halfinter rotate
} bind def

% Petal valve.  Number of petals on stack
/valve {
	dup
	360 exch div	% get angle of a single valve
	dup /valveangle exch def % define as valve angle
	12 div		% this is half the interspacing angle
	dup /halfinter exch def
	dup
	5 mul		% and half the valve angle itself
	dup /halfvalve exch def
	sin r2 mul	% get sine, multiply by r2 to get the tip radius
	/tipradius exch def % define as such
	sin r1 mul	% get sine of half interspacing angle, multiply by r1 to get the interspacing radius
	/interradius exch def % and define
	newpath
	{ petal } repeat % draw the petals
	r0 0 moveto
	0 0 r0 0 360 arc % and the centre hole
} bind def

% various radii according to tiger jet plan in inches
/r0 203 2 div def
/r1 400 2 div def
/r2 1181 2 div def

200 200 translate
0.072 0.072 scale

10 valve  % draw a valve

stroke showpage
The tip radius calculations are off, though, which shows up better if we (for example) draw a 3 petalled valve alongside the 10 petalled version. Ghostview's rasterisation is horrible, looks lovely when wrapped in pdf.

Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: patterns

Post by WebPilot » Tue Dec 15, 2009 10:22 pm

This is ¼ size.
b-12_fp.gif
b-12_fp.gif (7.01 KiB) Viewed 2479337 times
Image

Post Reply