Programatically import TubeVisual3D into Viewport

Jan 18, 2013 at 8:05 AM
Edited Jan 18, 2013 at 8:16 AM

Hi. I've meen trying to dive into Helix Toolkit lately and it seems quite nice. But I realized, that I'm not able to programatically import TubeVisual3D into Viewport even though if I try to import some another Visual3D member (i.e. BillboardTextVisual3D), I have no problem with importing it.

Sample code should look like this:


 TubeVisual3D tube = new TubeVisual3D();
            tube.Path = new Point3DCollection();
            tube.Path.Add(new Point3D(2, 3, 5));
            tube.Path.Add(new Point3D(1, 4, -5));
            tube.Path.Add(new Point3D(1,2,1));
            tube.Diameter = 15;
            tube.ThetaDiv = 15;
            tube.Fill = Brushes.Navy;
            tube.IsPathClosed = true;
            //this adding into children does not work

            BillboardTextVisual3D bt = new BillboardTextVisual3D();
            bt.Text = "RndText";
            Height = 80;
            Width = 250;
            //this adding into children works

 What's wrong with my approach?

edit: solved :)

It's impossible to crete tube points this way.

Jan 18, 2013 at 1:06 PM

try to add the points in a Point3DCollection before setting the tube.Path property. Also, set the tube.Path property after all the other properties (for performance reasons).