Sorry for the poor formatting of the last post, I don't kown why this happens sometimes. It should have come out like this :
Hi,
I'm currently trying to get the maximum principal stress on two finite elements panelsl from Excel with VBA.
I'm getting the results with robApp.Project.Structure.Results.FiniteElems.MaxValue(extParams).Value and I'm feeding it with the following parameters :
extParams.ElementSel = objPanel.FiniteElems 'Where objPanel is the corresponding RobotObjObject extParams.CaseSel = CStr(loadCase) extParams.Smoothing = I_FRS_NO_SMOOTHING extParams.resultID = valType 'Here, this is equal to I_FRT_PRINCIPAL_S1 extParams.Layer = I_FLT_UPPER 'I'd have the maximal, minimal or absolute max but the values doesn't seem available...
Each time I call this function I get the same results as displayed in RSA for the first panel but the results for the second one are almost always wrong (eg I get 16 Mpa in excel for 3 Mpa displayed in RSA).
I noticed that I could get the same results in Excel as in RSA (thie right one I hope) if I close RSA and reopen the model, then call the function from excel without having run the model again.
Do you know where this problem comes from ?
Thanks, Regards.
PS : I posted in another topic about the method using the query mechanism but I got an error 429 and I read it might be even longer to run, so I'm back trying to make this method work.
MaxValue MinValue may present wrong values if more than 1 panel in model
Acknowledged.
Must be checked by developers.
Thank you for reporting
I will check resultsquery, but I need one more information :
have you compiled it as 64 bit application?
Hi,
Thanks for your answer. I'm looking forward to know where this comes from.
Regarding the problem with query, I'm running a Windows 64bits with RSA 2014 64bits and Excel in 32bits.
Regards.
Unfortunately resultsquery requires full compatibility between softwares - I mean it can be used only in 64bit enviroment
So you need MS Office 64 bit or make VB or C# or... program compiling it with 64 bit architecture
Use
ExtParams.PanelSel = RobApp.Project.Structure.Objects.Get(i).Number
instead of
ExtParams.ElementSel = RobApp.Project.Structure.Objects.Get(i).FiniteElems
I already tried that a while ago and I don't think I had an error, I'm gonna try again.
As I couldn't find a solution to quickly get the max stress, I tried a "brute force" solution that loops on every finite element in the provided panel and keeps the max stress that could be found.
This is much much longer that using the MaxValue and MinValue and I noticed I had the same problem than before : The VBA code read a stress of 24.36MPa for the second panel whereas I read 10.1MPa in RSA for the exact same load case.
I'm kind of afraid cause on one run, I even saw the 24.36Mpa displayed in robot and when I rebooted RSA, it was back at 10.1 MPa.
Unfortunately, the model file had an error and I couldn't open it again to review it...
Do you have more information on why the result is wrong on the second panel ? Have you been able to replicate the bug ?
Regards.
IN case of getting results "in elements centers" you should use:
ExtParams.ElementSel = RobApp.Project.Structure.Objects.Get(i).FiniteElems
and
ExtParams.Smoothing = I_FRS_IN_ELEMENT_CENTER
Hi,
I looked a bit deeper in the problem, without changing the process for getting the results, but it's actually a bit more complicated than I expected.
My VBA code runs several iterations during wich it changes the second panel's thickness, runs the calculation and extract the stress.
I just found out that the stress I get in VBA is the stress corresponding exactly to the previous thickness :
vba_stress = robot_stress * newthick^2 / oldthick^2
I checked several different thickness and the result is still exactly the same so that can't be a coincidence.
This means that eventhough the calculation has been run with the new thickness (I made sure of that by displaying the thickness in Robot), the results fetched from VBA (regardless of the process used to get the results) still take in account the previous thickness.
I figured it could be the results were not updated yet, but the result status is "available" from VBA and even if I wait for 30 seconds and extract the stress again, it gives the same result.
Maybe there's something that doesnt update the results each time the calculation runs....
Regards.
Hi,
I thought the model was automatically generated when running a calculation.
I added this line anyway but I didn't get any further : The result I get without adding I_FRS_IN_ELEMENT_CENTER is different from the usual wrong value I get but if I use id, it's back to the "right" wrong value.
Anyway, I find odd that the model wasn't generated before because the result displayed in Robot was right (so the new thickness was taken in account somewhere).
Just to confirm, I saved the model, closed robot and reopened it, then tried to extract the results again.
The function to get the results was way faster than before closing and gave the true right value, as displayed in robot.
By the way, I tried to use Panel selection instead of Element and that runs the same without an error so that must have been something else at the time I tried before.
Regards.
Can't find what you're looking for? Ask the community or share your knowledge.