AddCurve thousand of times is extremely slow

Hi,

I am struggling with slow Rhino add methods. The redraw function is run only once at the end.

The curves are simple rectangle polylines, each call of rhino of AddCurve or AddMesh takes about 10ms.

doc.Objects.AddMesh/AddCurve per object — 2400 × ~10ms = 24s

Is there anything we can do to make it fast? Does it make more sense to write geometry to 3dm and import that ?

  • file3dm.Objects.AddCurve(curve, attr) — for polylines
  • file3dm.Objects.AddMesh(mesh, attr)
  • file3dm.Objects.AddPoint(point) — for points
  • file3dm.Objects.AddBrep(brep, attr) — for breps
  • file3dm.Objects.AddSurface(surface, attr) — for surfaces

Why rhino does not support adding collections?

on a “living” Rhinodoc from the scripteditor i get:
67.67 ms for 10000 rectangles.
but this uses Rhino.DocObjects.Tables.ObjectTable.AddPolyline
??
AddCurvesPerformance.cs (2.2 KB)

(c# ? from a plugin ?)

not sure if this helps. kind regards - tom

Hi @Petras_Vestartas,

Can you provide us run-able code?

Adding objects to the document will trigger events. So speed will depend on how you run your code and what else is listening to add object events.

Rhino does not have any commands that add thousands of curves.

– Dale