After upgrading to PowerToys 11.0 i have a problem with "BoxVisual3d.Children"
#1
Hi,

After upgrading to PowerToys 11.0 i have a problem with "BoxVisual3d.Children".

When i use the PowerToys 9.4 version the following code draws 2 boxes.

            BoxVisual3D b = new BoxVisual3D();
            b.Size = new Size3D(1000,1000, 1000);
            b.Material = new DiffuseMaterial(new SolidColorBrush(Colors.Gold));
            b.CenterPosition = new Point3D(0, 2000, 0);

            b.Children.Add(new BoxVisual3D(){Size = new Size3D(500,500,500),CenterPosition = new Point3D(0,0,0),Material = b.Material});

            MainViewPort3D.Children.Add(b);


But with the 11.0 version the "child" BoxVisual3D is not shown anymore.
#2
I found out that this is since version: 9.5.7760 the case.
#3
Yes, there were many problems because the same Visual3D was used as a group of objects and also provides its own GeometryModel3D. Therefore this was prevented and you will need to split this into three objects (adding one to group both boxes):

Code:
//var visualGroup = new ModelVisual3D(); // Standard WPF object to group other Visual3D objects
var visualGroup = new ContentVisual3D(); // ContentVisual3D also allows to show or hide the content by setting IsVisible property
MainViewPort3D.Children.Add(visualGroup);

BoxVisual3D b = new BoxVisual3D();
b.Size = new Size3D(1000,1000, 1000);
b.Material = new DiffuseMaterial(new SolidColorBrush(Colors.Gold));
b.CenterPosition = new Point3D(0, 2000, 0);
visualGroup.Children.Add(b);

visualGroup.Children.Add(new BoxVisual3D(){Size = new Size3D(500,500,500),CenterPosition = new Point3D(0,0,0),Material = b.Material});
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)