technodesigner

Digital design

Olivier Dewit
Perspective : 3D printing for WPF

Perspective : 3D printing for WPF

3D printing is a burgeoning technology that produces real objects from 3D models.

These 3D models are usually done manually using a CAD software. The communication between the computer and the 3D printer is usually done by file, the STL (STereoLithography) format being the most common.

WPF allows you to make 3D models. Perspective is a library that facilitates 3D development with WPF. The impression of 3D models from WPF and Perspective has an advantage compared to manual operation of CAD software: programming enables building dynamic models.

So I expanded the Perspective library with an export functionality of 3D models in STL file. 3D printing tests were conducted during july 2013 at Cambridge (England), with the help of the makespace community.

Implementation

The implementation is very simple. The definition of the model to be printed is done by means of a Perspective class, here House3D. The model to be printed must be identified by an x:Name attribute.

...
<p:House3D x:Name="house" Material="{StaticResource GlossyRedMaterial}"/>
...

House3D Perspective model

The color and material of the WPF model are not supported by the 3D printer used here (MakerBot Replicator 2X).

STL file generation is done using the Perspective encoder StlEncoder. The ModelName property determines the name and header data of the STL file. The Sculptor property receives a Sculptor object that contains all the features of points and triangles of a model.

var element = FindName("house") as GeometryElement3D;
var encoder = new StlEncoder();
encoder.ModelName = "House";
encoder.Sculptor = element.Sculptor;

Source code of the example is available in the project PerspectiveDemo.Wpf3D-dn4.0, page HouseDemo.xaml

A transformation is applied to the Perspective model to match the coordinate system of the 3D printer. The Perspective models are generally sized as 1 unit. In the coordinate system of the MakerBot Replicator 2X, 1 unit is either 1 mm or 1 inch (25.4 mm). So a scaling factor of 10 is useful for the Perspective model that otherwise would measure 1 mm ... Similarly, a rotation around the X axis is required. The PointsTransform property of the encoder allows apply at different points a composite transformation, calculated here by using 3D matrices :

Matrix3D mXRotation = Helper3D.GetXRotationMatrix(90.0);
Matrix3D mScaling = Helper3D.GetScaleMatrix(10.0);
MatrixTransform3D transform = new MatrixTransform3D(mXRotation * mScaling);
encoder.PointsTransform = transform;

The Save method of the encoder creates the STL file.

encoder.Save();

The STL file is generated in the directory of the executable, and copied to an SD card for transmission to the 3D printer.

In our context, printing takes about 1 hour for a model size 2x3 cm, and quarter of an hour for a model size 1x1 cm.

End of printing

Here are some examples of real objects obtained by printing a 3D Perspective model:

Real objects obtained

Thanks !

Thanks the makespace community for its help, especially Kim Spence-Jones, Nicholas Johnson and the Brice family ;)



Powered by the Perspective WebApp - © Olivier Dewit - Lyon, Paris, France - Legal informations