Hi all,
I’m having a bit of trouble trying to figure out the display conduit. I’ve seen some examples where you built a class that inherits from the GetPoint class but I’m after something different.
I’d like to create moving virtual geometry which is visual in the viewport without actually adding it to the document. In the example code below I just start by making 8 points and when I try to move those points it doesn’t update the display conduit in the viewport. What am I missing here?
BoundingBox bb = new BoundingBox(new Point3d(0, 0, 0), new Point3d(50, 50, 50));
var pts = new Rhino.Collections.RhinoList<Point3d>();
foreach (var pt in bb.GetCorners())
pts.Add(pt);
m_conduit = new PrevCirclesConduit();
m_conduit._pointlist = pts;
m_conduit.Enabled = true;
for (var i = 0; i < 10; i++)
{
var vec = new Vector3d(10, 20, 1);
var xform = Transform.Translation(vec);
foreach (var x in pts)
{
x.Transform(xform);
}
m_conduit._pointlist = pts;
Sleep.Time(200);
}
class PrevCirclesConduit : DisplayConduit
{
public RhinoList<Point3d> _pointlist { get; set; }
protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
{
base.CalculateBoundingBox(e);
}
protected override void PreDrawObjects(DrawEventArgs e)
{
base.PreDrawObjects(e);
for (var i = 0; i < _pointlist.Count;i++)
{
var pt = _pointlist[i];
var circle = new Circle(pt, 22.0);
e.Display.DrawCircle(circle, System.Drawing.Color.Red);
}
}
}