summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/Chuck.m4
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-12-21 03:01:35 +0000
committerNorbert Preining <norbert@preining.info>2020-12-21 03:01:35 +0000
commit4cc7922324b7a08ba0418e8f245cf1dcfa1891ac (patch)
treecd90cb6c072285e779f7555a85966b81a8757e15 /graphics/circuit_macros/examples/Chuck.m4
parent2d9d44100d72263a7df34c12aaa89dbe6ee6fe0c (diff)
CTAN sync 202012210301
Diffstat (limited to 'graphics/circuit_macros/examples/Chuck.m4')
-rw-r--r--graphics/circuit_macros/examples/Chuck.m4162
1 files changed, 65 insertions, 97 deletions
diff --git a/graphics/circuit_macros/examples/Chuck.m4 b/graphics/circuit_macros/examples/Chuck.m4
index 152d4b87db..2e36626c5b 100644
--- a/graphics/circuit_macros/examples/Chuck.m4
+++ b/graphics/circuit_macros/examples/Chuck.m4
@@ -1,53 +1,28 @@
.PS
-threeD_init s_init(Views) sinclude(tst.dim)
-#
# Chuck.m4
+threeD_init s_init(Views) sinclude(tst.dim)
#
+#################################################################
divert(-1)
- `Dimensioning for diagrams
- dimension_(linespec,vert offset,
- label,blank width,tic offset,<-|->,R)'
-define(`dimension_',`rpoint_(`$1') ; {
- define(`m4h',`(rp_len ifelse((`$4'),(),,`-($4)'))')dnl
- ifelse((`$2'),(),,`if (`$2') != 0 then {
- {move to rvec_(0, ifelse(`$5',,`sign($2)*3.6bp__',`$5'))
- line to rvec_(0,`$2')}
- {move to rvec_(rp_len,ifelse(`$5',,`sign($2)*3.6bp__',`$5'))
- line to rvec_(0,`$2')}
- move to rvec_(0,`$2') }')
- if m4h > 2*arrowht then {
- { line ifelse(`$6',,<-,index($6,<),0,<-) to rvec_(m4h/2,0)
- ifelse((`$4'),(),,`move to rvec_(($4),0)')
- line ifelse(`$6',,->,eval(index($6,>)>0),1,->) to rvec_(m4h/2,0) }
- } else {
- { arrow from rvec_(-arrowht*1.5,0) to Here
- arrow from rvec_(rp_len+arrowht*1.5,0) to rvec_(rp_len,0) }
- }
- define(`m4txt',`ifelse(`$7',,
- `ifelse(index(`$3',"),0,`$3',"`$3'")',
- `ifdef(`pstricks_',`sprintf("\rput{%g}(0,0){`$3'}",rp_ang*rtod_)',`"$3"')')')
- ifelse(`$3',,,`m4txt at rvec_(rp_len/2,0)')
- }')
-define(`rottxt',
- `ifdef(`pstricks_',`sprintf("\rput{%g}(0,0){`$2'}",`$1')')')
- `rotate(angle,at pos, objects at origin)'
-define(`rotate',
- `ifdef(`pstricks_',`M4tmp: "" ifelse(`$2',,Here,`$2')
- sprintf("\rput{%g}(%g,%g){`$3'}",`$1',M4tmp.x/scale,M4tmp.y/scale)')')
- `r_box(angle,pos,string)'
-define(`crl',`int(`($1)'/scale*1000000)/1000000')
+ `r_box(angle,pos,string)
+ Rotated text on a white background
+ (requires pstricks)'
define(`r_box',
- `ifdef(`pstricks_',`M4tmp: ifelse(`$2',,Here,`$2')
+ `ifpstricks(`M4tmp: ifelse(`$2',,Here,`$2')
command sprintf("\rput{%g}(%g,%g){",`$1',crl(M4tmp.x),crl(M4tmp.y))
- w_box(`$3') at Orig
+ f_box(`$3') at Orig
command "}%"')')
- `r_dimen(linespec,offset,label,tic offset,<->,pos)'
+define(`crl',`int(`($1)'/scale*1000000)/1000000')
+
+ `r_dimen(linespec,offset,label,tic offset,<->,pos)
+ dimension_ with rotated text on white background'
define(`r_dimen',
`M4tmp: dimension_(`$1',`$2',,,`$4',`$5')
r_box(rp_ang*rtod_,ifelse(`$6',,M4tmp+vec_(0,`$2'),`$6'),`$3')')
- `ctrline(linespec,len)'
+ `ctrline(linespec,len)
+ Centerline'
define(`cdashl',0.1*scale)
define(`cgapl',0.03*scale)
define(`ctrline',`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1'))
@@ -58,7 +33,8 @@ define(`ctrline',`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1'))
move to rvec_(cgapl,0); line to rvec_(cdashl,0); move to rvec_(cgapl,0)
line thick dimensionth to rvec_(rp_len/m4n/2-cdashl/2-cgapl,0) } ')
- `ctrarcr(pos,radius,startang,endang,len)'
+ `ctrarcr(pos,radius,startang,endang,len)
+ Arc cr centerline'
define(`ctrarcr',`dnl
define(`m5h',ifelse(`$5',,1*scale,`$5'))dnl
rp_len = abs((`$2')*(`$4'-(`$3')))
@@ -79,6 +55,7 @@ define(`ctrarcr',`dnl
} ')
divert(0)dnl
+#################################################################
scale = 25.4*2
tic = 3.6bp__
@@ -90,9 +67,9 @@ command "{\sf"
#include(Lettering.m4)
#Letter_init
-define(`visible',`linethick_(visibleth)')
-define(`hidden',`linethick_(hiddenth)')
-define(`dimension',`linethick_(dimensionth)
+define(`visible_thick',`linethick_(visibleth)')
+define(`hidden_thick',`linethick_(hiddenth)')
+define(`dimension_thick',`linethick_(dimensionth)
arrowwid = 1.5*arrowwid; arrowht = 1.5*arrowht; ')
d1 = 230
@@ -104,7 +81,7 @@ d3 = 140
hiddenth = dimensionth
Orig: Here
-visible
+visible_thick
D3: circle diam d3 at Orig
D2: circle diam d2 at Orig
@@ -115,42 +92,32 @@ visible
X1: rect_(rr,thet)
P1: rect_(rr+r,thet)
-dimension
+dimension_thick
cross(at (P1.x,-P1.y))
cross(at (-P1.x,P1.y))
# Top outer visible line
-visible
-# arc ccw from (-P1.x,h) to (-X1.x,X1.y) rad r with .c at (-P1.x,P1.y)
- arcs = atan2(P1.x-X1.x,P1.y-X1.y)
- n = 0
- nn = 8
- for i = 0 to nn do {P[n]:(-P1.x,P1.y)+(rect_(r,-twopi_/4+i/nn*arcs)); n=n+1}
- for i = 1 to nn do {P[n]:Orig+(rect_(rr,pi_-thet-i/nn/2*(pi_-2*thet))); n=n+1}
- n = n-1
- for i = 1 to n do { P[n+i]:(-P[n-i].x,P[n-i].y) }
- fitcurve(P,2*n)
-# top arc
-# arc cw to X1 rad rr with .c at Orig
-# arc ccw from X1 to (P1.x,h) rad 4 with .c at P1
+visible_thick
+# top arcs
+ arc ccw from (-P1.x,h) to (-X1.x,X1.y) with .c at (-P1.x,P1.y)
+ arc cw to X1 with .c at Orig
+ arc ccw from X1 to (P1.x,h) with .c at P1
# right end
line from (P1.x,h) to (305/2,h) then to (305/2,32/2) then left 40-3
arc ccw rad 3
line down 32-2*3
arc ccw rad 3
-dimension {
+dimension_thick {
r_dimen(up 32 with .c at (305/2-5,0),0,32)
arrow <- up 8 right 8 then right 4 from last arc.sw
"3$\,$R" ljust
r_dimen(up h*2 at (305/2,0),-10,110)
-}; visible
+}; visible_thick
line right 40-3 then to (305/2,-h) then to (P1.x,-h)
-# arc ccw to (X1.x,-X1.y) rad r with .c at P1.x,-P1.y
-# bottom arc
- for i = 0 to 2*n do { P[i]: (-P[2*n-i].x,-P[i].y) }
- fitcurve(P,2*n)
-# arc cw to (-X1.x,-X1.y) rad rr with .c at Orig
-# arc ccw to (-P1.x,-h) rad r with .c at (-P1.x,-P1.y)
+# bottom arcs
+ arc ccw to (X1.x,-X1.y) with .c at P1.x,-P1.y
+ arc cw to (-X1.x,-X1.y) with .c at Orig
+ arc ccw to (-P1.x,-h) with .c at (-P1.x,-P1.y)
# left end
line from (-P1.x,-h) to (-305/2,-h) then to (-305/2,-25/2) then right 25
down; arc ccw rad 3
@@ -163,7 +130,7 @@ dimension {
arc ccw rad 3
line to (-305/2,25/2) then to (-305/2,h) then to (-P1.x,h)
-dimension
+dimension_thick
# centre
ctrline(right 305-30 with .c at Orig,60)
ctrline(up d1+10 with .c at Orig,)
@@ -172,7 +139,7 @@ dimension
Q: line invis from BX.n to BX.s; R: line invis from BX.se up 10 left 10
X: Intersect_(Q,R)
line <-> from BX.se to X then to (X.x,-X.y) then to BX.nw
- r_box(90,BX,`3$\,$R')
+ r_box(90,BX,```3$\,$R''')
# Drill centres
D[1]: 35,sqrt(85^2-35^2)
@@ -185,41 +152,42 @@ dimension
ctrline(from D[2] to D[4] chop 15)
ctrline(to rvec_(2*15,0))
ctrline(from D[2]+vec_(-15,0) to D[2]+vec_(15,0))
-visible
+visible_thick
for i=1 to 4 do {
circle diam 16 at D[i]
for j = 0 to 7 do { arcr(D[i],23/2,j/8*twopi_,(j+3/4)/8*twopi_) ccw }
}
-hidden
+hidden_thick
for s=-1 to 1 by 2 do {
- line dashed from (-305/2,s*h) to (305/2,s*h)
- line dashed from (-305/2,s*30.6) to (305/2,s*30.6)
- line dashed from (-305/2,s*21.1) to (305/2,s*21.1)
- line dashed from (-305/2+25+2,s*21.1) to (305/2,s*21.1)
- line dashed dashwid/2 from (-305/2+25,s*25/2) down -s*(40/2-25/2-2);
- if s<0 then { arc dashed dashwid/4 ccw rad 2 } else { up; arc dashed dashwid/4 cw rad 2 }
- line dashed to ((305/2,0),Here)
- for k = -1 to 1 by 2 do {
- move to (k*305/2,s*(30.6+10))
- { dashline(from Here+(0,s*9.5/2) right -k*16,,dashwid/2)
- dashline(right -k*9.5/2/2 up -s*9.5/2,,dashwid/3)
- dashline(left -k*9.5/2/2 up -s*9.5/2,,dashwid/3)
- dashline(left -k*16,,dashwid/2)
- dashline(from Here+(-k*16,0) up s*9.5,,dashwid/2.5) }
- { dashline(from Here+(0,s*11/2) right -k*36.5,,dashwid/2)
- dashline(right -k*11/2/2 up -s*11/2,,dashwid/3)
- dashline(left -k*11/2/2 up -s*11/2,,dashwid/3)
- dashline(left -k*36.5,,dashwid/2)
- dashline(from Here+(-k*36.5,0) up s*11,,dashwid/2.5) }
- { dashline(from Here+(0,s*13/2) right -k*32,,dashwid/2)
- dashline(down s*13,,dashwid/2)
- dashline(left -k*32,,dashwid/2) }
- ctrline(right -k*20 chop -3 chop 0); ctrline(right -k*20 chop 0 chop -3)
+ line dashed from (-305/2,s*h) to (305/2,s*h)
+ line dashed from (-305/2,s*30.6) to (305/2,s*30.6)
+ line dashed from (-305/2,s*21.1) to (305/2,s*21.1)
+ line dashed from (-305/2+25+2,s*21.1) to (305/2,s*21.1)
+ line dashed dashwid/2 from (-305/2+25,s*25/2) down -s*(40/2-25/2-2);
+ if s<0 then { arc dashed dashwid/4 ccw rad 2 } \
+ else { up; arc dashed dashwid/4 cw rad 2 }
+ line dashed to ((305/2,0),Here)
+ for k = -1 to 1 by 2 do {
+ move to (k*305/2,s*(30.6+10))
+ { dashline(from Here+(0,s*9.5/2) right -k*16,,dashwid/2)
+ dashline(right -k*9.5/2/2 up -s*9.5/2,,dashwid/3)
+ dashline(left -k*9.5/2/2 up -s*9.5/2,,dashwid/3)
+ dashline(left -k*16,,dashwid/2)
+ dashline(from Here+(-k*16,0) up s*9.5,,dashwid/2.5) }
+ { dashline(from Here+(0,s*11/2) right -k*36.5,,dashwid/2)
+ dashline(right -k*11/2/2 up -s*11/2,,dashwid/3)
+ dashline(left -k*11/2/2 up -s*11/2,,dashwid/3)
+ dashline(left -k*36.5,,dashwid/2)
+ dashline(from Here+(-k*36.5,0) up s*11,,dashwid/2.5) }
+ { dashline(from Here+(0,s*13/2) right -k*32,,dashwid/2)
+ dashline(down s*13,,dashwid/2)
+ dashline(left -k*32,,dashwid/2) }
+ ctrline(right -k*20 chop -3 chop 0); ctrline(right -k*20 chop 0 chop -3)
+ }
}
- }
-dimension
+dimension_thick
# bottom
dimension_(from (-305/2,-h) to (305/2,-h),-(rr*1.1-h),"305",20pt__)
# outer radii
@@ -233,7 +201,7 @@ dimension
r_dimen(from (Rect_(d3/2,180-12)) to (Rect_(d3/2,-12)),,140,,,(Rect_(25,-12)))
# bolt hole placement diameter
- r_dimen(from Orig to (Rect_(85,-43)),,`85$\,$R',,->,(Rect_(20,-43)))
+ r_dimen(from Orig to (Rect_(85,-43)),,``85$\,$R'',,->,(Rect_(20,-43)))
# left slot
r_dimen(from (-305/2+6,-25/2) up 25,0,25)
r_dimen(from (-305/2,-26) right 40,0,40)
@@ -256,8 +224,8 @@ dimension
# arrow <- down 30 left 30 from D[3] chop 16/2 chop 0 then left 5
# "16 DRILL 23 CBORE" rjust "4 HOLES" rjust
- arrow <- from (-305/2,30.6+10+2) up 5 left 5 then up 13
- s_box(SEE (A)) with .sw at Here+(-5pt__,2pt__)
+# arrow <- from (-305/2,30.6+10+2) up 5 left 5 then up 13
+# s_box(SEE (A)) with .sw at Here+(-5pt__,2pt__)
command "}%"
.PE