I’m working with a display conduit where I draw multiple text objects using the DisplayPipeline.Draw3dText method. All overloads only accept a single text input which in my case results in several thousands individual calls to the display pipeline. This is slow and bogs down the main thread.
private static List<Point3d> _points;
public static void PostDrawObjects(object sender, Rhino.Display.DrawEventArgs args)
{
if (_points == null || _points.Count == 0)
return;
foreach (var point in _points)
{
var plane = new Plane(point, Vector3d.ZAxis);
args.Display.Draw3dText(point.X.ToString("0.00"), System.Drawing.Color.Black, plane, 12, "Arial", false, false);
}
}
And here it is wrapped in a GH file. text.gh (7.8 KB)
To keep things simple, I put this logic to the DrawViewportWires override, but in my Rhino plugin the above code resides in DisplayPipeline.PostDrawObjects
it would be awesome if these could be cached, but also if we could pass these as an IEnumerable to avoid multiple calls to the display pipeline. In my application these text objects change quite often hence cache would be invalidated anyway.
Ideally, you’d give us access to the underlying buffer and an option to replace individual text objects.
EDIT: @dale, the link you included in the issue pointing back to this discussion thread is broken. Could you please fix it so that @stevebaer, who is assigned to this issue can find it? Thanks!