<?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>Change variable in a loop</title><link>https://communities.bentley.com/products/geotech-analysis/f/forum/246465/change-variable-in-a-loop</link><description>Hello I&amp;#39;d like to know whether I can change values at a bunch of surfaceloads for different phases using a loop. this code doesn&amp;#39;t get any error but no results also, can you help please ? 
 
 Thank you</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Change variable in a loop</title><link>https://communities.bentley.com/thread/770134?ContentTypeID=1</link><pubDate>Mon, 19 Jun 2023 11:59:34 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:1f87d118-e382-4cea-8500-3f5c05e5b659</guid><dc:creator>Stefanos Papavasileiou</dc:creator><description>&lt;p&gt;Hello Zakaria,&lt;/p&gt;
&lt;p&gt;As we are the PLAXIS forum I will focus mainly on the PLAXIS side and let you sort out the best way to do this with your Python script.&lt;/p&gt;
&lt;p&gt;Based on what I read, I assume that seeing no results means that the PLAXIS command line has no commands executed either. That might be the case as I see that in your last line, the PLAXIS Python command is within quotation marks (&amp;#39; &amp;#39;) making it a string.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Instead, the command has to pass directly to the scripting layer and especially the PLAXIS object itself. Via the .format() this comes as a string making it different to target the PLAXIS object &lt;em&gt;SurfaceLoad_19&lt;/em&gt; or the string &amp;#39;&lt;span&gt;&lt;em&gt;SurfaceLoad_19&lt;/em&gt;&amp;#39;. I hope that this is clear now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So, a way to achieve that is to use the &lt;em&gt;getattr()&lt;/em&gt; function that PLAXIS offers. With this function, you provide a string, and you get the PLAXIS object. An example is:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;srfload = &amp;#39;SurfaceLoad_1_1&amp;#39;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;surface_load_obj = getattr(g_i, srfload)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;surface_load_obj.sigz[g_i.Phases[-1]] = -10&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The above code&amp;nbsp;should do the trick in helping you pass text as a string to PLAXIS objects and then be able to access them as commands.&lt;/p&gt;
&lt;p&gt;That means that your last command should not be a string, otherwise, PLAXIS will not execute anything.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change variable in a loop</title><link>https://communities.bentley.com/thread/769454?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 18:01:40 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:67d53751-3d46-4b55-b972-7e0c6fb94d0d</guid><dc:creator>Zakaria ZIRI</dc:creator><description>&lt;p&gt;and the table if it helps&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/343671/pastedimage1686679447193v2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change variable in a loop</title><link>https://communities.bentley.com/thread/769452?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 17:59:40 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:c588d91c-9b65-4b96-81a6-de9d758ba23a</guid><dc:creator>Zakaria ZIRI</dc:creator><description>&lt;p&gt;Correction:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/343671/pastedimage1686679319428v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;but still not working  &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>