Преглед изворни кода

Add scara design figure

tags/0.4.3-reflection
Wouter Horlings пре 5 година
родитељ
комит
3106a8a9cd
1 измењених фајлова са 165 додато и 0 уклоњено
  1. +165
    -0
      graphics/scara_design.tex

+ 165
- 0
graphics/scara_design.tex Прегледај датотеку

@@ -0,0 +1,165 @@

%&tex
\documentclass{standalone}
\usepackage{tikz}
\usepackage{siltex}
\usetikzlibrary {calc,arrows.meta,positioning,patterns,math}
%\input{graphics/tics.tikz}
\begin{document}
\begin{tikzpicture}[on grid]
% Define Drawing Box dimentions
\def \boxheight {5};
\def \boxwidth {6};
\def \boxorigin {(-\boxwidth/2,-1)};
\def \boxsize {(\boxwidth,\boxheight)};
\def \armcolor {gray};

\def \width {0.3};
\def \length {5};
\def \holediameter {0.10};
\def \floorheight {0.5};
\pgfmathsetmacro{\floorwidth}{4};
\def \arm {
\draw[fill=\armcolor] (0,0) ++(0,\width/2) arc[start angle=90, end angle=270, radius=\width/2] -- ++(\length,0) arc[start angle=-90, end angle=90, radius=\width/2] -- cycle;
\draw[fill=white] (0,0) circle (\holediameter/2);
\draw[fill=white] (\length,0) circle (\holediameter/2);
}
\def \doublescara {
\pgfmathsetmacro{\C}{sqrt(pow(\A,2)+pow(\B,2)-2*\A*\B*cos(\c))};
\pgfmathsetmacro{\b}{acos((pow(\A,2) + pow(\C,2) - pow(\B,2))/(2*\A*\C))};
\pgfmathsetmacro{\d}{180-\h-\b};
\pgfmathsetmacro{\D}{sqrt(pow(\C,2)+pow(\B,2)-2*\B*\C*cos(\d))};
\pgfmathsetmacro{\g}{acos(\D/(2*\B))};
\pgfmathsetmacro{\f}{acos((pow(\D,2) + pow(\B,2) - pow(\C,2))/(2*\D*\B))};
\pgfmathsetmacro{\a}{180-\b-\c};
\pgfmathsetmacro{\e}{180-\d-\f};
\pgfmathsetmacro{\k}{180-\f-\g};
\pgfmathsetmacro{\m}{180-\g-\e-\a};
\begin{scope}[shift={(-\A/2,0)}, rotate=\c]
\def \length{\B}
\arm
\begin{scope}[shift={(\B,0)}, rotate=-\m]
\def \length{\B}
\arm
\end{scope}
\end{scope}
\begin{scope}[shift={(\A/2,0)}, rotate=\h]
\def \length{\B}
\arm
\begin{scope}[shift={(\B,0)}, rotate=\k]
\def \length{\B}
\arm
\end{scope}
\end{scope}
};



\tikzset{arm/.pic={
\def \length {#1}
\draw[fill=gray] (0,0) ++(0,\width/2) arc[start angle=90, end angle=270, radius=\width/2] -- ++(\length,0) arc[start angle=-90, end angle=90, radius=\width/2] -- cycle;
\draw[fill=white] (0,0) circle (\holediameter/2);
\draw[fill=white] (\length,0) circle (\holediameter/2);
},
floor/.pic={
\def \width {#1/2};
\draw (-\width,0) -- (\width,0);
\fill[pattern=north west lines] (-\width,-\floorheight) rectangle (\width,0);
},
box/.pic={
\draw \boxorigin rectangle ++\boxsize;
}
};

\pgfmathsetmacro{\B}{2};
\pgfmathsetmacro{\A}{1};
\begin{scope}[shift={(0,0)}]
\draw (0,0) pic {box};
\draw (0,0) pic {floor=2};
\pgfmathsetmacro{\c}{90};
\pgfmathsetmacro{\h}{40};
\def \armcolor{lightgray};
\doublescara;
\pgfmathsetmacro{\c}{130};
\pgfmathsetmacro{\h}{60};
\def \armcolor{gray};
\doublescara;
\end{scope}

\begin{scope}[shift={(0*\boxwidth,\boxheight)}]
\draw (0,0) pic {box};
\draw (0,0) pic {floor=2};
\begin{scope}[shift={(0,0)}, rotate=120]
\def \length{\B}
\arm
\begin{scope}[shift={(\B,0)}, rotate=-100]
\def \length{\B}
\arm
\end{scope}
\end{scope}
\end{scope}
\begin{scope}[shift={(\boxwidth,0*\boxheight)}]
\draw (0,0) pic {box};
\draw (0,0) pic {floor=2};
\def \a {105};
\def \b {5};
\def \c {\b-\a};
\def \C {1};
\def \B {2.5};
\def \A {3};
\begin{scope}[shift={(0,0)}, rotate=180+\b]
\def \length{\C}
\begin{scope}[shift={(\length,0)}, rotate=-(180+\c)]
\def \length{\A}
\arm
\begin{scope}[shift={(\length,0)}, rotate=\c]
\def \length{\B+\C}
\arm
\end{scope}
\end{scope}
\arm
\end{scope}
\begin{scope}[shift={(0,0)}, rotate=\a]
\def \length{\A}
\arm
\end{scope}
\begin{scope}[shift={(\C,0)}, rotate=\a]
\def \length{\C}
\begin{scope}[shift={(\length,0)}, rotate=-180-\a]
\def \length{\C}
\arm
\end{scope}
\arm
\end{scope}
\end{scope}
\begin{scope}[shift={(1*\boxwidth,1*\boxheight)}]
\draw (0,0) pic {box};
\draw (0,0) pic {floor=2};
\def \a {105};
\def \b {5};
\def \c {\b-\a};
\def \C {1};
\def \B {2.5};
\def \A {3};
\begin{scope}[shift={(0,0)}, rotate=180+\b]
\def \length{\C}
\begin{scope}[shift={(\length,0)}, rotate=-(180+\c)]
\def \length{\A}
\arm
\begin{scope}[shift={(\length,0)}, rotate=\c]
\def \length{\B+\C}
\arm
\end{scope}
\end{scope}
\arm
\end{scope}
\begin{scope}[shift={(0,0)}, rotate=\a]
\def \length{\A}
\arm
\end{scope}
\end{scope}

\end{tikzpicture}
\end{document}

Loading…
Откажи
Сачувај