3

I use this code

a = Graphics[   { Inset[
     Style["\[FilledRectangle]", FontSize -> Scaled[0.09]], { 0.34, -0.6755  }]  ,
    Inset[ Style["\[FilledRectangle]", FontSize -> Scaled[0.09]], {    -0.33, -0.6755  }]  } ];

b = Graphics[{Thickness[0.002], CapForm["Butt"], Line[{{ 0.34, -0.6755 }, { 2.5, -0.6755 }}]}];

c = Graphics[{EdgeForm[{Thick, Blue}], FaceForm[], Triangle[{{-1, -2}, {0, 0}, {1, -2}}]}];

Show[{a, b, c}]

and the result is

enter image description here

How can I ask Mathematica to repeat the above picture such that I get this result? enter image description here

sara96
  • 153
  • 7

2 Answers2

2

here is a quick start that can be easily improved

unit[x_, y_] := {Rectangle[{0.34 - 0.1, -0.6755 - 0.2} + {x, 
     y}, {0.34 + 0.1, -0.6755 + 0.2} + {x, y}], 
  Rectangle[{-0.34 - 0.1, -0.6755 - 0.2} + {x, 
     y}, {-0.34 + 0.1, -0.6755 + 0.2} + {x, y}], Thickness[0.002], 
  CapForm["Butt"], 
  Line[{{0.34, -0.6755} + {x, y}, {2.5, -0.6755} + {x, y}}], 
  EdgeForm[{Thick, Blue}], FaceForm[], 
  Triangle[{{-1, -2} + {x, y}, {0, 0} + {x, y}, {1, -2} + {x, y}}]}

and then you can produce j unit as follow

Block[{j = 6, Xn = (Norm[{0.34, -0.6755} - {2.5, -0.6755}] + 0.7)}, 
 Graphics[{Table[
    unit[i (Norm[{0.34, -0.6755} - {2.5, -0.6755}] + 0.7), 0], {i, 1, 
     j}], Rectangle[{0.34 - 0.1, -0.6755 - 0.2} + {(j + 1) Xn, 
      0}, {0.34 + 0.1, -0.6755 + 0.2} + {(j + 1) Xn, 0}], 
   Rectangle[{-0.34 - 0.1, -0.6755 - 0.2} + {(j + 1) Xn, 
      0}, {-0.34 + 0.1, -0.6755 + 0.2} + {(j + 1) Xn, 0}], 
   EdgeForm[{Thick, Blue}], FaceForm[], 
   Triangle[{{-1, -2} + {(j + 1) Xn, 0}, {0, 0} + {(j + 1) Xn, 
       0}, {1, -2} + {(j + 1) Xn, 0}}]}, ImageSize -> 400, 
  Axes -> False]]    

enter image description here

MMA13
  • 4,664
  • 3
  • 15
  • 21
2
n = 5;
translations = {# 0.34 + (# - 1) 2.5, 0} & /@ Range[n]; 

Graphics[{EdgeForm[{Thick, Blue}], FaceForm[], CapForm["Butt"], Thickness[0.002], 
  Translate[{Triangle @ {{-1, -2}, {0, 0}, {1, -2}}, 
     Text[Style["▮", FontSize -> Scaled[0.04]], {#, -0.6755}] & /@ {-.33, 0.34}}, 
   translations],
  Translate[Line[{#, -0.6755} & /@ {.34, 2.5}], Most @ translations]}, 
 ImageSize -> 900]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896