Is there a way to run analysis in a iterative loop using OpenSTAAD. For example, I would like to run analysis 15 times while changing a certain parameter each time. I tried using 'objOpenSTAAD.Analyze' in a loop but after each iteration as follows
For i = 1 To 3 'Run Analysis objOpenSTAAD.Analyze 'Change to Postprocessing objOpenSTAAD.View.SetInterfaceMode 1 lLoadCase = 1 lNodeNo = 8 'Get Nodal Displacement objOpenSTAAD.Output.GetNodeDisplacements lNodeNo, lLoadCase, Disp Sheet4.Cells(3 + i, 2).Value = Disp(0) objOpenSTAAD.View.SetInterfaceMode 0 Next i
BUT
I have to manually click on 'Go to postprocessing' radio button and then chick on the load case for which the results need to be viewed etc. I want to avoid manual intervention. Any help or example problem please?
So, my new solution is:
sp.analyze()
While sp.isAnalyzing()
Wend
Wait(0.5)
I have been playing around with this, and it works relatively well... however, it seems I'm still running into a bit of a bug where the IsAnalyzing returns False but I get an error when trying to extract NodeDisplacements. I feel like it would be better if I had the abaility to Set the AreAnalysisResultsAvailable Flag. That way, I could reset it before the analysis and let the analysis command set it back when results are available. Then, I would always know that the new results are available.
AreResultsAvailable function checks whether the analysis results are available or not. It doesn't have the intelligence to understand whether any analysis is running in the background or not. So Application.Wait function is used to pause the code till the analysis is completed. There is another function available which can check if any analysis is running. You can use IsAnalyzing() function as --
Dim stat As BooleanSet suro = GetObject(, "StaadPro.OpenSTAAD")
stat = suro.IsAnalyzing()
This will report if analysis is running (True) or not (False). Also you can define it as Long variable (1 or 0 value respectively).
Thank you very much! Just a follow up on the issue presented by Karthik. Is there an alternative to the Application.Wait method? I would like my next iteration to run directly after the previous analysis is finish. The simple attempt I made was:
obj.analyze()
While Not obj.AreResultsAvailable()
I found this method to be insistent, which I assume is because obj.analyze() uses a separate thread and might not change AreResultsAvailable() before I get to my loop, and will result in the AreResultsAvailable() from the previous iteration analysis.
In STAAD.Pro CONNECT Edition version, a more informative and updated OpenSTAAD manual has been provided. But we notice few functions are still not documented. Our development team has been working on this, to update the OpenSTAAD help manual and in the future release of STAAD.Pro, you can find a updated manual with lots of more information. Meanwhile, if you need any information about OpenSTAAD, you can post your query here or create a service request. I will get back to you with relevant information.
My apologies for reopening this thread. But I found this answer very helpful... I am wondering why these methods are not given in the OpenSTAAD documentation... is there a more up to date document that I am missing?