Dear support,
I'm using the command to control the phase values, as I'm creating a big number of phases and the command helps me to save time and reduce error.
for this, I want to set a condition in specific phases to modify the values again.
:
if (phase_new == phase_35):
g_i.pointload_1_1.Fy[phase_new]=95
question is as follow:
I want to check phases and once I reach phase 35 I want to make the change.
the comparison into "if" is not working well.
how can I make a specific condition for phase identification (35)????
Dear Bahia,
You can simply use the .Name property for this, i.e.:
if phase_new.Name == "Phase_35": g_i.PointLoad_1_1.Fy[phase_new] = 95
Remember that Python is case sensitive and will fail if you make a typo.
Dear Stefanos,
thank you very much, but your command condition is applied for a single-phase(phase_35)!!
my idea is to change the phase data each 35 phases, it means I need to change it on (phase-35,phase-70,phase-105.....) and so on.
in a bunch of phases i can not insert it manually.
I'm asking for a loop to test phase each 35 phases to modify the data.
Hello Bahia,
Yes, you are right. Thank you for clarifying what is the exact purpose for this.
I understand now that you want the point load to be set to a specific value every 35 phases. I assume that you create your phases consecutively so I would expect a pure Python way of doing this.
By a quick online search, you can find similar questions in the Python community about how to "execute statement every N iterations in Python".
The solution usually tends to be a counter you set in your code for which the if-statement gets satisfied when it reaches a specific number and gets reset to zero afterwards.
Note that the great thing about Python and PLAXIS is that there is more than one way to achieve the same result. Depending on how your code is structured you can find multiple solutions.