MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Text Alignment in Graphics[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127635] Re: Text Alignment in Graphics[]
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Fri, 10 Aug 2012 02:40:20 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hola:
1. I have these graphics (it's a crank I designed and built)
Graphics[{{EdgeForm[Thin], White,        Rectangle[{0, 0}, {32.5 + 10 + 73.5 + 0.85 +              1.5, 34.8}]},      {Polygon[{{0, 0}, {32.5, 0}, {32.5, 21.9},            {32.5 + 10, 31.9}, {32.5 + 10 + 73.5, 31.9},         {32.5 + 10 + 73.5, 30.9},         {32.5 + 10 + 73.5 + 0.85, 30.9},      {32.5 + 10 + 73.5 + 0.85, 31.9},            {32.5 + 10 + 73.5 + 0.85 + 1.5, 31.9},         {32.5 + 10 + 73.5 + 0.85 + 1.5, 33.8},            {32.5 + 10 + 73.5 + 0.85, 33.8},            {32.5 + 10 + 73.5 + 0.85, 34.8},  {32.5 + 10 + 73.5, 34.8}, {32.5 + 10 + 73.5,              33.8}, {30.6, 33.8}, {30.6, 11.9},            {20.6, 1.9}, {0, 1.9}, {0, 0}}]},      {Text[1183.5*mm, {118.35/2, 36.8}]},      {Rotate[Text[348*mm, {120.35, 35. 5/2}],          90*Degree]},      {Rotate[Text[319*mm, {98, 31.9/2}],      90*Degree]}, {Dashed,  Line[{{0, 17.4}, {118.35, 17.4}}],        Line[{{100, 0}, {100, 31.9}}]},      {Text[325*mm, {32.5/2, 19.4}]},      {Text[(118.35 - 32.5 -
  1.9)*mm
 ,          {118.35/2 + 16 + 1.9, 19.4}]},    {Text[         "Material:Blankstahl, rund, Durchmesser 19 \    mm.", {32, -3}]}, {Text["Passierstift dito, \    Durchmesser 8,5 mm, L=E4nge 39 mm.", {36, -6}]},      {Text["Stummell=E4nge oben rechts 15 mm.",          {23, -9}]}, {Text["Versteifungsdreiecke 6 mm, \    100 x 100 x 141,4 mm.", {34.5, -12}]},      {FontWeight -> Bold,        Text["Anwerfkurbel FJ40, Maschine 2F",          {118.35/2, 42}]}}]
The rectangle's lower left corner is at {0, 0}, for the texts
 {Text[         "Material:Blankstahl, rund, Durchmesser 19 \    mm.",{32, - 3}]}, {Text["Passierstift dito, \    Durchmesser 8,5 mm, L=E4nge 39 mm.", {36, -6}]},      {Text["Stummell=E4nge oben rechts 15mm.",          {23,-9}]}, {Text["Versteifungsdreiecke 6 mm, \    100 x 100 x 141,4 mm.", {34.5, -12}]},
to be left aligned along the ordinate below the rectangle I have to set their x-coordinates, depending on the length of each text, between 23 and 36 rather than 0 as one might expect. These settings for x only work for a give
n size of the graphics. When I increase the size the texts move to right but not uniformly so. The texts inside the rectangle, the header and  {Text[1183.5*mm, {118.35/2, 36.8}]}, {Rotate[Text[348*mm, {120.35,35.5/2}], 90*Degree]}, however, move to their appropriate places.
How can the undesirable eastward migration of the texts below the rectangle be remedied?
2. Is there a symbol analogous to JoinForm["Round"] to round a polygon's corners? (EdgeForm[] does not accept "Round".)
Best regards,
MATTHIAS BODE

Ni, Matthias,

To answer the first part of your question, here is a function to draw this skizze and alike:

skizze[image_, text_, size1_, size2_, indent_] := Module[{gr1, gr2},
   gr1 = Graphics[image, ImageSize -> size1];
   gr2 = Row[{
      Spacer[indent],
      Column[Style[#, size2] & /@ text, Alignment -> Left]
      }];
   Panel[Column[{gr1, gr2}, Alignment -> Left], Background -> White]
   ];
The arguments of this function in your case are:

image = {{EdgeForm[Thin], White,
    Rectangle[{0, 0}, {32.5 + 10 + 73.5 + 0.85 + 1.5,
      34.8}]}, {Polygon[{{0, 0}, {32.5, 0}, {32.5, 21.9}, {32.5 + 10,
       31.9}, {32.5 + 10 + 73.5, 31.9}, {32.5 + 10 + 73.5,
       30.9}, {32.5 + 10 + 73.5 + 0.85,
       30.9}, {32.5 + 10 + 73.5 + 0.85,
       31.9}, {32.5 + 10 + 73.5 + 0.85 + 1.5,
       31.9}, {32.5 + 10 + 73.5 + 0.85 + 1.5,
       33.8}, {32.5 + 10 + 73.5 + 0.85,
       33.8}, {32.5 + 10 + 73.5 + 0.85, 34.8}, {32.5 + 10 + 73.5,
       34.8}, {32.5 + 10 + 73.5, 33.8}, {30.6, 33.8}, {30.6,
       11.9}, {20.6, 1.9}, {0, 1.9}, {0, 0}}]}, {Text[
     1183.5*mm, {118.35/2, 36.8}]}, {Rotate[
     Text[348*mm, {120.35, 35.5/2}], 90*Degree]}, {Rotate[
     Text[319*mm, {98, 31.9/2}], 90*Degree]}, {Dashed,
    Line[{{0, 17.4}, {118.35, 17.4}}],
    Line[{{100, 0}, {100, 31.9}}]}, {Text[
     325*mm, {32.5/2, 19.4}]}, {Text[(118.35 - 32.5 - 1.9)*
      mm, {118.35/2 + 16 + 1.9, 19.4}]}};

text = {"Material:Blankstahl, rund, Durchmesser 19 mm.",
   "Passierstift dito,Durchmesser 8,5 mm, L=E4nge 39 mm.",
   "Stummell=E4nge oben rechts 15 mm.",
   "Versteifungsdreiecke 6 mm, 100\[Times]100\[Times]141,4 mm.",
   "Anwerfkurbel FJ40, Maschine 2F"};

Try to evaluate this:

skizze[image, text, 300, 10, 5]
skizze[image, text, 500, 10, 7]

and then play with the parameters size1, size2 and indent.

Hope it helps.

For the second question, have a look at Menu/Help/RoundingRadius

Have fun, Alexei


Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu






  • Prev by Date: Nested numerical integral - speed: Is it suppose to be so slow?
  • Next by Date: How to increase evaluation speed for nested numerical integration
  • Previous by thread: Re: Text Alignment in Graphics[]
  • Next by thread: Re: RE: Re: Landau letter, Re: Mathematica as a New