<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Python get Structual element by Name</title><link>https://communities.bentley.com/products/geotech-analysis/f/forum/236767/python-get-structual-element-by-name</link><description>Hi, 
 there is a script example to get the anchor forces out during several phases: 
 Output scripting example: get anchor force - PLAXIS | SOILVISION Wiki - PLAXIS | SOILVISION - Bentley Communities 
 the anchor is identified by its location (g_o.getresults</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Python get Structual element by Name</title><link>https://communities.bentley.com/thread/756914?ContentTypeID=1</link><pubDate>Fri, 10 Mar 2023 09:07:22 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:1ae77a93-11fa-40fc-abd0-962cdeb45386</guid><dc:creator>Stefanos Papavasileiou</dc:creator><description>&lt;p&gt;Dear Zakaria,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am missing some information here, which makes it difficult to give a straightforward answer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will give you nevertheless an approach you can use.&lt;/p&gt;
&lt;p&gt;If you are working with PLAXIS Output and with the &lt;em&gt;getresults&lt;/em&gt; (or any of the &amp;quot;results&amp;quot; commands) our approach is to use the syntax that supports providing the name of the plate already instead of collecting the results for all plates. So, for instance:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;for plate_parent in g_o.Plates[:]:
    for plate_cut in plate_parent:
        print(plate_cut.Name)
        uy_per_plate_cut = g_o.getresults(plate_cut, g_o.Phases[-1], g_o.ResultTypes.Plate.Uy, &amp;#39;node&amp;#39;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note that the g_i.get_equivalent() is a function implemented by us to identify the equivalent object between modes in Input and between Input and Output.&amp;nbsp;The case of the user above is different and&amp;nbsp;I would recommend the approach I just described.&lt;/p&gt;
&lt;p&gt;If you need further assistance with this, please&amp;nbsp;&lt;span&gt;submit a service request.&amp;nbsp;&lt;/span&gt;&lt;span&gt;Then, one of our support engineers can help you in detail: &lt;a href="https://apps.bentley.com/srmanager/ProductSupport"&gt;https://apps.bentley.com/srmanager/ProductSupport&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Python get Structual element by Name</title><link>https://communities.bentley.com/thread/756773?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 15:13:27 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:dfa484ec-8ec8-4e4f-a77c-3a7fc52deed8</guid><dc:creator>Zakaria ZIRI</dc:creator><description>&lt;p&gt;Hi, I&amp;#39;m interested in getting the name of each plate in my results dataframe. I tried the g_i.get_equivalent() method but I didn&amp;#39;t get what I wanted. Maybe I didn&amp;#39;t use it well. Could you provide an example please ?Thanks !&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Python get Structual element by Name</title><link>https://communities.bentley.com/thread/736491?ContentTypeID=1</link><pubDate>Thu, 13 Oct 2022 10:22:24 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:86ff71f9-ce73-4279-84f6-9aef060a18aa</guid><dc:creator>Falko Schmidt</dc:creator><description>&lt;p&gt;Hi Stefanos,&lt;/p&gt;
&lt;p&gt;after digging in a bit:&lt;/p&gt;
&lt;p&gt;I used the&amp;nbsp;&lt;em&gt;g_i.get_equivalent() &lt;/em&gt;method to get the Name of the plate and do some filtering on the results.&lt;/p&gt;
&lt;p&gt;Thank You Stefanos.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Python get Structual element by Name</title><link>https://communities.bentley.com/thread/736232?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2022 20:59:09 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8e403070-1403-40f0-9546-d2729dc8604f</guid><dc:creator>Falko Schmidt</dc:creator><description>&lt;p&gt;Hi Stefanos,&lt;/p&gt;
&lt;p&gt;thank you for your reply, actually I sorted that out after posting the question and edited the question. the code produces now lines like in your screenshot. I only need to separate / filter by Plate ID (Plate_9 for example) in order to get usefull data? Goal is to get the Plate data sorted by a property (ID or Name).&lt;/p&gt;
&lt;p&gt;I guess If I get the Plate_9 plate objects, Plate_9_1, Plate_9_2 are included.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Python get Structual element by Name</title><link>https://communities.bentley.com/thread/736154?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2022 12:33:53 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5c3fdd9a-bed7-4aa4-971e-01a7d57665cb</guid><dc:creator>Stefanos Papavasileiou</dc:creator><description>&lt;p&gt;Hello Falko,&lt;/p&gt;
&lt;p&gt;This is a Python issue (not a PLAXIS one) in which you are simply confused about which variables to call in the print statement.&lt;/p&gt;
&lt;p&gt;You do a for-loop over the lists that contain the results:&amp;nbsp;&lt;em&gt;X, Uxs, Uys&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;With this for-loop you use the internal variables:&amp;nbsp;&lt;em&gt;x, y, N&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;And when it comes to printing them you should use the internal ones and not the full lists. So, just replace the last command with the following and everything runs smoothly:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;print(&amp;quot;Plate @ x {}: horizDisp {:.2f} m vertSettlement {:.2f} m&amp;quot;.format(x, y, N))&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In the future, it will be helpful to you to do a small debugging yourself as you could spot this problem&amp;nbsp;by understanding the error message Python gives you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It mentions a &lt;em&gt;TypeError&lt;/em&gt; and an &lt;em&gt;unsupported format string passed&lt;/em&gt;. This points to the&amp;nbsp;&lt;em&gt;{:.2f} &lt;/em&gt;which is the string formatting you do.&lt;br /&gt;For instance, by removing it you would get the command working but here is how it looks:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343671/pastedimage1665491536191v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;This is what triggered me to check what is actually passed to the string formating via the {}. And then you see that for every line you get the same, which is true, you get the full list as an object (PlxProxyObjectValues to be precise).&lt;/p&gt;
&lt;p&gt;I hope that this helps (in the future, too).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For the record this is the correct one:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343671/pastedimage1665491674454v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Python get Structual element by Name</title><link>https://communities.bentley.com/thread/736131?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2022 10:49:28 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:69123224-d7d1-4618-a3ea-7f2bf71a3b80</guid><dc:creator>Falko Schmidt</dc:creator><description>&lt;p&gt;Thanks Stefanos,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;my model has a lot of plates, and is subject to changes, so I will have to repeat the data extraction procedure. Due to productivity I need to avoid manual actions.&lt;/p&gt;
&lt;p&gt;I was adapting the anchor script :&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt; anchorF = g_o.getresults(fase, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; g_o.ResultTypes.NodeToNodeAnchor.AnchorForce2D, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;#39;node&amp;#39;) &lt;/em&gt;&lt;br /&gt;&lt;em&gt; anchorX = g_o.getresults(fase, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; g_o.ResultTypes.NodeToNodeAnchor.X, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;#39;node&amp;#39;) &lt;/em&gt;&lt;br /&gt;&lt;em&gt; anchorY = g_o.getresults(fase, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; g_o.ResultTypes.NodeToNodeAnchor.Y, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;#39;node&amp;#39;) &lt;/em&gt;&lt;br /&gt; &lt;br /&gt;&lt;em&gt; for x,y,N in zip(anchorX,anchorY,anchorF): &lt;/em&gt;&lt;br /&gt;&lt;em&gt; # check for the correct anchor by location:&lt;/em&gt;&lt;br /&gt;&lt;em&gt; print(&amp;quot;Anchor force N in {}: {:.2f} kN/m&amp;quot;.format(fase.Name,N))&lt;/em&gt;&lt;br /&gt;&lt;em&gt; #if abs(x - Xanchor) &amp;lt; 1E-5 and abs(y - Yanchor) &amp;lt; 1E-5: &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;for plates (just an example):&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt; Uxs = g_o.getresults(fase, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; g_o.ResultTypes.Plate.Ux, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;#39;node&amp;#39;)&lt;/em&gt;&lt;br /&gt;&lt;em&gt; Uys = g_o.getresults(fase, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; g_o.ResultTypes.Plate.Uy, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;#39;node&amp;#39;)&lt;/em&gt;&lt;br /&gt;&lt;em&gt; X = g_o.getresults(fase, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; g_o.ResultTypes.Plate.X, &lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;#39;node&amp;#39;)&lt;/em&gt;&lt;br /&gt;for X,ux,uy in zip(Xs,Uxs,Uys): &lt;br /&gt;print(&amp;quot;Plate @ x {}: horizDisp {:.2f} m vertSettlement {:.2f} m&amp;quot;.format(X,ux,uy))&lt;/p&gt;
&lt;p&gt;while cycling the following output is generated:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;Plate @ x 105.6196: horizDisp 0.00 m vertSettlement -0.02 m&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Canthis be separated / filtered by Plate ID (Plate_9 for example)?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How would you get the sorted plate data out of the model?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT:there was an error in the code. Fixed it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Python get Structual element by Name</title><link>https://communities.bentley.com/thread/736073?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2022 07:59:18 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a3377a77-7221-452d-bbdb-bf0b956d3355</guid><dc:creator>Stefanos Papavasileiou</dc:creator><description>&lt;p&gt;Dear Falko,&lt;/p&gt;
&lt;p&gt;The getresults command supports an object name directly as a parameter. This means you can do the following:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;g_o.getresults(&lt;strong&gt;g_o.NodeToNodeAnchors[0]&lt;/strong&gt;, g_o.Phases[-1], g_o.ResultTypes.NodeToNodeAnchor.Y, &amp;#39;node&amp;#39;)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Therefore you can simply have a for-loop for each anchor and avoid collecting all data and then sorting them out. This can prove to be a better approach overall.&lt;/p&gt;
&lt;p&gt;Currently most of the properties&amp;nbsp;in the &lt;em&gt;g_o.ResultTypes&lt;/em&gt; concern resulting values and not so much the name of objects, which is why you cannot find a property for the name.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>