From 1c004b8b1b82512ea320e5d1e16e364d54878e6a Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 1 Apr 2023 03:01:11 +0000 Subject: CTAN sync 202304010301 --- graphics/pgf/contrib/structmech/README.md | 13 +-- graphics/pgf/contrib/structmech/structmech.pdf | Bin 142170 -> 157219 bytes graphics/pgf/contrib/structmech/structmech.sty | 118 ++++++++++++++----------- graphics/pgf/contrib/structmech/structmech.tex | 62 +++++++++++-- 4 files changed, 124 insertions(+), 69 deletions(-) (limited to 'graphics/pgf/contrib') diff --git a/graphics/pgf/contrib/structmech/README.md b/graphics/pgf/contrib/structmech/README.md index ac4fe338dd..057be4bc3c 100644 --- a/graphics/pgf/contrib/structmech/README.md +++ b/graphics/pgf/contrib/structmech/README.md @@ -17,15 +17,6 @@ along with this program. If not, see http://www.gnu.org/licenses/. ------ -**structmech** is a collection of several TikZ commands that allows users to draw basic elements in material/structural mechanics. With one single command, it is capable of drawing member forces, nodal forces/displacements, various boundary conditions, internal force distributions, etc. - -Please feel free to redistribute and/or expand the functionality. Please contact me at: - -[tlcfem@gmail.com](mailto:tlcfem@gmail.com) - -tlc - -04/25/2021 - - +**structmech** is a collection of TikZ commands that allows users to draw basic elements in material/structural mechanics. With one single command, it is capable of drawing member forces, nodal forces/displacements, various boundary conditions, internal force distributions, etc. +Please feel free to redistribute and/or extend the functionality. diff --git a/graphics/pgf/contrib/structmech/structmech.pdf b/graphics/pgf/contrib/structmech/structmech.pdf index fea6da781a..60feba2d2e 100644 Binary files a/graphics/pgf/contrib/structmech/structmech.pdf and b/graphics/pgf/contrib/structmech/structmech.pdf differ diff --git a/graphics/pgf/contrib/structmech/structmech.sty b/graphics/pgf/contrib/structmech/structmech.sty index 21735ed2c2..d07e68a5c6 100644 --- a/graphics/pgf/contrib/structmech/structmech.sty +++ b/graphics/pgf/contrib/structmech/structmech.sty @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Copyright (C) 2018-2021 Theodore Chang +%% Copyright (C) 2018-2023 Theodore Chang %% %% This program is free software: you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published by @@ -15,17 +15,17 @@ %% along with this program. If not, see . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % structmech: A TikZ command set for structural mechanics drawings -% v1.1 by tlc +% v1.2 by tlc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{structmech}[2021/04/25 v1.1 structmech: A TikZ command set for structural mechanics drawings] +\ProvidesPackage{structmech}[2023/04/01 v1.2 structmech: A TikZ command set for structural mechanics drawings] \RequirePackage{ifthen} \RequirePackage{kvoptions} \RequirePackage{tikz} \RequirePackage{xkeyval} \RequirePackage{xparse} \RequirePackage{xstring} -\usetikzlibrary{calc,decorations.pathreplacing,positioning} +\usetikzlibrary{calc,decorations.pathreplacing,positioning,decorations.pathmorphing} \DeclareOptionX{fill}[black]{\def\fillColor{#1}} \DeclareOptionX{line}[black]{\def\lineColor{#1}} \DeclareOptionX{node}[black]{\def\nodeColor{#1}} @@ -382,66 +382,37 @@ EndRotD/.style={start angle=\Angle+90,end angle=\Angle-90,radius=3mm}, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NewDocumentCommand{\IForceB}{O{\fillColor} m m m m m G{1}}{ \coordinate(A)at(#2);\coordinate(B)at(#3); +\pgfmathsetmacro\height{#6*#7}; +\pgfmathsetmacro\lvla{#4*#7}; +\pgfmathsetmacro\lvlb{#5*#7}; % original cord \pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}} \let\Angle\pgfmathresult -\coordinate(C)at($(A)+(\Angle+90:#4*#7)$); -\coordinate(D)at($(B)+(\Angle-90:#5*#7)$); -% inclined cord -\pgfmathanglebetweenpoints{\pgfpointanchor{C}{center}}{\pgfpointanchor{D}{center}} -\let\AngleB\pgfmathresult +\coordinate(C)at($(A)+(\Angle+90:\lvla)$); +\coordinate(D)at($(B)+(\Angle-90:\lvlb)$); % original length \pgfpointdiff{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}} \pgfmathparse{veclen(\pgf@x,\pgf@y)/28.45274} \let\Length\pgfmathresult -% inclined length -\pgfpointdiff{\pgfpointanchor{C}{center}}{\pgfpointanchor{D}{center}} -\pgfmathparse{veclen(\pgf@x,\pgf@y)/28.45274} -\let\LengthB\pgfmathresult -% center of inclined cord -\coordinate(G)at($(C)+(\AngleB:\LengthB/2)$); -\pgfmathsetmacro\height{#6*#7}; -\begin{scope}[rotate around={\AngleB:(G)},shift={(G)}] -\draw[#1,fill=#1,fill opacity=\fillOpacity](-.5*\LengthB,0)parabola bend(0,\height)(.5*\LengthB,0)--++(\Angle-\AngleB+90:#5*#7)--($(-.5*\LengthB,0)+(\Angle-\AngleB-90:#4*#7)$)--cycle; +\coordinate(G)at($(A)+(\Angle:\Length/2)$); +\begin{scope}[rotate around={\Angle:(G)},shift={(G)}] +\draw[#1,fill=#1,fill opacity=\fillOpacity]plot[domain=-.5*\Length:.5*\Length,samples=100](\x,{\height-4./\Length/\Length*\height*\x*\x-\lvla/\Length*\x-\lvlb/\Length*\x+\lvla/2-\lvlb/2})--(B)--(A)--cycle; \end{scope} \IfStrEq{\showvalue}{on}{ \StrLeft{#4}{1}[\SA] -% \IfStrEq{\SA}{-} -% {\IfStrEq{\absvalue}{on} -% {\node[NOFILL]at($(C)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$\StrDel[1]{#4}{-}$};} -% {\node[NOFILL]at($(C)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$#4$};} -% } -% {\node[NOFILL]at($(C)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$#4$};} -% \StrLeft{#5}{1}[\SB] -% \IfStrEq{\SB}{-} -% {\IfStrEq{\absvalue}{on} -% {\node[NOFILL]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$\StrDel[1]{#5}{-}$};} -% {\node[NOFILL]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$#5$};} -% } -% {\node[NOFILL]at($(D)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$#5$};} \IfStrEq{\SA}{-} - {\node[NOFILL,\lineColor]at($(C)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$#4$};} + {\IfStrEq{\absvalue}{on} + {\node[NOFILL,\lineColor]at($(C)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$\StrDel[1]{#4}{-}$};} + {\node[NOFILL,\lineColor]at($(C)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$#4$};} + } {\node[NOFILL,\lineColor]at($(C)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$#4$};} -\IfStrEq{#5}{0}{ - \node[NOFILL,\lineColor]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$#5$}; -}{ - \StrLeft{#5}{1}[\SB] - \IfStrEq{\SB}{-} - {\IfStrEq{\absvalue}{on} - {\IfStrEq{\SA}{-} - {\node[NOFILL,\lineColor]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$#5$};} - {\node[NOFILL,\lineColor]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$\StrDel[1]{#5}{-}$};} - } - {\node[NOFILL,\lineColor]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$#5$};} - } - {\IfStrEq{\absvalue}{on} - {\IfStrEq{\SA}{-} - {\node[NOFILL,\lineColor]at($(D)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$-#5$};} - {\node[NOFILL,\lineColor]at($(D)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$#5$};} - } - {\node[NOFILL,\lineColor]at($(D)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$#5$};} - } -} +\StrLeft{#5}{1}[\SB] +\IfStrEq{\SB}{-} + {\IfStrEq{\absvalue}{on} + {\node[NOFILL,\lineColor]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$\StrDel[1]{#5}{-}$};} + {\node[NOFILL,\lineColor]at($(D)+(\Angle+90:\Length/8)$)[rotate=\Angle]{$#5$};} + } + {\node[NOFILL,\lineColor]at($(D)+(\Angle-90:\Length/8)$)[rotate=\Angle]{$#5$};} }{} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -470,4 +441,47 @@ EndRotD/.style={start angle=\Angle+90,end angle=\Angle-90,radius=3mm}, \let\Angle\pgfmathresult \draw[#1,line width=\lineWidth](A)to[out=\Angle+#4*#6,in=180+\Angle+#5*#6](B); } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Command 14: Dashpot +% \Dashpot[1]{2}{3}{4} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NewDocumentCommand{\Dashpot}{O{\fillColor} m m G{1}}{ +\coordinate(A)at(#2);\coordinate(B)at(#3); +% original cord +\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}} +\let\Angle\pgfmathresult +\pgfpointdiff{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}} +\pgfmathparse{veclen(\pgf@x,\pgf@y)/28.45274} +\let\Length\pgfmathresult +\pgfmathsetmacro\unitL{#4*\Length/10}; +\coordinate(G)at($(A)+(\Angle:\Length/2)$); +\begin{scope}[rotate around={\Angle:(G)},shift={(G)}] +\draw[#1,line width=\lineWidth] +(-\Length/2,0)--(-.5*\unitL,0) +(0,0)--(\Length/2,0) +(0,-.5*\unitL)--++(0,\unitL) +(.5*\unitL,\unitL)--++(-\unitL,0)--++(0,-2*\unitL)--++(\unitL,0); +\end{scope} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Command 15: Spring +% \Spring[1]{2}{3}{4} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NewDocumentCommand{\Spring}{O{\fillColor} m m G{1}}{ +\coordinate(A)at(#2);\coordinate(B)at(#3); +% original cord +\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}} +\let\Angle\pgfmathresult +\pgfpointdiff{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}} +\pgfmathparse{veclen(\pgf@x,\pgf@y)/28.45274} +\let\Length\pgfmathresult +\pgfmathsetmacro\unitL{#4*\Length/10}; +\coordinate(G)at($(A)+(\Angle:\Length/2)$); +\begin{scope}[rotate around={\Angle:(G)},shift={(G)}] +\draw[#1,line width=\lineWidth] +(-\Length/2,0)--(-2*\unitL,0) +(2*\unitL,0)--(\Length/2,0); +\draw[#1,line width=\lineWidth,decorate,decoration={zigzag,segment length=3mm, amplitude=1mm}](-2*\unitL,0)--(2*\unitL,0); +\end{scope} +} \makeatother \ No newline at end of file diff --git a/graphics/pgf/contrib/structmech/structmech.tex b/graphics/pgf/contrib/structmech/structmech.tex index 96b01541c6..f47f3162ee 100644 --- a/graphics/pgf/contrib/structmech/structmech.tex +++ b/graphics/pgf/contrib/structmech/structmech.tex @@ -3,13 +3,13 @@ \usepackage{amsmath,fancyvrb,float,hyperref,structmech} \usepackage{mathpazo} \title{structmech\\\large{}A TikZ command set for structural mechanics drawings} -\author{Theodore Chang\footnote{E-mail: \href{tlcfem@gmail.com}{tlcfem@gmail.com}}\\[2mm]\normalsize{}University of Canterbury, Christchurch, NZ} -\date{\normalsize{}v1.1 released on \today} +\author{Theodore Chang\footnote{E-mail: \href{tlcfem@gmail.com}{tlcfem@gmail.com}}\\[2mm]\normalsize{}Humboldt-Universität zu Berlin, Berlin, Germany} +\date{\normalsize{}v1.2 released on \today} \newcommand*{\Highlight}[1]{\colorbox{cyan}{\color{red}\texttt{#1}}} \begin{document} \maketitle \section{Introduction} -This package is under GPL v3 license and/or later version. Please feel free to redistribute, expand or rewrite the functionality. +This package is under GPL v3 license and/or later versions. Please feel free to redistribute, extend or rewrite the functionality. \section{Options} To load the package, please use the following command in the preamble. \begin{Verbatim}[frame=single,label=Syntax] @@ -120,7 +120,7 @@ Here are some examples that use the basic force command to show how the user can \item[][7] --- label for the second force drew, available for \Highlight{\#1=2}, leave blank if not required. \item[][8] --- label for the third force drew, available for \Highlight{\#1=3}, leave blank if not required. \end{enumerate} -The colours of three components can be configured using global options. Here are a few examples, please find out the order and the difference in the following fourteen examples. +The colours of the three components can be configured using global options. Here are a few examples, please find out the order and the difference in the following fourteen examples. \begin{Verbatim}[frame=single,label=Example] \BasicForce{0,0}{3,0}{} \BasicForce[1]{5,0}{8,0}{a}[U_1] @@ -413,7 +413,7 @@ It should be noted that parameter \Highlight{\#6} defines the difference of the \setstructmech{absvalue=on} \IForceB[purple]{4,4}{4,0}{3}{-1}{2}{0.5} \setstructmech{showvalue=off,opacity=.8} -\IForceB[cyan]{4,0}{0,0}{1.5}{0}{2}{0.5} +\IForceB[cyan]{4,0}{0,0}{1.5}{1}{2}{0.5} \end{Verbatim} \begin{figure}[H] \centering @@ -424,7 +424,7 @@ It should be noted that parameter \Highlight{\#6} defines the difference of the \setstructmech{absvalue=on} \IForceB[purple]{4,4}{4,0}{3}{-1}{2}{0.5} \setstructmech{showvalue=off,opacity=1} -\IForceB[cyan]{4,0}{0,0}{1.5}{0}{2}{0.5} +\IForceB[cyan]{4,0}{0,0}{1.5}{1}{2}{0.5} \end{tikzpicture} \end{figure} \section{Beam Deformation (Perpendicular)} @@ -483,4 +483,54 @@ Caveat: If the nodal translations are expressed as global values, they can be re \BeamDeformR[blue]{0,4}{4,4}[20][30]{2} \end{tikzpicture} \end{figure} +\section{Dashpot} +\begin{Verbatim}[frame=single,label=Syntax] +\Dashpot[1]{2}{3}{4} +\end{Verbatim} +\begin{enumerate} +\item[][1] --- optional, line colour. +\item[]\{2\} --- node coordinates of the lower end in form of \Highlight{$x,y$}. +\item[]\{3\} --- node coordinates of the higher end in form of \Highlight{$x,y$}. +\item[]\{4\} --- optional, scale. +\end{enumerate} +\begin{Verbatim}[frame=single,label=Example] +\Dashpot{0,0}{0,3} +\Dashpot[blue]{2,0}{5,4}{2} +\setstructmech{linewidth=1mm} +\Dashpot[purple]{5,0}{10,2} +\end{Verbatim} +\begin{figure}[H] +\centering +\begin{tikzpicture} +\Dashpot{0,0}{0,3} +\Dashpot[blue]{2,0}{5,4}{2} +\setstructmech{linewidth=1mm} +\Dashpot[purple]{5,0}{10,2} +\end{tikzpicture} +\end{figure} +\section{Spring} +\begin{Verbatim}[frame=single,label=Syntax] +\Spring[1]{2}{3}{4} +\end{Verbatim} +\begin{enumerate} +\item[][1] --- optional, line colour. +\item[]\{2\} --- node coordinates of the lower end in form of \Highlight{$x,y$}. +\item[]\{3\} --- node coordinates of the higher end in form of \Highlight{$x,y$}. +\item[]\{4\} --- optional, scale. +\end{enumerate} +\begin{Verbatim}[frame=single,label=Example] +\Spring{0,0}{0,3} +\Spring[blue]{2,0}{5,4}{2} +\setstructmech{linewidth=1mm} +\Spring[purple]{5,0}{10,2} +\end{Verbatim} +\begin{figure}[H] +\centering +\begin{tikzpicture} +\Spring{0,0}{0,3} +\Spring[blue]{2,0}{5,4}{2} +\setstructmech{linewidth=1mm} +\Spring[purple]{5,0}{10,2} +\end{tikzpicture} +\end{figure} \end{document} \ No newline at end of file -- cgit v1.2.3