使用 Stanli 程序包在 2D 和 3D 中绘制剪切图和弯矩图

使用 Stanli 程序包在 2D 和 3D 中绘制剪切图和弯矩图

关于使用 Stanli 包绘制内力图。2D 内力命令需要以下参数:

  • 起点
  • 终点
  • 起点处的值
  • 终点值
  • 抛物线高度
  • 颜色
  • 弯头位置

此外,3D 内力命令使用相同的参数,并附加 2 个参数

  • 飞机
  • 平面距离
  • 起点
  • 终点
  • 起点处的值
  • 终点值
  • 抛物线高度
  • 颜色
  • 弯头位置

我如何添加两个额外的可选参数来绘制图表下方的区域(抛物线和梁之间的区域):

  • 选择孵化图案的参数
  • 另一个参数用于设置此类阴影图案的颜色

如果没有输入此类图案,则不应用阴影

MWE 显示如下


\documentclass{article}
\usepackage{amsmath} 
\usepackage{stanli}

\begin{document}

\begin{center}
\begin{tikzpicture}

\draw[help lines,step=0.5](0,0) grid(15,24);


%%%%%%%%%%%%%%%%%%%%%%%%Loading%%%%%%%%%%%%%%%%

\point{a-LD}{0}{22.5};
\point{b-LD}{10}{22.5};
\point{su-LD}{2}{22.5+1.5};
\point{s-LD}{2}{22.5};
\point{sl-LD}{2}{22.5-0.5};
\point{TL-LD}{10}{22.5+2};
\point{CAP-LD}{10/2}{22.5-2.5};

% Elements

\beam{4}{a-LD}{b-LD};

%Supports

\support {1}{a-LD};
\support {2}{b-LD};


%Loads

\lineload{1}{a-LD}{b-LD}[0][2][0.035]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%First diagram%%%%%%%%%%%%%%%%%%

\point{a-FBD}{0}{22.5-6};
\point{b-FBD}{10}{22.5-6};
\point{TL-FBD}{2*10/3}{22.5-6};
\point{TLA-FBD}{2*10/3}{22.5-6+1.75};
\point{HR}{0-1.5}{22.5-6};
\point{VRA}{0}{22.5-6-1};
\point{VRB}{10}{22.5-6-1};
\point{CAP-FBD}{10/2}{22.5-6-3.5};

% Elements

\beam{4}{a-FBD}{b-FBD};

%%%%%%%%%%%%%%%%%Second diagram%%%%%%%%%%%%%%%%%%

\internalforces{a-FBD}{b-FBD}{-3}{6}[0][red]%[0]


\point{a-SFD}{0}{22.5-14};
\point{b-SFD}{10}{22.5-14};
\point{TL-SFD}{2*10/3}{22.5-14};
\point{TLA-SFD}{2*10/3}{22.5-14+1.75};
\point{VRA}{0}{22.5-14-1};
\point{VRB}{10}{22.5-14-1};
\point{CAP-SFD}{10/2}{22.5-14-3.5};

% Elements

\beam{4}{a-SFD}{b-SFD};

\internalforces{a-SFD}{b-SFD}{-3}{6}[3][red]%[0]


\end{tikzpicture}
\end{center}

\newpage

\begin{tikzpicture}[coords]
\dpoint{a}{0}{0}{0}; 
\dpoint{b}{0}{3}{-1};
\dpoint{c}{1.5}{3}{ -1};
\dbeam{1}{a}{b}[0][1]; 
\dbeam{1}{b}{c};
\dinternalforces{yz}{a}{b}{.5}{-1}[ -.4][blue];
\dinternalforces{xz}{b}{c}{1}{0};
\end{tikzpicture}


\end{document}

这是内部力量命令的宏

%       internalforces
%------------------------------------------------
%           \internalforces{initial point}{end point}{initial value}{end value}[parabola height][color][bend position]
%               [parabola height][color][bend position] are optional
%


\newcommandx{\internalforces}[7][5=0,6=red,7=.6667]{%
    \coordinate (internalforcesVarA) at ($ (#1)!#3cm!-90:(#2) $);
    \coordinate (internalforcesVarB) at ($ (#2)!#4cm!90:(#1)$);
    \coordinate (internalforcesVarAB) at ($ (internalforcesVarA)!.5!(internalforcesVarB)$);
    \coordinate (internalforcesVarC) at ($ (internalforcesVarAB)+2*(0,#5)$);
    \coordinate (internalforcesVarAC) at ($ (internalforcesVarA)!#7!(internalforcesVarC)$);
    \coordinate (internalforcesVarBC) at ($ (internalforcesVarB)!#7!(internalforcesVarC)$);
    \ifthenelse{\equal{#5}{0}}{
        \draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) -- (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
    }
    {
        %\draw [bigLine,color=#6](internalforcesVarA) parabola[parabola height=#5cm] (internalforcesVarB);
        %\draw [bigLine,color=#6](internalforcesVarA)--(internalforcesVarAC)--(internalforcesVarBC)--(internalforcesVarB);
        %\draw [bigLine,color=blue](internalforcesVarA)--(internalforcesVarB)
        %(internalforcesVarAB) -- (internalforcesVarC);
        \draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) .. (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
    }
    
}

点宏

%------------------------------------------------
%       point
%------------------------------------------------
%           \point{name}{x-coordiante}{y-coordiante}
%           

\newcommandx{\point}[3]{
    \node[coordinate][
        shift={(#2*\scalingParameter,#3*\scalingParameter)}](#1){};
}
`````````````````````````````````````````````````
Macro for beam
`````````````````````````````````````````````````
%------------------------------------------------
%       beam
%------------------------------------------------
%           \beam{type}{initial point}{end point}[rounded initial point][rounded end point]

\newcommandx{\beam}[5][4=0,5=0]{
    \ifthenelse{\equal{#1}{1}}{     %
        \draw [hugeLine] (#2) -- (#3);
        \coordinate (barVarA) at ($ (#2)!\barGap!-\barAngle:(#3) $);
        \coordinate (barVarB) at ($ (#3)!\barGap!\barAngle:(#2) $);
        \draw [smallLine,dashed] (barVarA) -- (barVarB);
        \ifthenelse{\equal{#4}{0}}{}
            {\fill (#2) circle (\hugeLineWidth/2);}
        \ifthenelse{\equal{#5}{0}}{}
            {\fill (#3) circle (\hugeLineWidth/2);}
    }{}

    \ifthenelse{\equal{#1}{2}}{     %
        \draw [bigLine] (#2) -- (#3);
        \ifthenelse{\equal{#4}{0}}{}
            {\fill (#2) circle (\bigLineWidth/2);}
        \ifthenelse{\equal{#5}{0}}{}
            {\fill (#3) circle (\bigLineWidth/2);}
    }{}
    
    \ifthenelse{\equal{#1}{3}}{     %
        \draw [normalLine,dashed] (#2) -- (#3);
    }{}
    
    \ifthenelse{\equal{#1}{4}}{     %
        \draw [hugeLine] (#2) -- (#3);
        \ifthenelse{\equal{#4}{0}}{}
            {\fill (#2) circle (\hugeLineWidth/2);}
        \ifthenelse{\equal{#5}{0}}{}
            {\fill (#3) circle (\hugeLineWidth/2);}
    }{}
}

%------------------------------------------------


MAcro for 3Dinternal forces command
``````````````````````````````````````````````


%------------------------------------------------
%       3dinternalforces
%------------------------------------------------
%           \dinternalforces{plane}[plane distance]{initial point}{end point}{initial value}{end value}[parabola height][color][bend position];
%

\newcommandx{\dinternalforces}[9][2=0,7=0,8=red,9=.6667]{
    %
    \ifthenelse{\equal{#1}{xy}}
        {\renewcommand{\DhelpVarA}{z}}{}
    \ifthenelse{\equal{#1}{yx}}
        {\renewcommand{\DhelpVarA}{z}}{}
    \ifthenelse{\equal{#1}{xz}}
        {\renewcommand{\DhelpVarA}{y}}{}
    \ifthenelse{\equal{#1}{zx}}
        {\renewcommand{\DhelpVarA}{y}}{}
    \ifthenelse{\equal{#1}{yz}}
        {\renewcommand{\DhelpVarA}{x}}{}
    \ifthenelse{\equal{#1}{zy}}
        {\renewcommand{\DhelpVarA}{x}}{}

    \begin{scope}[canvas is #1 plane at \DhelpVarA=#2]
        \subinternalforces{#3}{#4}{#5}{#6}[#7][#8][#9];
    \end{scope}
}

\newcommandx{\subinternalforces}[7][5=0,6=red,7=.6667]{%
    \coordinate (internalforcesVarA) at ($ (#1)!#3cm!-90:(#2) $);
    \coordinate (internalforcesVarB) at ($ (#2)!#4cm!90:(#1)$);
    \coordinate (internalforcesVarAB) at ($ (internalforcesVarA)!.5!(internalforcesVarB)$);
    \coordinate (internalforcesVarC) at ($ (internalforcesVarAB)+2*(0,#5)$);
    \coordinate (internalforcesVarAC) at ($ (internalforcesVarA)!#7!(internalforcesVarC)$);
    \coordinate (internalforcesVarBC) at ($ (internalforcesVarB)!#7!(internalforcesVarC)$);
    \ifthenelse{\equal{#5}{0}}{
        \draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) -- (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\DbigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\DbigLineWidth/2);
        \fill [color=#6] (#1) circle (\DbigLineWidth/2);
        \fill [color=#6] (#2) circle (\DbigLineWidth/2);
    }
    {
        \draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) .. (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\DbigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\DbigLineWidth/2);
        \fill [color=#6] (#1) circle (\DbigLineWidth/2);
        \fill [color=#6] (#2) circle (\DbigLineWidth/2);
    }
    
}
``````````````````````````````````````````````

[![enter image description here][1]][1]


[![enter image description here][2]][2]


  [1]: https://i.stack.imgur.com/IQTkm.jpg
  [2]: https://i.stack.imgur.com/m9li2.jpg

答案1

代码 1:无参数

\documentclass[border=12mm]{standalone}
\usepackage{stanli}


\newcommandx{\internalforcesx}[7][5=0,6=red,7=.6667]{%
    \coordinate (internalforcesVarA) at ($ (#1)!#3cm!-90:(#2) $);
    \coordinate (internalforcesVarB) at ($ (#2)!#4cm!90:(#1)$);
    \coordinate (internalforcesVarAB) at ($ (internalforcesVarA)!.5!(internalforcesVarB)$);
    \coordinate (internalforcesVarC) at ($ (internalforcesVarAB)+2*(0,#5)$);
    \coordinate (internalforcesVarAC) at ($ (internalforcesVarA)!#7!(internalforcesVarC)$);
    \coordinate (internalforcesVarBC) at ($ (internalforcesVarB)!#7!(internalforcesVarC)$);
\ifthenelse{\equal{#5}{0}}{
\fill [pattern=north west lines,pattern color=blue]  (#1) -- (internalforcesVarA)  --(internalforcesVarB) -- (#2)--cycle;
\draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) -- (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
}{      
\fill [pattern=north east lines,pattern color=blue] (#1) -- (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) ..(internalforcesVarB) -- (#2)--cycle;
\draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) .. (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
}}


\pagestyle{empty}

\begin{document}

\begin{tikzpicture}
\draw[help lines,step=1](0,0) grid(11,20);

\point{a-FBD}{0}{22.5-6};
\point{b-FBD}{10}{22.5-6};

\internalforcesx{a-FBD}{b-FBD}{-3}{6}[0][red]%[0]
\beam{4}{a-FBD}{b-FBD};
%+++++++++++++++++++++++
\point{a-SFD}{0}{22.5-14}; 
\point{b-SFD}{10}{22.5-14};

\internalforcesx{a-SFD}{b-SFD}{-3}{6}[3][red]%[0]
\beam{4}{a-SFD}{b-SFD};

\end{tikzpicture}

\end{document}

代码 2:带参数的 def

注意:已重命名\internalforces\internalforcesx

\newcommandx{\internalforcesx}[9][5=0,6=red,7=.6667,8=north west lines,9=white]{%
    \coordinate (internalforcesVarA) at ($ (#1)!#3cm!-90:(#2) $);
    \coordinate (internalforcesVarB) at ($ (#2)!#4cm!90:(#1)$);
    \coordinate (internalforcesVarAB) at ($ (internalforcesVarA)!.5!(internalforcesVarB)$);
    \coordinate (internalforcesVarC) at ($ (internalforcesVarAB)+2*(0,#5)$);
    \coordinate (internalforcesVarAC) at ($ (internalforcesVarA)!#7!(internalforcesVarC)$);
    \coordinate (internalforcesVarBC) at ($ (internalforcesVarB)!#7!(internalforcesVarC)$);
\ifthenelse{\equal{#5}{0}}{
\fill [pattern=#8,pattern color=#9]  (#1) -- (internalforcesVarA)  --(internalforcesVarB) -- (#2);
\draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) -- (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
}{      
\fill [pattern=#8,pattern color=#9] (#1) -- (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) ..(internalforcesVarB) -- (#2);
\draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) .. (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
}}

%++++++++++++++++++++++++++++++++++

\documentclass[border=12mm]{standalone}
\usepackage{stanli}


\newcommandx{\internalforcesx}[9][5=0,6=red,7=.6667,8=north west lines,9=white]{%
    \coordinate (internalforcesVarA) at ($ (#1)!#3cm!-90:(#2) $);
    \coordinate (internalforcesVarB) at ($ (#2)!#4cm!90:(#1)$);
    \coordinate (internalforcesVarAB) at ($ (internalforcesVarA)!.5!(internalforcesVarB)$);
    \coordinate (internalforcesVarC) at ($ (internalforcesVarAB)+2*(0,#5)$);
    \coordinate (internalforcesVarAC) at ($ (internalforcesVarA)!#7!(internalforcesVarC)$);
    \coordinate (internalforcesVarBC) at ($ (internalforcesVarB)!#7!(internalforcesVarC)$);
\ifthenelse{\equal{#5}{0}}{
\fill [pattern=#8,pattern color=#9]  (#1) -- (internalforcesVarA)  --(internalforcesVarB) -- (#2);
\draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) -- (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
}{      
\fill [pattern=#8,pattern color=#9] (#1) -- (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) ..(internalforcesVarB) -- (#2);
\draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) .. (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\bigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\bigLineWidth/2);
        \fill [color=#6] (#1) circle (\bigLineWidth/2);
        \fill [color=#6] (#2) circle (\bigLineWidth/2);
}}


\pagestyle{empty}

\begin{document}

\begin{tikzpicture}
\draw[help lines,step=1](0,0) grid(11,20);

\point{a-FBD}{0}{22.5-6};
\point{b-FBD}{10}{22.5-6};

\internalforcesx{a-FBD}{b-FBD}{-3}{6}[0][red][.6667][north west lines][blue]
\beam{4}{a-FBD}{b-FBD};
%+++++++++++++++++++++++
\point{a-SFD}{0}{22.5-14}; 
\point{b-SFD}{10}{22.5-14};

%\internalforcesx{a-SFD}{b-SFD}{-3}{6}[3][red][.6667][north east lines][blue]
%\internalforcesx{a-SFD}{b-SFD}{-3}{6}[3][red][.6667][dots][blue]
\internalforcesx{a-SFD}{b-SFD}{-3}{6}[3][red][.6667][crosshatch dots light steel blue]%[blue]
%\internalforcesx{a-SFD}{b-SFD}{-3}{6}[3][red][.6667][fivepointed stars][yellow]
\beam{4}{a-SFD}{b-SFD};

\end{tikzpicture}

\end{document}

输出:

在此处输入图片描述


对于 3D:最多可以写入 9 个参数,请参阅xargs 文档或者sty

\documentclass{article}
\usepackage{stanli}

%   \dinternalforces{plane}[plane distance]{initial point}{end point}{initial value}{end value}[parabola height][color][bend position];
\newcommandx{\dinternalforcesx}[9][2=0,7=0,8=red,9=.6667]{
    %
    \ifthenelse{\equal{#1}{xy}}
        {\renewcommand{\DhelpVarA}{z}}{}
    \ifthenelse{\equal{#1}{yx}}
        {\renewcommand{\DhelpVarA}{z}}{}
    \ifthenelse{\equal{#1}{xz}}
        {\renewcommand{\DhelpVarA}{y}}{}
    \ifthenelse{\equal{#1}{zx}}
        {\renewcommand{\DhelpVarA}{y}}{}
    \ifthenelse{\equal{#1}{yz}}
        {\renewcommand{\DhelpVarA}{x}}{}
    \ifthenelse{\equal{#1}{zy}}
        {\renewcommand{\DhelpVarA}{x}}{}

    \begin{scope}[canvas is #1 plane at \DhelpVarA=#2]
        \subinternalforcesx{#3}{#4}{#5}{#6}[#7][#8][#9];
    \end{scope}
}

\newcommandx{\subinternalforcesx}[7][5=0,6=red,7=.6667]{%
    \coordinate (internalforcesVarA) at ($ (#1)!#3cm!-90:(#2) $);
    \coordinate (internalforcesVarB) at ($ (#2)!#4cm!90:(#1)$);
    \coordinate (internalforcesVarAB) at ($ (internalforcesVarA)!.5!(internalforcesVarB)$);
    \coordinate (internalforcesVarC) at ($ (internalforcesVarAB)+2*(0,#5)$);
    \coordinate (internalforcesVarAC) at ($ (internalforcesVarA)!#7!(internalforcesVarC)$);
    \coordinate (internalforcesVarBC) at ($ (internalforcesVarB)!#7!(internalforcesVarC)$);
    \ifthenelse{\equal{#5}{0}}{
\fill[pattern=north west lines,pattern color=green] (#1) -- (internalforcesVarA) -- (internalforcesVarB) -- (#2)--cycle;
        \draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) -- (internalforcesVarB) (internalforcesVarB) -- (#2);
        \fill [color=#6] (internalforcesVarA) circle (\DbigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\DbigLineWidth/2);
        \fill [color=#6] (#1) circle (\DbigLineWidth/2);
        \fill [color=#6] (#2) circle (\DbigLineWidth/2);
    }
    {
\fill [pattern=north west lines,pattern color=green] (#1) -- (internalforcesVarA)  .. controls (internalforcesVarAC) and (internalforcesVarBC) .. (internalforcesVarB) -- (#2);
\draw [bigLine,color=#6] (#1) -- (internalforcesVarA) (internalforcesVarA) .. controls (internalforcesVarAC) and (internalforcesVarBC) .. (internalforcesVarB) (internalforcesVarB) -- (#2);
        
        \fill [color=#6] (internalforcesVarA) circle (\DbigLineWidth/2);
        \fill [color=#6] (internalforcesVarB) circle (\DbigLineWidth/2);
        \fill [color=#6] (#1) circle (\DbigLineWidth/2);
        \fill [color=#6] (#2) circle (\DbigLineWidth/2);
    }
}


\begin{document}

\begin{tikzpicture}[coords]
\dpoint{a}{0}{0}{0}; 
\dpoint{b}{0}{3}{-1};
\dpoint{c}{1.5}{3}{ -1};

\dinternalforcesx{yz}{a}{b}{.5}{-1}[ -.4][blue];
\dinternalforcesx{xz}{b}{c}{1}{0};

\dbeam{1}{a}{b}[0][1]; 
\dbeam{1}{b}{c};
\end{tikzpicture}

\end{document}

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

相关内容