In a previous blog, we demonstrated using Polygonica for generating planar hatch and infill for AM build processors. In this blog we extend the idea to cover multi-axis additive toolpaths, useful for the growing area of robot-based additive as well as hybrid manufacturing on machine tools.

This technology demonstration also shows how you can use the MachineWorks SDK to create accurate polygonal representations of additive manufacturing toolpaths, which can be analysed within MachineWorks or passed back to Polygonica for further analysis to support downstream operations.

### 3D Curve operations in Polygonica.

In Polygonica, a **PTProfile **represents a planar polyline boundary of a 2D slice. A **PTCurve **is a 3D polycurve which can have multiple loops in 3D space, each of which can either be closed or open. Curve edges can either be lines or arcs.

An important variation of **PTCurve **is **PTImprintCurve**. This represents a curve that lies on the surface of a polygon mesh and is associated with that mesh.

Polygonica provides a range of useful operations for both **PTCurve **and **PTImprintCurves**. For the latter, each operation maintains the imprint curves connection with the surface. So for example when the curve is offset, or smoothed, it offset or smoothed on the surface.

The key functions used in the example code for this blog are:

**PFSolidPairCreateIntersectCurve**- Creates the intersection curve between two meshes

**PFCurveCreateOffsetCurve**- Offsets an imprinted curve tangentially across the surface

**PFCurveSimplify**- Reduce the data points in a curve based on a specified tolerance

**PFCurveConcatenate**- Joins curves, optionally merging loops and vertices

Other operations include:

**PFCurveSmooth**- Smooths the curve

**PFCurveExtend**- Extends the curve tangentially

**PFCurveClose**,**PFCurveFixSelfIntersections**,**PFCurveReverse**- Curve healing functions

**PV_ICURVE_LOOP_PROP_INSIDE_AREA**- Compute the area inside the curve

There is also a range of topology/access functions allowing curve loops, edges and vertices to be walked/iterated.

Finally, **PFSolidCreateFromCurves **creates a smoothly interpolated (polygonal) surface patch from a set of curves, using linear or cubic interpolation.

## Code Examples

There are three different simple examples. If you would like to try out the example code yourselves then please get in touch.

### Example 1: Non-planar slicing

This first simple example demonstrates the principles of using the Polygonica Boolean along with the 3D curve operations to generate a simple multi-axis toolpath to generate an additive part.

The target surface is moved up through the part. At each different level we use PFSolidPairCreateIntersection curve to create the intersection of the part with the print surface (blue).

We can then use PFCurveOffset to create an offset toolpath (red) across the target surface based on the intersection curve of the two meshes.

Finally, we can simulate the material that will be added using MachineWorks.

### Example 2: Repairing worn parts

Polygonica has a full range of operations for working on laser scan data. In particular, advanced mesh registration and alignment can be used to precisely align the scan of the worn part with the original CAD model. A Boolean subtraction of one from the other will then generate the boundary of space in which new material must be added to repair the part.

Standard planar slicing can be used to create intersection curves with this volume, and 2D hatch and infill can be used to create a 3-axis toolpath to repair it.

Alternatively, the base surface of the volume can be extracted, extended using PFSolidExtend, and then moved upwards through the volume to create intersection curves as in Example 1. PFCurveOffset is again used to generate a multi-axis infill across the surface.

### Example 3: Creating intersections using offset surfaces

In this example we create a toolpath for a propellor by successively offsetting the engine cone using PFSolidOffset, and creating intersection curves with the target blade geometry.

You can learn more and see a demo of the example code in action on the Polygonica channel on YouTube: