测力计-征求改进建议

测力计-征求改进建议

请。

测力计

\documentclass{standalone}
\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}[scale=1, transform shape,every node/.style={scale=1.0}]

%argola
\definecolor{meu_cinzento}{RGB}{116, 123, 129}
\tkzDefPoint(02,25){O1}
\tkzDefPoint(02,23){O2}
\tkzDefPoint(02,20){O3}
\tkzDrawArc[R,line width = 6pt,color=meu_cinzento](O1,2)(0,360)
\tkzDrawSegment[line width = 3pt,color=meu_cinzento](O2,O3)

%gancho
\definecolor{meu_cinzento}{RGB}{116, 123, 129}
\tkzDefPoint(02,5){O1}
\tkzDefPoint(02,7){O2}
\tkzDefPoint(02,9){O3}
\tkzDrawArc[R,line width = 6pt,color=meu_cinzento](O1,2)(90,360)
\tkzDrawSegment[line width = 6pt,color=meu_cinzento](O2,O3)

%espelho do dinamómetro
\definecolor{meu_cinzento}{RGB}{175, 191, 196}
\tkzDefPoint(02,10){O}
\tkzDrawCircle[R,meu_cinzento!20,fill=meu_cinzento,opacity=1](O,2)
\tkzDrawArc[R,line width = 3pt,color=black](O,2)(180,0)
\tkzDefPoint(02,20){O}
\tkzDrawCircle[R,meu_cinzento!20,fill=meu_cinzento,opacity=1](O,2)
\tkzDrawArc[R,line width = 3pt,color=black](O,2)(0,180)
\tkzDefPoint(00,10){P1}
\tkzDefPoint(00,20){P2}
\tkzDefPoint(04,20){P3}
\tkzDefPoint(04,10){P4}
\tkzDrawPolygon[fill=meu_cinzento!20,color=meu_cinzento](P1,P2,P3,P4)
\tkzDrawSegment[line width = 3pt,color=black](P1,P2)
\tkzDrawSegment[line width = 3pt,color=black](P3,P4)

%ranhura do ponteiro
\tkzDefPoint(02,10){P1}
\tkzDefPoint(02,20){P2}
\tkzDrawSegment[line width = 3pt,color=black](P1,P2)

%escala
\foreach \i in {0,...,20}{%
    \tkzDefPoint(1.5,{10+0.5*\i}){O\i}}
\foreach \i in {0,...,20}{%
    \tkzDefPoint(2.5,{10+0.5*\i}){P\i}}
\foreach \i in {0,...,20}{%
    \tkzDrawSegment[line width = 0.5pt,color=black](O\i,P\i)}

%ponteiro
\tkzDrawSegment[line width = 5pt,color=red](O5,P5)

\end{tikzpicture}
\end{document}

答案1

可能有一种方法可以连接tkz-euclide宏以便它们很好地结合在一起(我不知道),或者您可以使用该line cap选项。

tikz但是,我认为使用 plain而不是 load来绘制这个更容易tkz-euclide。代码会短得多:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\definecolor{meu_cinzento-1}{RGB}{116, 123, 129}
\definecolor{meu_cinzento-2}{RGB}{175, 191, 196}

%argola
\draw[line width=6pt, meu_cinzento-1] (2,25) circle (2);
\draw[line width=3pt, meu_cinzento-1] (2,23) -- ++(0,-3);

%gancho
\draw[line width=6pt, meu_cinzento-1] (2,9) -- ++(0,-2) arc (90:360:2);

%espelho do dinamómetro
\draw[line width=3pt, fill=meu_cinzento-2] (4,20) arc (0:180:2) -- ++(0,-10) arc (180:360:2) -- cycle; 

%ranhura do ponteiro
\draw[line width=3pt] (2,20) -- ++(0,-10); 

%escala (com ponteiro)
\foreach \i in {0,...,20}{
    \ifnum\i=5
        \draw[line width=5pt, red] 
    \else
        \draw[line width=0.5pt] 
    \fi
        (1.5,{10+0.5*\i}) -- ++(1,0);
}

\end{tikzpicture}
\end{document}

在此处输入图片描述

一些补充说明:

  • 您不需要多次定义一种颜色,我建议您为不同的颜色赋予不同的名称。
  • 您可以在宏中包含多个绘图命令\foreach。因此,无需\foreach在此多次重复相同的定义。

答案2

您需要添加:line cap=round,line join=round最好使用TikZtkz-euclide用于欧几里得几何。

\documentclass{standalone}
\usepackage{tkz-euclide}

\begin{document}

\begin{tikzpicture}[scale=1, transform shape,every node/.style={scale=1.0},line cap=round,line join=round]

%argola
\definecolor{meu_cinzento}{RGB}{116, 123, 129}
\tkzDefPoint(02,25){O1}
\tkzDefPoint(02,23){O2}
\tkzDefPoint(02,20){O3}
\tkzDrawArc[R,line width = 6pt,color=meu_cinzento](O1,2)(0,360)
\tkzDrawSegment[line width = 3pt,color=meu_cinzento](O2,O3)

%gancho
\tkzDefPoint(02,5){O1}
\tkzDefPoint(02,7){O2}
\tkzDefPoint(02,9){O3}
\tkzDrawArc[R,line width = 6pt,color=meu_cinzento](O1,2)(90,360)
\tkzDrawSegment[line width = 6pt,color=meu_cinzento](O2,O3)

%espelho do dinamómetro
\definecolor{meu_cinzento}{RGB}{175, 191, 196}
\tkzDefPoint(02,10){O}
\tkzDrawCircle[R,meu_cinzento!20,fill=meu_cinzento,opacity=1](O,2)
\tkzDrawArc[R,line width = 3pt,color=black](O,2)(180,0)
\tkzDefPoint(02,20){O}
\tkzDrawCircle[R,meu_cinzento!20,fill=meu_cinzento,opacity=1](O,2)
\tkzDrawArc[R,line width = 3pt,color=black](O,2)(0,180)
\tkzDefPoint(00,10){P1}
\tkzDefPoint(00,20){P2}
\tkzDefPoint(04,20){P3}
\tkzDefPoint(04,10){P4}
\tkzDrawPolygon[fill=meu_cinzento!20,color=meu_cinzento](P1,P2,P3,P4)
\tkzDrawSegments[line width = 3pt,color=black](P1,P2 P3,P4)

%ranhura do ponteiro
\tkzDefPoint(02,10){P1}
\tkzDefPoint(02,20){P2}
\tkzDrawSegment[line width = 3pt,color=black](P1,P2)

%escala
\foreach \i in {0,...,20}{%
    \tkzDefPoint(1.5,{10+0.5*\i}){O\i}
    \tkzDefPoint(2.5,{10+0.5*\i}){P\i}
    \tkzDrawSegment[line width = 0.5pt,color=black](O\i,P\i) }

%ponteiro
\tkzDrawSegment[line width = 5pt,color=red](O5,P5)

\end{tikzpicture}

在此处输入图片描述

答案3

试试这个(最简单):

\documentclass[border=10pt]{standalone}
\usepackage{tikz,calc}


\begin{document}
    
    \begin{tikzpicture}[scale=1]
        \draw[gray,line width=12pt] (0,0) arc (180:0:2);
        \filldraw[brown] (-1,0) rectangle (5,-22);
            \node[white] at (2.1,-.5) (a) {\bfseries \large Range: 0-18.5 kg};
        \draw[cyan,line width=20pt,centered] (2.1,-1)--(2.1,-21);
        \foreach \i in {0,1,...,18}{
            \pgfmathsetmacro\h{-2-\i};
            \pgfmathsetmacro\j{-2.5-\i};
            \pgfmathsetmacro\k{.5+\i};
            \draw[white,line width=3pt] (1.6,\h)--(1.2,\h) node[left] (\i) {\bfseries \large $\i$};
            \draw[white,line width=3pt] (2.6,\j)--(3.0,\j) node[right] (\i) {\bfseries \large $\k$};
        }
        \draw[red,line width=3] (1.5,-2)--(2.7,-2);
        \draw[gray,line width=12pt] (2.1,-22)--(2.1,-23) arc (90:360:2);
    \end{tikzpicture}
        
\end{document}

输出: 在此处输入图片描述

相关内容