Removing ScreenSpaceLines3D from Viewport3D

Topics: Developer Forum
Jan 15, 2008 at 10:59 AM
Hello!
I'm would like to remove ScreenSpaceLines3D from its parent viewport in order to replace it (or just simply remove, for that matter).
But I can't seem to do that: whenever I try to use viewport.Children.Clear() or Remove() I get a NullReferenceException.

Here is the basic structure of my code: first I create ScreenSpaceLines3D lines and initialize them, then I do this.viewport.Children.Add(lines). That's it.
The only workaround I've found is casting Childreni to (ScreenSpaceLines3D) and then using Points.Clear().
Am I doing something wrong? I can provide the stack trace if necessary.

Thank you!
Dec 3, 2013 at 2:28 PM
Same Thing here. And no Solution after almost 6 Years! What's wrong?
May 17, 2015 at 4:30 PM
Remove ScreenSpaceLines3D :
            foreach (ScreenSpaceLines3D line3D in lines3DList)
            {
                lines3D.Points.Clear(); // Very importante
                _viewport3D.Children.Remove(lines3D);
             }