Help using Meshbuilder to create a line between two spheres

Oct 15, 2012 at 10:40 AM

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

Coordinator
Oct 16, 2012 at 2:36 PM

use a cylinder? See MeshBuilder.AddCylinder

To draw a line, try LinesVisual3D.

Oct 17, 2012 at 2:58 AM

Thanks.

Much appreciate.