Discussion Groups

Robot Structural Analysis

Reply
Contributor
ethor
Posts: 19
Registered: ‎10-13-2011

CreateOnFiniteElems crashes every time (API)

469 Views, 18 Replies
10-17-2011 12:40 PM

I am using c# and i have basically replicated the exact code from the tutorial "Define the model with finite elements" and translated it into c# however when the code reaches the line:

IRobotNumbersCollection col = robApp.Project.Structure.Objects.CreateOnFiniteElems("1to20", 1);

 

it will crash robot, if i use

 

IRobotNumbersCollection col = robApp.Project.Structure.Objects.CreateOnFiniteElems(allFE.ToString(), 1);

 

it seems that it simply skips the line.

 

Below is the entire code, it is very short, basically just what was given in the tutorial. Any ideas as to why it is crashing would help me immensely.

 

 RobotApplication robApp;
robApp = new RobotApplication();

robApp.Visible =1;

robApp.Project.New(IRobotProjectType.I_PT_SHELL);
RobotProjectPreferences ProjectPrefs;

ProjectPrefs = robApp.Project.Preferences;
ProjectPrefs.SetActiveCode(IRobotCodeType.I_CT_RC_THEORETICAL_REINF, "BAEL 91");

IRobotStructure str;
str = robApp.Project.Structure;

IRobotNodeServer nod = robApp.Project.Structure.Nodes;

double k = 0;
for(int i  = 0;i<8;i++){

nod.Create (1 + i * 10, 0, 0, 0+k) ;
nod.Create (2 + i * 10, 0.5, 0,0+k) ;
nod.Create (3 + i * 10, 1, 0, 0+k) ;
nod.Create (4 + i * 10, 1.5, 0, 0+k) ;
nod.Create (5 + i * 10, 2, 0, 0+k) ;
//nod.Create (6 + i * 10, 2.5, 0, 0+k) ;
k = k + 0.5;
}

IRobotFiniteElementServer fe_serv = robApp.Project.Structure.FiniteElems;

RobotNumbersArray[] arr = new RobotNumbersArray[4];

    for(int i  = 0;i<7;i++){
        for(int j = 0;j<4;j++){
            arr[j]= new RobotNumbersArray();
            arr[j].SetSize(4);
            arr[j].Set(1, 1 + j + 10 * i);
            arr[j].Set(2, 2 + j + 10 * i);
            arr[j].Set(3, 12 + j + 10 * i);
            arr[j].Set(4, 11 + j + 10 * i);
 
            fe_serv.Create( 1 + 10 * j + i, arr[j], false);
        }
    }

fe_serv.Update();

IRobotSelection allFE = robApp.Project.Structure.Selections.CreateFull(IRobotObjectType.I_OT_FINITE_ELEMENT);

IRobotNumbersCollection col = robApp.Project.Structure.Objects.CreateOnFiniteElems("1to20", 1);//Crashes here

//IRobotNumbersCollection col = robApp.Project.Structure.Objects.CreateOnFiniteElems( allFE.ToString(), 1);//or here

Thank you.

 

 

Please use plain text.
Product Support
Artur.Kosakowski
Posts: 4,709
Registered: ‎12-17-2010

Re: CreateOnFiniteElems crashes every time

10-18-2011 02:14 AM in reply to: ethor

I can't see any problem with this code and it runs correctly during our tests. What is the exact version of Robot you use and what is the system on your machine?



Artur Kosakowski
Please use plain text.
Contributor
ethor
Posts: 19
Registered: ‎10-13-2011

Re: CreateOnFiniteElems crashes every time

10-18-2011 06:18 AM in reply to: Artur.Kosakowski

i am running robot2011(x86) on win 7 64. So you are saying that the code posted above is working for you?

Please use plain text.
Contributor
ethor
Posts: 19
Registered: ‎10-13-2011

Re: CreateOnFiniteElems crashes every time

10-18-2011 09:11 AM in reply to: Artur.Kosakowski

Ok i have realized my problem, but i don't know if there is a solution. It is not  a problem of the version but a problem of ordering. Is it necessary to load all of the elements that one wishes to create a plate from into CreateOnFiniteElems in order? I am generating my own meshes and i do not know the order of the elements, is there a way to have the element server order them for you, similar to the way it does in the interface?

Please use plain text.
Product Support
Artur.Kosakowski
Posts: 4,709
Registered: ‎12-17-2010

Re: CreateOnFiniteElems crashes every time

10-19-2011 01:42 AM in reply to: ethor

I think that in fact this issue is linked with the v.2011 version of Robot  you are using which apparently has got some limitation in handling this code. The test we made on the v.2012 version show that there is no problem with running it.

 

If you find your post answered press the Accept as Solution button please. This will help other users to find solutions much faster. Thank you.

 



Artur Kosakowski
Please use plain text.
Contributor
ethor
Posts: 19
Registered: ‎10-13-2011

Re: CreateOnFiniteElems crashes every time

10-19-2011 08:09 AM in reply to: Artur.Kosakowski

I was able to get the code i had previously posted to run by adding a try catch procedure around the "CreateOnFiniteElems" call as follows:

   try
           {
              IRobotNumbersCollection col = robApp.Project.Structure.Objects.CreateOnFiniteElems(allFE.ToText(), 1);
           }
            catch (System.Runtime.InteropServices.COMException)
           {

           }

but if i enter the elemetns in the wrong order it will  still crash, for example:

            List<RobotNumbersArray> fullarr = new List<RobotNumbersArray>();
            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    RobotNumbersArray arr = new RobotNumbersArray();
                    arr.SetSize(4);
                    arr.Set(1, 1 + j + 10 * i);
                    arr.Set(2, 2 + j + 10 * i);
                    arr.Set(3, 12 + j + 10 * i);
                    arr.Set(4, 11 + j + 10 * i);
                    fullarr.Add(arr);
                }
            }

//reordering elements//
            RobotNumbersArray arrt = fullarr[3];
            fullarr[3] = fullarr[5];
            fullarr[5] = arrt;
            arrt = fullarr[10];
            fullarr[10] = fullarr[12];
            fullarr[12] = arrt;
            for (int i = 0; i < fullarr.Count; i++)
            {
                fe_serv.Create(i + 1, fullarr[i], false);
            }

 

Any Ideas?

Please use plain text.
Product Support
Artur.Kosakowski
Posts: 4,709
Registered: ‎12-17-2010

Re: CreateOnFiniteElems crashes every time

10-20-2011 12:38 AM in reply to: ethor

Would it be possible for you to install the 30 day trial version of Robot 2012 and check on the same example please?

 

http://usa.autodesk.com/adsk/servlet/oc/offer/form?siteID=123112&id=13387025

 

 



Artur Kosakowski
Please use plain text.
Contributor
ethor
Posts: 19
Registered: ‎10-13-2011

Re: CreateOnFiniteElems crashes every time

10-20-2011 09:15 AM in reply to: ethor

I tried to download and install the 2012 release but for some reason the only component that doesn't install is the SDK after 2 attempts i have given up on the 2012 version. So in the end i am not able to consolidate the imported elements to a panel object. But i assume that using finite elements as they are without consolidating them would yield the same results? When further researching this possibility i have found that this is not true. I have attached a modified version of "Plate.str" which comes with robot as an example file. When i solve the problem as it is imported i get different results than if i create a plate object from the elements. What is happening here? Is it necessary to have plate objects rather than simply running the analysis on a set of quad/tri elements with assigned properties?

Please use plain text.
Product Support
Artur.Kosakowski
Posts: 4,709
Registered: ‎12-17-2010

Re: CreateOnFiniteElems crashes every time

10-21-2011 12:07 AM in reply to: ethor

The str format in not the native one for ARSA(P) and it doesn't have syntax  for all attributes and objects that are currently used. It is the format that originates from its older DOS predecessor named Robot V6. The main difference is that in the DOS program the attributes were directly assigned to surface elements directly (panels as objects did not exist) whereas now they are applied to panels instead. It is the model generation which 'transfers' this data (loads, thickness, material etc.) from a panel to surface elements created within this panel.

 

For installation of SDK on 64-bit systems see http://forums.autodesk.com/t5/Autodesk-Robot-Structural/About-the-SDK-application-for-Optimization-u...



Artur Kosakowski
Please use plain text.
Contributor
ethor
Posts: 19
Registered: ‎10-13-2011

Re: CreateOnFiniteElems crashes every time

10-24-2011 12:13 AM in reply to: Artur.Kosakowski

I understand that there is not nearly as much functionality in the .str format. But for the time being it seems that the only option for me is to continue using the str format since it is the only format in which i can import my own fea mesh and assign properties to the elements. I have tried many things over the last week trying to get my meshes into robot and run accurate tests on them. One problem i found was when importing meshes with the api was that dead loads would not recognize the physical properties of mesh elements if they were not consolidated into panels, but when importing a str file the elements would be recognized. Another strange bit of behavior is when importing a mesh using the api and then running a analysis on it(without consolidating it into a panel) with no load cases defined a deadload case would automatically appear but would only run once, after that it would recognize the elements as having 0 mass. When running the CreateOnFiniteElems command in c++ it will work intermittently, sometimes 10 times in a row before crashing, leading me to believe that there is a memory leak somewhere. Please continue to support the .str format just as a precaution, i very much appreciate its simplicity and portability.

Please use plain text.