Skip to content

Pathbuilder information center

Paul van Dinther edited this page Sep 26, 2021 · 1 revision

Introduction

Pathbuilder is a tool for openSCAD that make the creation of complex 2D shapes easier with a syntax similar to the one used for svg path. Pathbuilder supports the complete svg command set (except arc not complete yet) and several extra commands to make the creation of 2d shapes as easy as possible.

You can place filets or Chamfers at any point. Extend lines up to an arbitrary boundary and much more.

With pathbuilder there are two ways to use the command set. Typically the svg path syntax is represented by a single string. All commands and values are contained in that string. Using the single string method you can literally take the d attribute from a path in a .svg file and use it as is.

However the power of openSCAD is of course in its parametric design capabilities. Although you could string together a svg path string with the str command from openSCAD, it isn't exactly elegant.

Therefore pathbuilder also offers support for every command directly in your code. These commands are chained and a polygon is drawn at the end of the command sequence. In this case you can pass in your parameters directly into pathbuilder commands as they are normal openSCAD modules.

Each method has its own benefits and drawbacks. The command string is able to return either a point list or a shape depending how the string is passed to pathbuilder. A point list as output has the benefit that the list can be manipulated. Module based commands can not return a value so they always produce a polygon at the end. But modules also allow a much finer grained control over the curve segmentation.

Clone this wiki locally