(API) Get panel properties C#

(API) Get panel properties C#

eng_leandromartins
Advocate Advocate
1,118 Views
5 Replies
Message 1 of 6

(API) Get panel properties C#

eng_leandromartins
Advocate
Advocate

Hello everyone,
I've seen several posts, but I couldn't find any that explained how to get the nodes and thicknesses of the contours or floors.
I would like it to be a loop that goes through all the selected panels.
I've seen a few, but it seems like the codes don't work anymore.
Please, if someone can post an example in C#, I would appreciate it.

0 Likes
Accepted solutions (1)
1,119 Views
5 Replies
Replies (5)
Message 2 of 6

Stephane.kapetanovic
Mentor
Mentor

Hi @eng_leandromartins 

(API) Get edge nodes from contours, (API) how can I get the contour definition nodes of a selected panel?, (API) - get the coordinates of the cladding

VBA Excel macro for any object geometry modifications (API), Panel contour points modification (API)

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
EESignature
0 Likes
Message 3 of 6

eng_leandromartins
Advocate
Advocate

Hello
I created the code this way. But the point values ​​are giving an error.

 

IRobotApplication robotapp = new RobotApplication();
RobotNodeServer robotnode = robotapp.Project.Structure.Nodes;
RobotStructure structure = robotapp.Project.Structure;
RobotObjObjectServer robotObj = structure.Objects;
RobotGeoContour contourGeometry;
RobotGeoSegmentCollection segments;
RobotGeoSegment segment;

RobotSelection objSel, barSel;
barSel = robotapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_BAR);
objSel = robotapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_OBJECT);
RobotSelection nsel = structure.Selections.Create(IRobotObjectType.I_OT_NODE);


if (objSel.Count == 0)
{
barSel = robotapp.Project.Structure.Selections.CreateFull(IRobotObjectType.I_OT_BAR);
objSel = robotapp.Project.Structure.Selections.CreateFull(IRobotObjectType.I_OT_OBJECT);
}
objSel.Exclude(barSel);


List<string> panelNumber = lists.ExpandSelList(objSel.ToText());

for (int i = 0; i < panelNumber.Count; i++)
{
int objNumber = int.Parse(panelNumber[i]);
RobotObjObject Obj = (RobotObjObject)robotapp.Project.Structure.Objects.Get(objNumber);
contourGeometry = (RobotGeoContour)Obj.Main.GetGeometry();
segments = (RobotGeoSegmentCollection)contourGeometry.Segments;

for (int j = 0; j < segments.Count; j++)
{
segment = segments.Get(i);
CoordenateX = segment.P1.X;
CoordenateY = segment.P1.Y;
CoordenateZ = segment.P1.Z;

 

0 Likes
Message 4 of 6

hi @eng_leandromartins 

  • Are all your objects contours?
  • Do you need to test hosted objects as well?
  • Are all contours meshed? Do they have nodes?
  • What types of segments do you want to read coordinates from?
  • Are you sure you have all the nodes?
  • You need to convert all dynamic return types from functions; otherwise, you won't be able to access properties.

A complete program may require 1200 lines of code (excluding classes)

GetMainNodes collects all peripheral nodes, create groups by categories, is fully functional, fast and free.

Developing another program does not seem necessary, as the specific details of what the program should do are beyond the scope of using the API.

Note that an Excel file with freely modifiable macros is provided, which can serve as an example of integration for your programs.

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
EESignature
0 Likes
Message 5 of 6

eng_leandromartins
Advocate
Advocate

Sorry for the delay in responding @Stephane.kapetanovic , I was on vacation and couldn't access my Autodesk account.

I would actually like to access only this information.

eng_leandromartins_0-1738757476451.png

 

0 Likes
Message 6 of 6

Accepted solution

hi @eng_leandromartins 

You can retrieve any rounding method from a useful add-in.

Generally, segments of a contour can be accessed as follows:

Dim Obj As RobotObjObject, ContourGeometry As RobotGeoContour, Segments As RobotGeoSegmentCollection, Segment As RobotGeoSegment
If Obj.Main.GetGeometry.Type = I_GOT_CONTOUR Then
  Set ContourGeometry = Obj.Main.GetGeometry
  Set Segments = ContourGeometry.Segments
  For i = 1 To Segments.Count
    Set Segment = Segments.Get(i)
    With Segment.P1: Cells(row, 4) = .X: Cells(row, 5) = .Y: Cells(row, 6) = .Z: row = row + 1: End With
    If Segment.Type = I_GST_ARC Then
      With Segment.P2: Cells(row, 4) = .X: Cells(row, 5) = .Y: Cells(row, 6) = .Z: row = row + 1: End With
    End If
  Next i
End If

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
EESignature
0 Likes