0

Programatically import TubeVisual3D into Viewport

Anonymous 10 years ago 0
This discussion was imported from CodePlex

iLovePasta wrote at 2013-01-18 08:05:

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
            MainViewPort.Children.Add(tube);

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

 What's wrong with my approach?

edit: solved :)

It's impossible to crete tube points this way.


objo wrote at 2013-01-18 13:06:

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).