Discussion Groups

Robot Structural Analysis

Reply
Product Support
Artur.Kosakowski
Posts: 5,050
Registered: ‎12-17-2010

Re: CreateOnFiniteElems crashes every time

10-24-2011 07:15 AM in reply to: ethor

Could you check if you can create a panel using the Panel dialog after selecting the same list of surface elements as the one you provided for your API code please? Have you managed to check your API code on v.2012?



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

Re: CreateOnFiniteElems crashes every time

10-24-2011 08:54 AM in reply to: Artur.Kosakowski

no i have not been able to check it on the 2012 api, since what i am doing may require older versions of robot. I need to have an unquestionably stable approach. Yes when creating a panel using the interface it works every time.

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

Re: CreateOnFiniteElems crashes every time

11-07-2011 10:34 PM in reply to: Artur.Kosakowski

Hello,

I am still not able to solve my previous problem. There seems to be no unconditionally stable and accurate method for creating shells from the api, at least not in the 2011 x86 version. So I have had some time over the last couple of days to go back and try again with the command CreateOnFiniteElems. I use the following code for testing.

 

            RobotApplication robApp;
            robApp = new RobotApplication();
            robApp.Visible = 1;
            
             robApp.Project.New(IRobotProjectType.I_PT_SHELL);

             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);
               
                 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();
  
            RobotSelection allFE = robApp.Project.Structure.Selections.CreateFull(IRobotObjectType.I_OT_FINITE_ELEMENT);

            RobotNumbersCollection col;

                try
                {
                   col = robApp.Project.Structure.Objects.CreateOnFiniteElems(allFE.ToText(), 1);
                }
                catch (System.Runtime.InteropServices.COMException e)
                {
                    MessageBox.Show(e.Message.ToString());
                }

 

The funny thing about this is that i can run it and it will work 10 times in a row and then on the 11th time it will crash. Additionally, every time that it is run I catch the exception "HRESULT E_FAIL has been returned from the com component" regardless of if the program then crashes or not. If i replace "allFE.ToText()" with "allFE.ToString()" the program will not catch an error, but it will also not create a panel, in this case nothing happens....

 

I am looking for a solution for this problem that will work with all versions of Robot. Are you planning on releasing a service pack or something along those lines to fix this for older versions of Robot, or will all improvements be exclusive to future releases? I have tried creating finite elements using the api and i have tried using a text file, neither of them seem to allow me to create panels, nor do the results from the finite elements appear to be accurate. Any help or advice on getting a stable method working with all versions of Robot would be greatly appreciated. Any Ideas??

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

Re: CreateOnFiniteElems crashes every time

11-08-2011 12:24 AM in reply to: ethor

The changes and improvements in the API are done for the current (last released) and next versions of Robot.



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

Re: CreateOnFiniteElems crashes every time

11-08-2011 09:17 AM in reply to: Artur.Kosakowski

well i finally have tested with the 2012 version and everything seems to work in that version but that leaves all of the previous version users behind...

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

Re: CreateOnFiniteElems crashes every time

11-08-2011 11:40 PM in reply to: ethor

I'm very pleased that you finally decided to test the current version of Robot. Of course it would be great to update all older versions of Robot with all the changes and improvements done for the new ones but in the real world this is obviously for many reasons not possible.

 

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.
New Member
RP101
Posts: 1
Registered: ‎12-22-2012

Re: CreateOnFiniteElems crashes every time

12-22-2012 09:09 AM in reply to: Artur.Kosakowski

Hi,

 

I have created a series of finite element meshes, however want to convert them to a single panel/contour, as I am able to do through the GUI by selecting the surface objects as an FE list. Is this possible to do via the API? I then want to assign material properties to the panel.

 

I have printed below, what I have got so far, however this only creates single panel elements for individual FE objects. Your help is much appreciated!

 

Dim FEServer As IRobotFiniteElementServer
Dim MyArr As RobotNumbersArray

 

FEServer.Create(FENum, MyArr, False)
FEServer.Update

 

Dim AllFE As RobotSelection
Dim SelType As IRobotObjectType
SelType = IRobotObjectType.I_OT_FINITE_ELEMENT
AllFE = MyRobot.Selections.CreateFull(SelType)

Dim Collection As RobotNumbersCollection
Collection = MyRobot.Objects.CreateOnFiniteElems(AllFE.ToText(), 1)

Please use plain text.
Product Support
Rafal.Gaweda
Posts: 5,471
Registered: ‎04-26-2010

Re: CreateOnFiniteElems crashes every time

12-23-2012 11:22 PM in reply to: RP101
Hi

 

I have created a series of finite element meshes, however want to convert them to a single panel/contour,........

 

I have printed below, what I have got so far, however this only creates single panel elements for individual FE objects. Your help is much appreciated!

 

As far as I understood: you wanted you created so where the problem is?

 



Rafal Gaweda
Please use plain text.
Product Support
Rafal.Gaweda
Posts: 5,471
Registered: ‎04-26-2010

Re: CreateOnFiniteElems crashes every time

12-27-2012 02:48 AM in reply to: Rafal.Gaweda

Example code:

 

    Dim RobApp As RobotApplication    
Set RobApp = New RobotApplication
Dim RSelection As RobotSelection Set RSelection = RobApp.Project.Structure.Selections.CreateFull(I_OT_FINITE_ELEMENT) Dim FECol As RobotFiniteElementCollection Dim Collection As RobotNumbersCollection Set FECol = RobApp.Project.Structure.FiniteElems.GetMany(RSelection) Dim OD As RobotObjObject Dim PT As String Dim RT As String Dim CM As String For i = 1 To FECol.Count Set OD = RobApp.Project.Structure.Objects.Get(FECol.Get(i).ObjectNumber) PT = OD.GetLabelName(I_LT_PANEL_THICKNESS) RT = OD.GetLabelName(I_LT_PANEL_REINFORCEMENT) CM = OD.GetLabelName(I_LT_PANEL_CALC_MODEL) Set Collection = RobApp.Project.Structure.Objects.CreateOnFiniteElems(Str(FECol.Get(i).Number), 100000 + i) RobApp.Project.Structure.Objects.Get(Collection.Get(1)).SetLabel I_LT_PANEL_THICKNESS, PT RobApp.Project.Structure.Objects.Get(Collection.Get(1)).SetLabel I_LT_PANEL_REINFORCEMENT, RT RobApp.Project.Structure.Objects.Get(Collection.Get(1)).SetLabel I_LT_PANEL_CALC_MODEL, CM Next i

 



Rafal Gaweda
Please use plain text.