如何将变化/修改融入滚轮支撑中?

如何将变化/修改融入滚轮支撑中?

生产的滚轮支架斯坦利包与铰接支撑非常相似,大多数时候都令人困惑,因此我想更改或修改滚轮支撑的输出,就像标准结构分析教科书中排版的滚轮支撑一样,所以我创建了一个修改的文件 stanli-myaddon.sty 文件,添加了一个名为“支撑 7”的新支撑,但我可以增加支撑间隙以纳入滚轮或圆圈,但无法添加滚轮(或圆圈),我一直在任意绘制它,这令人困惑,您能帮我更新 stanli-myaddon.sty 包中修改后的支撑(支撑编号 7)中的滚轮或圆圈吗?请参阅附件插图以获取更多信息。

在此处输入图片描述

\documentclass[12pt,border=12pt]{standalone}
\usepackage{tikz}
\usepackage{stanli-myaddon}
\begin{document}
\begin{tikzpicture}
\point{a}{0}{0};
\point{b}{3}{0};
\point{c}{6}{0};
\support{2}{a};
\support{7}{b};%Support 7 will not be available in the default stanli.sty, see the modifications done in the stanli.sty below
\support{7}{c};
\draw [thick] (5.70,-0.6) circle [radius=0.1];
\draw [thick] (6.00,-0.6) circle [radius=0.1];
\draw [thick] (6.30,-0.6) circle [radius=0.1];
\end{tikzpicture}
\end{document}

修改后的stanli-myaddon.sty文件内容,即支持7如下。

\ifthenelse{\equal{#1}{7}}{     %
\begin{scope}[rotate around={#3:(#2)}]
    \draw [normalLine] (#2) -- ++(\supportLength/2,-\supportHeight) -- ++(-\supportLength,0) -- cycle;
    \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportHeight)$) -- ++(-\supportBasicLength,0);
    \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportHeight-2*\supportGap)$) -- ++(-\supportBasicLength,0);
    \clip ($(#2)+1*(-\supportBasicLength/2,-\supportBasicHeight-\supportHeight-2*\supportGap)$) rectangle ($(#2)+1*(\supportBasicLength/2,-\supportHeight-\supportGap)$);
    \draw[hatching]($(#2)+1*(\supportHatchingLength/2,-\supportHatchingHeight-2*\supportGap)$) -- ++(-\supportHatchingLength,0);
\end{scope}

请提供一个解决方案,将这些圆圈自动加载到 stanli-myaddon.sty 包中。谢谢。

答案1

以下是您现在可能需要执行的操作:保存

\renewcommandx{\support}[3][3=0]{
    \ifthenelse{\equal{#1}{1}}{     %
        \begin{scope}[rotate around={#3:(#2)}]
            \draw [normalLine] (#2) -- ++(\supportLength/2,-\supportHeight) -- ++(-\supportLength,0) -- cycle;
            \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportHeight)$) -- ++(-\supportBasicLength,0);
            \clip ($(#2)+1*(-\supportBasicLength/2,-\supportBasicHeight-\supportHeight)$) rectangle ($(#2)+1*(\supportBasicLength/2,-\supportHeight)$);
            \draw[hatching]($(#2)+1*(\supportHatchingLength/2,-\supportHatchingHeight)$) -- ++(-\supportHatchingLength,0);
        \end{scope}
    }{}

    \ifthenelse{\equal{#1}{2}}{     %
        \begin{scope}[rotate around={#3:(#2)}]
            \draw [normalLine] (#2) -- ++(\supportLength/2,-\supportHeight) -- ++(-\supportLength,0) -- cycle;
            \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportHeight)$) -- ++(-\supportBasicLength,0);
            \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportHeight-\supportGap)$) -- ++(-\supportBasicLength,0);
            \clip ($(#2)+1*(-\supportBasicLength/2,-\supportBasicHeight-\supportHeight-\supportGap)$) rectangle ($(#2)+1*(\supportBasicLength/2,-\supportHeight-\supportGap)$);
            \draw[hatching]($(#2)+1*(\supportHatchingLength/2,-\supportHatchingHeight-\supportGap)$) -- ++(-\supportHatchingLength,0);
        \end{scope}
    }{}

    \ifthenelse{\equal{#1}{3}}{     %
        \begin{scope}[rotate around={#3:(#2)}]
            \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,0)$) -- ++(-\supportBasicLength,0);
            \clip ($(#2)+1*(-\supportBasicLength/2,-\supportBasicHeight)$) rectangle ($(#2)+1*(\supportBasicLength/2,0)$);
            \draw[hatching]($(#2)+1*(\supportHatchingLength/2,0)$) -- ++(-\supportHatchingLength,0);
        \end{scope}
    }{}

    \ifthenelse{\equal{#1}{4}}{     %
        \begin{scope}[rotate around={#3:(#2)}]
            \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,0)$) -- ++(-\supportBasicLength,0);
            \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportGap)$) -- ++(-\supportBasicLength,0);
            \clip ($(#2)+1*(-\supportBasicLength/2,-\supportBasicHeight-\supportGap)$) rectangle ($(#2)+1*(\supportBasicLength/2,-\supportGap)$);
            \draw[hatching]($(#2)+1*(\supportHatchingLength/2,-\supportGap)$) -- ++(-\supportHatchingLength,0);
        \end{scope}
    }{}

    \ifthenelse{\equal{#1}{5}}{     %
        \begin{scope}[rotate around={#3:(#2)}]
            \draw [spring] (#2) -- ++(0,-\springLength);
            \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\springLength)$) -- ++(-\supportBasicLength,0);
            \clip ($(#2)+1*(-\supportBasicLength/2,-\supportBasicHeight-\springLength)$) rectangle ($(#2)+1*(\supportBasicLength/2,-\springLength)$);
            \draw[hatching]($(#2)+1*(\supportHatchingLength/2,-\springLength)$) -- ++(-\supportHatchingLength,0);
        \end{scope}
    }{}

    \ifthenelse{\equal{#1}{6}}{     %
        \begin{scope}[rotate around={#3:(#2)}]
            \begin{scope}[rotate around={-90:(#2)},shift={(#2)}]
                \draw[normalLine,scale=0.035,domain=0:18.85,variable=\t,smooth,]
                plot({\t*sin(\t r)},{-\t*cos(\t r)});
            \end{scope}
            \draw [normalLine] ($(#2)+1*(-\supportBasicLength/2.5,0)$) -- ++(-\supportBasicLength/3.5,0);
            \clip ($(#2)+1*(-\supportBasicLength/2.5,0)$) rectangle ($(#2)+1*(-\supportBasicLength/1.47,-\supportBasicHeight/2)$);
            \draw[hatchingspring]($(#2)+1*(0,0)$) -- ++(-\supportHatchingLength/2,0);
        \end{scope}
    }{}

    \ifthenelse{\equal{#1}{7}}{     %
    \begin{scope}[rotate around={#3:(#2)}]
        \draw [normalLine] (#2) -- ++(\supportLength/2,-\supportHeight) -- ++(-\supportLength,0) -- cycle;
        \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportHeight)$) -- ++(-\supportBasicLength,0);
        \draw [normalLine] ($(#2)+1*(\supportBasicLength/2,-\supportHeight-2*\supportGap)$) -- ++(-\supportBasicLength,0);
        \clip ($(#2)+1*(-\supportBasicLength/2,-\supportBasicHeight-\supportHeight-2*\supportGap)$) rectangle ($(#2)+1*(\supportBasicLength/2,-\supportHeight-\supportGap)$);
        \draw[hatching]($(#2)+1*(\supportHatchingLength/2,-\supportHatchingHeight-2*\supportGap)$) -- ++(-\supportHatchingLength,0);
    \end{scope}
    }{} 
}

然后stanli-myaddon.sty加载此包加载中stanli

\documentclass[12pt,border=12pt]{standalone}
\usepackage{tikz}
\usepackage{stanli}
\usepackage{stanli-myaddon}
\begin{document}
\begin{tikzpicture}
\point{a}{0}{0};
\point{b}{3}{0};
\point{c}{6}{0};
\support{2}{a};
\support{7}{b};%Support 7 will not be available in the default stanli.sty, see the modifications done in the stanli.sty below
\support{7}{c};
\draw [thick] (5.70,-0.6) circle [radius=0.1];
\draw [thick] (6.00,-0.6) circle [radius=0.1];
\draw [thick] (6.30,-0.6) circle [radius=0.1];
\end{tikzpicture}
\end{document}

要得到

在此处输入图片描述

请注意,可以使用高级方法来修补命令,例如使用etoolbox。但我不确定我是否会在这里使用它们。相反,我希望作者有机会添加您的建议(您可以在手册中找到他的电子邮件地址)。也许还有一种方法可以稍微更新包(不再使用\tikzstyle和库,使用 pgf 键代替全局定义的宏,也许用简单的和等等arrows替换上面的一系列)。当然,包的功能看起来不错,但在实施细节方面可能还有一些改进的空间。\ifthenelse\ifcase

答案2

在 \clip ($(#2... 等之前添加以下三行stanli-myaddon.sty对我来说有效

        \draw [normalLine] ($(#2)+1*(-\supportGap*3,-\supportHeight-\supportGap)$) circle [radius=\supportGap)];
        \draw [normalLine] ($(#2)+1*(0,-\supportHeight-\supportGap)$) circle [radius=\supportGap)];
        \draw [normalLine] ($(#2)+1*(\supportGap*3,-\supportHeight-\supportGap)$) circle [radius=\supportGap)];

相关内容