(API) Get panel properties C#

(API) Get panel properties C#

eng_leandromartins
Enthusiast Enthusiast
430 Views
5 Replies
Message 1 of 6

(API) Get panel properties C#

eng_leandromartins
Enthusiast
Enthusiast

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)
431 Views
5 Replies
Replies (5)
Message 3 of 6

eng_leandromartins
Enthusiast
Enthusiast

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 accept the solution and leave a < like !
EESignature
0 Likes
Message 5 of 6

eng_leandromartins
Enthusiast
Enthusiast

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
Dim 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)
    Cells(row, 4) = Segment.p1.X: Cells(row, 5) = Segment.p1.Y: Cells(row, 6) = Segment.p1.Z
    If Segment.Type = I_GST_ARC Then
      row = row + 1
      Cells(row, 4) = Segment.p2.X: Cells(row, 5) = Segment.p2.Y: Cells(row, 6) = Segment.p2.Z
     End If
    row = row + 1
  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 accept the solution and leave a < like !
EESignature
0 Likes