(API) FEM Results via query mechanism

a54249
Enthusiast
Enthusiast

(API) FEM Results via query mechanism

a54249
Enthusiast
Enthusiast

Hello,

 

After creating a series of panels in RSA I was trying to get the membrane forces of each node (after running the calculation)  using an algorithm in VB. I have seen some topics in this forum about using the query mechanism (and others) but it's only for bars, and I'm having some trouble changing it to panels.

And another question, is possible to get the coordinates of the nodes at the same time?

Can anyone help?


Thanks in advance

0 Likes
Reply
Accepted solutions (1)
1,639 Views
4 Replies
Replies (4)

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Some classes in this code snippets may not exist in Robot but it will give you idea how to do it

 

        protected RobotResultQueryParams CreateQueryParamsForSurfacesValues(List<SdxData.EPhysical> results, bool forAbsoluteMaximum)
        {
            RobotResultQueryParams queryParams = (RobotResultQueryParams)this.RobotKernel.CmpntFactory.Create(IRobotComponentType.I_CT_RESULT_QUERY_PARAMS);
            queryParams.ResultIds.SetSize(results.Count);
            for (int i = 0; i < results.Count; i++)
            {
                int id = (int)results[i];
                queryParams.ResultIds.Set(i + 1, id);
            }

            queryParams.Selection.Set(IRobotObjectType.I_OT_CASE, this.CreateSelectionLoadCase());

            queryParams.SetParam(IRobotResultParamType.I_RPT_MULTI_THREADS, true);
            queryParams.SetParam(IRobotResultParamType.I_RPT_THREAD_COUNT, 4);
            queryParams.SetParam(IRobotResultParamType.I_RPT_SMOOTHING, IRobotFeResultSmoothing.I_FRS_SMOOTHING_WITHIN_A_PANEL);
            queryParams.SetParam(IRobotResultParamType.I_RPT_LAYER, forAbsoluteMaximum ? 6 : (int)IRobotFeLayerType.I_FLT_MIDDLE);
            queryParams.SetParam(IRobotResultParamType.I_RPT_DIR_X_DEFTYPE, IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN);
            queryParams.SetParam(IRobotResultParamType.I_RPT_DIR_X, new double[] { 0, 0, 0 });

            return queryParams;
        }

        protected RobotSelection CreateSelectionLoadCase()
        {
            RobotSelection selector = this.RobotKernel.Structure.Selections.Create(IRobotObjectType.I_OT_CASE);
            foreach (string id in this.Header.LoadCaseNotEmptyIndices)
            {
                selector.AddText(id);
            }

            return selector;
        }



Getting results:


                RobotResultQueryParams queryParams = this.CreateQueryParamsForSurfacesValues(results, forAbsoluteMaximum);
                RobotResultRowSet rowSet = new RobotResultRowSet();
                IRobotResultQueryReturnType ret = IRobotResultQueryReturnType.I_RQRT_MORE_AVAILABLE;
                bool anythingCalculated = false;
                while (ret != IRobotResultQueryReturnType.I_RQRT_DONE)
                {
                    ret = this.RobotKernel.Structure.Results.Query(queryParams, rowSet);
                    bool isOk = anythingCalculated = rowSet.MoveFirst();

                    while (isOk)
                    {
                        RobotResultRow row = rowSet.CurrentRow;

   int nodeId = (int)row.GetParam(IRobotResultParamType.I_RPT_NODE);
                        int panelId = (int)row.GetParam(IRobotResultParamType.I_RPT_PANEL);

                            string idCase = ((int)row.GetParam(KernelOM.IRobotResultParamType.I_RPT_LOAD_CASE)).ToString();
                            foreach (SdxData.EPhysical item in results)
                            {
                                int id = (int)item;
                                if (row.IsAvailable(id))
                                {
double value = (double)row.GetValue(id);
                                }
                                else
                                {
                                    throw new Exception(string.Format(Properties.Resources.Error_ReadingElemNode, panelId, nodeId));
                                }
                            }
                        }

                        isOk = rowSet.MoveNext();
                    }
                }

 



Rafal Gaweda

a54249
Enthusiast
Enthusiast
Thanks Rafal!
0 Likes

smikaric
Enthusiast
Enthusiast

Can you tell me what is the content of variable resultes?

I am missing id number and how can find list of thoes values? 

 

  queryParams.ResultIds.SetSize(results.Count);
            for (int i = 0; i < results.Count; i++)
            {
                int id = (int)results[i];
                queryParams.ResultIds.Set(i + 1, id);
            }

 

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @smikaric

 

Please check Private Message



Rafal Gaweda
0 Likes