0

Multiple Plane Grid lines ??

Anonymous 10 years ago 0
This discussion was imported from CodePlex

ManyMiles wrote at 2012-05-21 18:26:

I am very new at the Helix 3D Toolkit, and I'm excited to learn more about it.

I would like to have multiple sets of gridlines. Currently I'm just trying to get 2 sets to show, but it seems like it will only register one.  I'm trying with 1 grid in the X-Y Plane and 1 in the X-Z plane.  Is it possible to include multiple GridLinesVisual3D elements in the view?  What is an easy way to do it?  

Currently I have this declared in the MainWindow method ...

var model = new ModelVisual3D();
model.Children.Add(new GridLinesVisual3D() { Center = new Point3D(-0.5, -0.5, -0.5), Normal = new Vector3D(1, 0, 1), Width = 20, Length = 20, MinorDistance = 1, MajorDistance = 10, Thickness = 0.04, Fill = Brushes.Green });
model.Children.Add(new GridLinesVisual3D() { Center = new Point3D(-0.5, -0.5, -0.5), Width = 20, Length = 20, MinorDistance = 1, MajorDistance = 10, Thickness = 0.04, Fill = Brushes.Red });
view1.Children.Add(model);

But it seems to only show the second Grid.  Thanks for your help.


objo wrote at 2012-05-26 08:55:

Try to set LengthDirection = new Vector3D(0,1,0) on your first set of grid lines.

The 'WidthDirection' is calculated as the cross product of Normal and LengthDirection. In your code you end up with the same length and width directions in both cases.

See the GridLinesVisual3D.Tessellate method how it works.


ManyMiles wrote at 2012-05-29 01:39:

Thanks very much.  Setting the Normal and LengthDirection attributes got exactly the desired result I needed.