Rabeeh Abla

Software Architect @ GlobalVision

SilverLight 2.0 Mesh Viewer

Demo: view

Click to download source code download

Mesh Library download

Windows Sample download

Mesh

SilverLight specification and use of XAML, drives one to inspect this platform. The use of standards is what enables manageable integration, and improves software maintenance. Having such platform integrated in .Net framework and available for developers, encourages one to experiment a little by using it.

Mesh viewers are common in CAD, and there are many available tools and libraries to develop and view complex mesh nets. In short a mesh is a net of connected faces, and a face is a set of vertices.

design

I created a humble very basic .Net Mesh Library that is free for anyone interested in improving and using it. This library can be used in .Net application, all that changes is the way of connecting two points i.e. drawing a line.

In windows application you can draw a line by using the Graphics object method DrawLine, in SilverLight you draw a line by creating a Line object and adding it to the main Canvas.

void engine_OnDrawLine(MeshSilverlightLibrary.Common.Point start, MeshSilverlightLibrary.Common.Point end)
{
    Line l = new Line();

    l.X1 = (float.IsNaN(start.X) ? 0 : start.X);
    l.Y1 = (float.IsNaN(start.Y) ? 0 : start.Y);

    l.X2 = (float.IsNaN(end.X) ? 0 : end.X);
    l.Y2 = (float.IsNaN(end.Y) ? 0 : end.Y);

    l.Stroke = new SolidColorBrush(Colors.Blue);
    l.StrokeThickness = 1;

    LayoutRoot.Children.Add(l);
}
 

Regards

Rabeeh Abla

Comments

Joseph Ghassan AKA Mighty said:

Thanks for sharing this with us. I think many will find it usefull to start building their meshes using Silverlight.

With Silverlight the Web is now a better place to unleash spectacular projects.

Hell, even Flash is now suffering slow death due to silverlight supremacy.

# April 22, 2008 9:31 AM

rabeehabla said:

It is a good library for developers working in CAD domain

# May 5, 2008 9:26 AM

Community Blogs said:

Martin Mihaylov continues with DataGrid, Rabeeh Abla with a Mesh Viewer, Gerard Leblanc on animations

# September 16, 2008 5:50 PM

unruledboy said:

resizing may cause more and more meshes on the screen.

# September 17, 2008 4:09 AM

Silverlight news for September 17, 2008 said:

Pingback from  Silverlight news for September 17, 2008

# September 17, 2008 10:43 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)