0

Help using Meshbuilder to create a line between two spheres

Anonymous 5 years ago 0
This discussion was imported from CodePlex

pyrrhicpk1 wrote at 2012-10-15 11:40:

Hi,

I am using the following code to draw a sphere in HelixViewport3D. Now I want to create a 3D line between two spheres. Any suggestions please.

Thanks

var meshBuilder = new MeshBuilder(false, false);
meshBuilder.AddSphere(new Point3D(0, 0, 0), 0.1f, 10, 10);
var mesh = meshBuilder.ToMesh(true);
modelGroup = new Model3DGroup();
var greenMaterial = MaterialHelper.CreateMaterial(Colors.Green);
var insideMaterial = MaterialHelper.CreateMaterial(Colors.Yellow);

            mygeometry = new GeometryModel3D();
            mygeometry.Material = greenMaterial;
            mygeometry.BackMaterial = insideMaterial;
            mygeometry.Geometry = mesh;

           modelGroup.Children.Add(mygeometry);    

           myModelVisual3D = new ModelVisual3D();
           myModelVisual3D.Content = modelGroup;

           myview.Children.Clear();
           myview.Children.Add(myModelVisual3D);


objo wrote at 2012-10-16 15:36:

use a cylinder? See MeshBuilder.AddCylinder

To draw a line, try LinesVisual3D.


pyrrhicpk1 wrote at 2012-10-17 03:58:

Thanks.

Much appreciate.