API create a panel - C#

API create a panel - C#

Anonymous
Not applicable
2,027 Views
10 Replies
Message 1 of 11

API create a panel - C#

Anonymous
Not applicable

Hello everyone,

 

I am still struggling a bit with API, in particular with panels. I managed to create finite elements, but it seems like I can't select them and create an object/panel as reported in the tutorial below.

 

image.png

 

Can anyone advise on this? Also, is it possible to select only a few finite elements and create a panel for those only? Let's say I want finite elements 1 to 5 to be in a panel and then finite elements 6 to 12 to be in a different one. How do we do this?

 

As stated in the title, I am trying to do this in C#.

 

Many thanks for the help.

 

 

0 Likes
2,028 Views
10 Replies
Replies (10)
Message 2 of 11

marcinrakus
Autodesk
Autodesk

Hi,

 

Does this make effect You want? :

 

      RobotApplication r = new RobotApplication();
      r.Project.Structure.Objects.CreateOnFiniteElems("1To5", 100);
      r.Project.Structure.Objects.CreateOnFiniteElems("6To12", 200);

No need to create selection - CreateOnFiniteElements method takes string as argument. If You have other version of RSA than English don't use 'To" but something language dependent. It is even safer to type "1 2 3 4 5".

 

100 or 200 is a chosen starting number for new panels.

 

Regards,

Marcin

Message 3 of 11

Anonymous
Not applicable

Hi Marcin,

 

Thank you for the prompt response.

 

Those lines of code work, but they don't do exactly what I want. This way I manage to create a panel for each finite element, but what I would like to do is create a panel for more finite elements, i.e. panel 100 will be created out of finite elements 1To5 and panel 200 out of finite elements 6To12, so that in the end I will have 2 panels and 12 finite elements. I hope now it is clearer.

 

Regards,

 

0 Likes
Message 4 of 11

marcinrakus
Autodesk
Autodesk

I get this with my code (I made it on basis of existing panel mesh, so it may be a little confusing):

 

Fes.PNG

 

Maybe Your finite elements are not connected to each other or they are not in the same plane (I'm not sure if this is a requirement, but worth checking).

 

In my case when I write as a list of finite elements e.g. "19 32" I will get indeed two separate one-element panels, but "1To5" gives me first (100) and "6to12" second (200) panel.

 

Marcin

0 Likes
Message 5 of 11

Anonymous
Not applicable

Below is what I get instead.

 

Since we have to deal with a quite complex geometry, in my script I import the coordinate of the nodes first, then I create the triangular finite elements for each hexagon/pentagon and then I would like to have a different panel for each polygon.

 

I am sure that the finite elements of each polygon are connected because of the way I define them - I know there are overlapping nodes, but the plan is to remove them afterwards. Also, the geometry has been checked in grasshopper and each polygon is planar. For some reasons a different panel is created regardless of the string I give to the method CreateOnFiniteElements.

 

image.png

 

0 Likes
Message 6 of 11

Artur.Kosakowski
Autodesk Support
Autodesk Support

Hi @Anonymous

 

IMHO they are defined by different nodes and therefore not detected as 'connected'. In other words you shouldn't have overlapped nodes but a single one in each of these locations:

 

overlapping nodes.PNG

 

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
0 Likes
Message 7 of 11

Anonymous
Not applicable

Hi Artur,

 

Even if I try to bake only one panel with no overlapped nodes I can't get a single panel.

 

Let's try to change approach maybe, since I have the coordinates of the nodes I can create a contour and then maybe create a panel using the contour? I had tried that too, but I got an error saying that it cannot convert boolean to int when I use the Main.Attribs.Meshed call. Maybe I am using it in the wrong way?

 

image.png

 

RobotObjObject obj = RobotApp.Project.Structure.Objects.Get(i + 1) as RobotObjObject;
      obj.Main.Attribs.Meshed = true;
      obj.Update();
0 Likes
Message 8 of 11

marcinrakus
Autodesk
Autodesk

Can You attach this rtd file You are trying to work on? I could play with my code on Your example.

0 Likes
Message 9 of 11

Anonymous
Not applicable

Attached

0 Likes
Message 10 of 11

marcinrakus
Autodesk
Autodesk

Unfortunately CreateOnFiniteElements method works only for finite elements lying on the same plane (with a little epsilon). On the one hand it is inconvenient, but on the other, You would probably have problems analyzing non-planar panel.

 

I would suggest staying with panels made on triangles.

 

Regards,

Marcin

0 Likes
Message 11 of 11

Anonymous
Not applicable

Hi Marcin,

 

Thanks for the time you have spent on it. I know the nodes don't seem to be planar at first glance, but I think they are. I have checked them in Grasshopper and they result to be planar and if you manually create a contour then Robot allows you to create a panel in it.

 

Unfortunately in this case sticking to triangular panels is not really a viable solution as I will end up with 10000 panels which are very complicated to deal with. That's why I thought one solution would be to create the contours and then the panels, but as I wrote a few posts above I am struggling with that part of code. Can anyone help with that?

 

Thanks.

0 Likes