<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Rob Siegwart - FEA</title><link href="https://www.robsiegwart.com/" rel="alternate"/><link href="https://www.robsiegwart.com/feeds/fea.atom.xml" rel="self"/><id>https://www.robsiegwart.com/</id><updated>2022-04-10T00:00:00-05:00</updated><entry><title>FEA Basics and Development of a 2D Link Element</title><link href="https://www.robsiegwart.com/fea-basics-and-development-of-a-2d-link-element.html" rel="alternate"/><published>2021-06-17T00:00:00-05:00</published><updated>2022-04-10T00:00:00-05:00</updated><author><name>Rob Siegwart</name></author><id>tag:www.robsiegwart.com,2021-06-17:/fea-basics-and-development-of-a-2d-link-element.html</id><summary type="html">&lt;p&gt;In my quest to learn more about the inner workings of the finite element method
and its programming implementation, I have started off attempting to program the
simplest of FEA models and analyses via the direct stiffness method. (Here is my
work so far on the topic of this article …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In my quest to learn more about the inner workings of the finite element method
and its programming implementation, I have started off attempting to program the
simplest of FEA models and analyses via the direct stiffness method. (Here is my
work so far on the topic of this article - &lt;a class="reference external" href="https://github.com/robsiegwart/simpleFEA"&gt;simpleFEA&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;To that end, a 2D link or truss element is probably the simplest finite element
there is (maybe besides a point mass).&lt;/p&gt;
&lt;div class="section" id="concepts"&gt;
&lt;h2&gt;Concepts&lt;/h2&gt;
&lt;div class="section" id="big-picture"&gt;
&lt;h3&gt;Big Picture&lt;/h3&gt;
&lt;p&gt;The basics of a linear structural FEA is the stiffness equation:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{F} = \mathbf{K}\mathbf{U}
\end{equation*}
&lt;/div&gt;
&lt;p&gt;where &lt;span class="math"&gt;\(\mathbf{F}\)&lt;/span&gt; is the global force vector, &lt;span class="math"&gt;\(\mathbf{K}\)&lt;/span&gt; the global
stiffness matrix, and &lt;span class="math"&gt;\(\mathbf{U}\)&lt;/span&gt; the global displacement vector. The size of
this system (length of vector) is equal to the total number of nodal
degrees-of-freedom (DOF). The goal of the linear finite element program
therefore is to assemble and solve this system of equations.&lt;/p&gt;
&lt;p&gt;The matrix form of this equation represents the interrelation of the
connectivity of nodes by elements. If expanded, each row would contain only
those nodes that contribute to the force term of that row. And, a node typically
is only connected to a few elements and because there are usually a large number
of elements, this matrix contains many empty/zero entries. (This leads to the
concept of &lt;em&gt;sparse matrices&lt;/em&gt; which are specialized ways to store matrix data when
much of the matrix is empty.)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="coordinate-systems"&gt;
&lt;h2&gt;Coordinate Systems&lt;/h2&gt;
&lt;p&gt;All elements have the concept of a local coordinate system where they are
aligned in a convenient orientation for deriving equations. When assembled into
a finite element model, however, the element may be oriented in any orientation.
Thus, a process of &lt;em&gt;transformation&lt;/em&gt; is needed to transform the quantities involved
in the constituent equations, such as force and displacement, from the local
element system to the global coordinate system, and vice-versa. For that, we use
a transformation matrix. In a &lt;a class="reference external" href="https://robsiegwart.com/blog/change-of-basis-and-the-transformation-matrix/"&gt;previous post&lt;/a&gt;
I demonstrated the basic concept of a transformation matrix.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="truss-element"&gt;
&lt;h2&gt;Truss Element&lt;/h2&gt;
&lt;p&gt;The truss element is represented schematically and can be modeled as a spring:
it may only take tension or compression. Each node has two DOF, &lt;cite&gt;x&lt;/cite&gt; and &lt;cite&gt;y&lt;/cite&gt;. The
element coordinate system has its x-axis aligned with the element direction
vector going from node &lt;cite&gt;i&lt;/cite&gt; to node &lt;cite&gt;j&lt;/cite&gt;. Quantities with respect to the local
element coordinate system are indicated by the bar over the variable.&lt;/p&gt;
&lt;img alt="" class="img-250" id="d-truss-element" src="https://robsiegwart.nyc3.digitaloceanspaces.com/Images/FEA/link2d-1.png" /&gt;
&lt;p&gt;It is considered a &lt;em&gt;discrete&lt;/em&gt; element as opposed to a &lt;em&gt;continuum&lt;/em&gt; element which has
its variables governed by differential equations.&lt;/p&gt;
&lt;p&gt;With the element having constant properties &lt;cite&gt;A&lt;/cite&gt; (area), &lt;cite&gt;E&lt;/cite&gt; (elastic modulus), and
an inferred length from the nodes, &lt;cite&gt;L&lt;/cite&gt;, the element stiffness in the axial
direction is:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
k = \frac{AE}{L}
\end{equation*}
&lt;/div&gt;
&lt;img alt="" class="img-250" id="d-link-force-equilibrium" src="https://robsiegwart.nyc3.digitaloceanspaces.com/Images/FEA/link2d-2.png" /&gt;
&lt;p&gt;Since the element may only take tension or compression, elemental y axis forces
do not contribute to member stiffness. Thus, force equilibrium and
force-displacement relations become:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\bar{f} = k\Delta x = \frac{AE}{L} (\bar{u}_{x,j} - \bar{u}_{x,i})
\end{equation*}
&lt;/div&gt;
&lt;p&gt;where &lt;span class="math"&gt;\(\Delta x\)&lt;/span&gt; is the elongation of the bar, equal to &lt;span class="math"&gt;\(\bar{u}_{x,j} - \bar{u}_{x,i}\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Then, force equilibrium requires:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
-\bar{f}_{x,i} = \bar{f}_{x,j}
\end{equation*}
&lt;/div&gt;
&lt;p&gt;The &lt;em&gt;local&lt;/em&gt; element stiffness equations are then as follows:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
-\bar{f}_{x,i} = \frac{AE}{L} (\bar{u}_{x,j} - \bar{u}_{x,i}) \qquad
\text{or} \qquad \bar{f}_{x,i} = \frac{AE}{L} (- \bar{u}_{x,j} +
\bar{u}_{x,i})
\end{equation*}
&lt;/div&gt;
&lt;div class="math"&gt;
\begin{equation*}
\bar{f}_{x,j} = \frac{AE}{L} (\bar{u}_{x,j} - \bar{u}_{x,i})
\end{equation*}
&lt;/div&gt;
&lt;p&gt;Which can be combined into matrix form, &lt;span class="math"&gt;\(\mathbf{\bar{F}} = \mathbf{\bar{K}}\mathbf{\bar{U}}\)&lt;/span&gt;:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\begin{bmatrix} \bar{f}_{x,i} \\ \bar{f}_{y,i}\\ \bar{f}_{x,j}\\
\bar{f}_{y,j} \end{bmatrix} = \frac{AE}{L} \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp;
0 &amp;amp; 0 &amp;amp; 0\\-1 &amp;amp; - &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\end{bmatrix} \begin{bmatrix}
\bar{u}_{x,i} \\ \bar{u}_{y,i}\\ \bar{u}_{x,j}\\ \bar{u}_{y,j} \end{bmatrix}
\end{equation*}
&lt;/div&gt;
&lt;p&gt;The 4x4 matrix with the coefficient is the element stiffness matrix in the
element coordinate system, and for an individual element in the context of a
collection of elements is denoted as &lt;span class="math"&gt;\(\mathbf{\bar{K}}^e\)&lt;/span&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="transformation"&gt;
&lt;h2&gt;Transformation&lt;/h2&gt;
&lt;p&gt;Transformation is needed to convert element quantities in the local element
coordinate system to those in the global element coordinate system so they may
be appropriately combined into global stiffness equations. The position or
orientation of the element is defined by the nodal coordinates.&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{\bar{u}_{x,i}}
\end{equation*}
&lt;/div&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{\bar{u}_{y,i}}
\end{equation*}
&lt;/div&gt;
&lt;p&gt;Displacement transformations may be inferred from graphical analysis.&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\bar{u}_{x,i} = u_{x,i}\cos\theta + u_{y,i}\sin\theta
\end{equation*}
&lt;/div&gt;
&lt;div class="math"&gt;
\begin{equation*}
\bar{u}_{y,i} = -u_{x,i}\sin\theta + u_{y,i}\cos\theta
\end{equation*}
&lt;/div&gt;
&lt;img alt="" class="img-250" id="u-x-i" src="https://robsiegwart.nyc3.digitaloceanspaces.com/Images/FEA/uxi%20transform.png" /&gt;
&lt;p&gt;The equations for node j are the same as for node i.&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\bar{u}_{x,j} = u_{x,j}\cos\theta + u_{y,j}\sin\theta
\end{equation*}
&lt;/div&gt;
&lt;div class="math"&gt;
\begin{equation*}
\bar{u}_{y,j} = u_{x,j}\sin\theta + u_{y,j}\cos\theta
\end{equation*}
&lt;/div&gt;
&lt;img alt="" class="img-250" id="u-y-i" src="https://robsiegwart.nyc3.digitaloceanspaces.com/Images/FEA/uyi%20transform.png" /&gt;
&lt;p&gt;Putting all 4 equations into matrix form, and with the helpers of
&lt;span class="math"&gt;\(c=\cos\theta\)&lt;/span&gt; and &lt;span class="math"&gt;\(s=\sin\theta\)&lt;/span&gt;, we have:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\begin{bmatrix}\bar{u}_{x,i} \\ \bar{u}_{y,i} \\ \bar{u}_{x,j} \\
\bar{u}_{y,j}\end{bmatrix} = \begin{bmatrix} c &amp;amp; s &amp;amp; 0 &amp;amp; 0 \\ -s &amp;amp; c &amp;amp; 0 &amp;amp; 0 \\
0 &amp;amp; 0 &amp;amp; c &amp;amp; s \\ 0 &amp;amp; 0 &amp;amp; -s &amp;amp; c\end{bmatrix} \begin{bmatrix} u_{x,i} \\ u_{y,i}
\\ u_{x,j} \\ u_{y,j} \end{bmatrix}
\end{equation*}
&lt;/div&gt;
&lt;p&gt;Force transformations are the same as for displacement:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\begin{bmatrix}\bar{f}_{x,i} \\ \bar{f}_{y,i} \\ \bar{f}_{x,j} \\
\bar{f}_{y,j}\end{bmatrix} = \begin{bmatrix} c &amp;amp; s &amp;amp; 0 &amp;amp; 0 \\ -s &amp;amp; c &amp;amp; 0 &amp;amp; 0 \\
0 &amp;amp; 0 &amp;amp; c &amp;amp; s \\ 0 &amp;amp; 0 &amp;amp; -s &amp;amp; c\end{bmatrix} \begin{bmatrix} f_{x,i} \\ f_{y,i}
\\ f_{x,j} \\ f_{y,j} \end{bmatrix}
\end{equation*}
&lt;/div&gt;
&lt;p&gt;The 4x4 matrix used here is the &lt;em&gt;transformation matrix&lt;/em&gt; and is denoted as
&lt;span class="math"&gt;\(\mathbf{T}^e\)&lt;/span&gt;. Conversion of quantities from the global coordinate system
to the element coordinate system is done by:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{\bar{U}}^e = \mathbf{T}^e \mathbf{U}^e
\end{equation*}
&lt;/div&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{\bar{F}}^e = \mathbf{T}^e \mathbf{F}^e
\end{equation*}
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="global-equations"&gt;
&lt;h2&gt;Global Equations&lt;/h2&gt;
&lt;p&gt;Generation of global equations is developed by first setting equal the equations
for the local element on a force basis, which yields:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{\bar{F}}^e = \mathbf{\bar{K}}^e \mathbf{\bar{U}}^e
\end{equation*}
&lt;/div&gt;
&lt;p&gt;and is equal to:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{T}^e\mathbf{F}^e = \mathbf{\bar{K}}^e \mathbf{T}^e\mathbf{U}^e
\end{equation*}
&lt;/div&gt;
&lt;p&gt;Next, both sides are multiplied by &lt;span class="math"&gt;\((\mathbf{T}^e)^{-1}\)&lt;/span&gt;, which for this
element type is also equal to the transpose, &lt;span class="math"&gt;\((\mathbf{T}^e)^T\)&lt;/span&gt;:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
(\mathbf{T}^e)^T \mathbf{T}^e \mathbf{F}^e = (\mathbf{T}^e)^T
\mathbf{\bar{K}}^e \mathbf{T}^e \mathbf{U}^e
\end{equation*}
&lt;/div&gt;
&lt;p&gt;which becomes,&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{F}^e = (\mathbf{T}^e)^T \mathbf{\bar{K}}^e \mathbf{T}^e \mathbf{U}^e
\end{equation*}
&lt;/div&gt;
&lt;p&gt;therefore, the element's stiffness matrix in &lt;em&gt;global coordinates&lt;/em&gt; is:&lt;/p&gt;
&lt;div class="math"&gt;
\begin{equation*}
\mathbf{K}^e = (\mathbf{T}^e)^T \mathbf{\bar{K}}^e \mathbf{T}^e
\end{equation*}
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="references"&gt;
&lt;h2&gt;References&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Introduction to Finite Element Methods (ASEN 5007). University of Colorado
at Boulder. &lt;a class="reference external" href="http://kis.tu.kielce.pl/mo/COLORADO_FEM/colorado/Home.html"&gt;http://kis.tu.kielce.pl/mo/COLORADO_FEM/colorado/Home.html&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;J. N. Reddy, Ph.D. Introduction to the Finite Element Method, Fourth Edition.
Analysis of Trusses, Chapter (McGraw-Hill Education: New York, Chicago, San
Francisco, Athens, London, Madrid, Mexico City, Milan, New Delhi, Singapore,
Sydney, Toronto, 2019, 2006, 1993, 1984).
&lt;a class="reference external" href="https://www.accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter6/section/section3"&gt;https://www.accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter6/section/section3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;script type='text/javascript'&gt;if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
    var align = "center",
        indent = "0em",
        linebreak = "false";

    if (false) {
        align = (screen.width &lt; 768) ? "left" : align;
        indent = (screen.width &lt; 768) ? "0em" : indent;
        linebreak = (screen.width &lt; 768) ? 'true' : linebreak;
    }

    var mathjaxscript = document.createElement('script');
    mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
    mathjaxscript.type = 'text/javascript';
    mathjaxscript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML';

    var configscript = document.createElement('script');
    configscript.type = 'text/x-mathjax-config';
    configscript[(window.opera ? "innerHTML" : "text")] =
        "MathJax.Hub.Config({" +
        "    config: ['MMLorHTML.js']," +
        "    TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'none' } }," +
        "    jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
        "    extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
        "    displayAlign: '"+ align +"'," +
        "    displayIndent: '"+ indent +"'," +
        "    showMathMenu: true," +
        "    messageStyle: 'normal'," +
        "    tex2jax: { " +
        "        inlineMath: [ ['\\\\(','\\\\)'] ], " +
        "        displayMath: [ ['$$','$$'] ]," +
        "        processEscapes: true," +
        "        preview: 'TeX'," +
        "    }, " +
        "    'HTML-CSS': { " +
        "        availableFonts: ['STIX', 'TeX']," +
        "        preferredFont: 'STIX'," +
        "        styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'inherit ! important'} }," +
        "        linebreaks: { automatic: "+ linebreak +", width: '90% container' }," +
        "    }, " +
        "}); " +
        "if ('default' !== 'default') {" +
            "MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {" +
                "var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
                "VARIANT['normal'].fonts.unshift('MathJax_default');" +
                "VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
                "VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
                "VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
            "});" +
            "MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {" +
                "var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
                "VARIANT['normal'].fonts.unshift('MathJax_default');" +
                "VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
                "VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
                "VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
            "});" +
        "}";

    (document.body || document.getElementsByTagName('head')[0]).appendChild(configscript);
    (document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}
&lt;/script&gt;</content><category term="FEA"/><category term="python"/></entry><entry><title>Experimenting with ANSYS ACT in Mechanical</title><link href="https://www.robsiegwart.com/experimenting-with-ansys-act-in-mechanical.html" rel="alternate"/><published>2019-09-07T00:00:00-05:00</published><updated>2022-03-28T00:00:00-05:00</updated><author><name>Rob Siegwart</name></author><id>tag:www.robsiegwart.com,2019-09-07:/experimenting-with-ansys-act-in-mechanical.html</id><summary type="html">&lt;p class="first last"&gt;Playing around with Python integration in ANSYS Mechanical.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;ANSYS ACT is the scripting API for various ANSYS products. It is available for
Workbench, Mechanical, Fluent, and others. It uses Python 2 and in Mechanical it
allows much of the standard click operations to be accessed programmatically.&lt;/p&gt;
&lt;div class="section" id="usage"&gt;
&lt;h2&gt;Usage&lt;/h2&gt;
&lt;p&gt;In Mechanical, the ACT Console is a pane that allows for running and testing
scripts. It is accessed by clicking the white rectangular icon next to the Help
menu by default (in pre-tabbed interfaces - in ANSYS 2019R2, the program
switched to a tabbed interface).&lt;/p&gt;
&lt;img alt="" src="https://robsiegwart.nyc3.digitaloceanspaces.com/Images/experimenting-with-ansys-act-for-mechanical/btn.PNG" /&gt;
&lt;p&gt;With the ACT Console open, you have more or less a standard Python interpreter.
You issue commands in the command line (darkened area at the bottom), and see
results in the area above it. The console features auto-completion and can be
used interactively, especially while developing new scripts. New lines, such as
with &lt;cite&gt;for&lt;/cite&gt; loops, can be entered with &lt;cite&gt;SHIFT + ENTER&lt;/cite&gt;.&lt;/p&gt;
&lt;img alt="" src="https://robsiegwart.nyc3.digitaloceanspaces.com/Images/experimenting-with-ansys-act-for-mechanical/console2.PNG" /&gt;
&lt;p&gt;There is a pane on the left which holds Snippets, which are simply files storing
code for reuse. You can create your own snippets for actions that you want to
remember or perform more than once. You do this by clicking on the Add Snippet
button (left most icon in the snippet portion of the toolbar). Then, when you
click on the snippet from the Bookmarks pane, the code is simply inserted into
the command line and can be executed by pressing &lt;cite&gt;ENTER&lt;/cite&gt;.&lt;/p&gt;
&lt;p&gt;A collection of snippets can be grouped together and imported/exported. This
might be useful if you or your company has a set of scripts that you use. To use
this functionality, create a new group and give it a name. Drag your snippets
into it. Then, in the ACT toolbar, export the snippets to an XML file. This
exports all of the snippets, including the default ones that came loaded when
you opened the console. These can easily be removed by editing the XML file
after it is saved. In the XML file, find the group that has the name of your
group, and delete everything else, not including the parent xml tags. For
example, if I add the following snippet &lt;cite&gt;Snippet 1&lt;/cite&gt; and group &lt;cite&gt;My Snippets&lt;/cite&gt;:&lt;/p&gt;
&lt;img alt="" src="https://robsiegwart.nyc3.digitaloceanspaces.com/Images/experimenting-with-ansys-act-for-mechanical/console_2.png" /&gt;
&lt;p&gt;After exporting I find an xml file with the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cm"&gt;&amp;lt;!--?xml version=\&amp;quot;1.0\&amp;quot; encoding=\&amp;quot;utf-8\&amp;quot;?--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;model&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;maxid=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;5\&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;root&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;folder&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;1\&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;label=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;Folder\&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;bookmark&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;2\&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;label=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;ExtAPI\&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;\t&lt;span class="cm"&gt;&amp;lt;!--[CDATA[ExtAPI.]]--&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/bookmark&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/folder&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;folder&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;4\&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;label=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;My&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Snippets\&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;bookmark&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;5\&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;label=&lt;/span&gt;&lt;span class="s"&gt;\&amp;quot;Snippet&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;1\&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;\t&lt;span class="cm"&gt;&amp;lt;!--[CDATA[print Hello World!]]--&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/bookmark&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/folder&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/root&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/model&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this case I will want to simply delete the &lt;tt class="docutils literal"&gt;&amp;lt;folder&amp;gt;&lt;/tt&gt; item with the
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;label=\&amp;quot;Folder\&amp;quot;&lt;/span&gt;&lt;/tt&gt; attribute, since that is code not pertaining to my custom folder.
ANSYS stores the actual code for the snippet in the &lt;tt class="docutils literal"&gt;bookmark&lt;/tt&gt; field; in this case
the code is &lt;tt class="docutils literal"&gt;print Hello World!&lt;/tt&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="api"&gt;
&lt;h2&gt;API&lt;/h2&gt;
&lt;p&gt;An API is how operations and objects in Mechanical are retrieved and manipulated
with code. The default global variable that gives access to all objects in
Mechanical is &lt;tt class="docutils literal"&gt;ExtAPI&lt;/tt&gt;. From this you can access all other objects using Python
dot syntax. Listed below are some of the objects in Mechanical and their classes
and access points. It is common to assign these to a variable so that they do
not need to be fetched each time. For example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;solution&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExtAPI&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DataModel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Analyses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Solution&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;table class="wide-table"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Object&lt;/th&gt;
            &lt;th width="50%"&gt;Access&lt;/th&gt;
            &lt;th&gt;Note&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;The Project&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;ExtAPI.DataModel.Project&lt;/code&gt;&lt;/td&gt;
            &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;List of Analyses&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;ExtAPI.DataModel.Project.Model.Analyses&lt;/code&gt;&lt;/td&gt;
            &lt;td&gt;This is list-like and indexable/loopable&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Analysis working directory&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;ExtAPI.DataModel.Project.Model.Analyses[0].WorkingDir&lt;/code&gt;&lt;/td&gt;
            &lt;td&gt;Gets the working directory for the first analysis system (zeroth index)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Connections&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;ExtAPI.DataModel.Project.Model.Connections&lt;/code&gt;&lt;/td&gt;
            &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Solution&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;ExtAPI.DataModel.Project.Model.Analyses[0].Solution&lt;/code&gt;&lt;/td&gt;
            &lt;td&gt;This is the solution object for the first analysis system (zeroth index)&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;&lt;br&gt;
&lt;table class="wide-table"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Object&lt;/th&gt;
            &lt;th&gt;Class&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;Force Reaction Probe&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;Ansys.ACT.Automation.Mechanical.Results.ProbeResults.ForceReaction&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Moment Reaction Probe&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;Ansys.ACT.Automation.Mechanical.Results.ProbeResults.MomentReaction&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Beam Probe&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;Ansys.ACT.Automation.Mechanical.Results.ProbeResults.BeamProbe&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Tree Group Folder&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;Ansys.ACT.Automation.Mechanical.TreeGroupingFolder&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;div class="section" id="change-the-python-directory-to-the-user-files-directory-for-a-project"&gt;
&lt;h2&gt;Change the Python directory to the &lt;tt class="docutils literal"&gt;user_files&lt;/tt&gt; directory for a Project&lt;/h2&gt;
&lt;p&gt;Scripts that save out to a file might want to take advantage of the &lt;cite&gt;user_files&lt;/cite&gt;
directory. The &lt;cite&gt;user_files&lt;/cite&gt; directory exists at the first level of the project
files directory and is for storing user information pertaining to a Workbench
project. I haven't found the path for this as a parameter in the API directly so
the below is a way to obtain it from an analysis working directory. It splits
the path at the Workbench project folder, so &lt;cite&gt;_files&lt;/cite&gt; must not come before the
Workbench folder in the path or it will return the wrong location.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;os&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;chdir&lt;/span&gt;
&lt;span class="n"&gt;MECH_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExtAPI&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DataModel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Analyses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WorkingDir&lt;/span&gt;
&lt;span class="n"&gt;user_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MECH_dir&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;_files&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sa"&gt;r&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;_files\user_files&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;chdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_dir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="usage-example-results-exporting"&gt;
&lt;h2&gt;Usage Example: Results Exporting&lt;/h2&gt;
&lt;p&gt;One of the major limitations of Workbench / Mechanical is getting result probes
out of Mechanical and into an external file (Excel, text file, etc.). If you
only have a few result probes this is no problem - copy and paste will work
fine. However, if you have a hundred, there is not an easy way to get all of the
data and more importantly formatted as you like. Additionally, for a contact,
you will likely want a Force Probe and a Moment Probe; these are two separate
items in the Solution and you must export both and associate correctly with the
contact they are referring to. With ACT, you can &lt;a class="reference external" href="https://github.com/robsiegwart/ANSYS-ACT-snippets/blob/master/Export%20Weld%20Force-Moment%20Probes%20from%20Solution.py"&gt;programmatically loop through
these items&lt;/a&gt;
and save them to a text file.&lt;/p&gt;
&lt;div class="section" id="beams"&gt;
&lt;h3&gt;Beams&lt;/h3&gt;
&lt;p&gt;In this case you have some beams in your model defined under the Connections
folder and you'd like to export the beam probes. If you've already created a
result probe for them, you can retrieve and export them as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;solution&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExtAPI&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DataModel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Analyses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Solution&lt;/span&gt;
&lt;span class="n"&gt;beam_probes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetType&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;Ansys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ACT&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Automation&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Mechanical&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Results&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ProbeResults&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BeamProbe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;solution&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Children&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Beam results.txt&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Beam Probes&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Name&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;Axial Force&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;Torque&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;Shear Force at I&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;Shear Force at J&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;Moment at I&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;Moment at J&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;bp&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;beam_probes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BoundaryConditionSelection&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;
    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AxialForce&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Torque&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ShearForceAtI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ShearForceAtJ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MomentAtI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MomentAtJ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With the following tree, and after setting the working directory to the
&lt;tt class="docutils literal"&gt;user_files&lt;/tt&gt; directory, running the above code produces &lt;tt class="docutils literal"&gt;Beam results.txt&lt;/tt&gt;:&lt;/p&gt;
&lt;pre class="code literal-block" id="beam-results-txt"&gt;
Name    Axial Force Torque  Shear Force at I    Shear Force at J    Moment at I Moment at J

Bolt 1  23.464579153988097  -0.69336988094428165    95.214531366676013  95.214531366676013  12.945849648564687  11.227034167745025
Bolt 2  -23.464579153988097     -0.70081092496467057    104.8404773221031   104.8404773221031   14.025457881021863  12.521195678519947
&lt;/pre&gt;
&lt;p&gt;This file is tab-delimited and the bolt names come from the name of the beam
items in the Connections folder. Additionally, the unit is stripped from the
result.&lt;/p&gt;
&lt;p&gt;See full snippets on Github: &lt;a class="reference external" href="https://github.com/robsiegwart/ANSYS-ACT-snippets"&gt;https://github.com/robsiegwart/ANSYS-ACT-snippets&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><category term="FEA"/><category term="python"/><category term="ANSYS"/></entry></feed>