Skip to content
Carsten Arnholm edited this page May 1, 2017 · 14 revisions

xcsg reference guide

xcsg is an Xml file protocol (file extension .xcsg) and an application for creating 3d solid models based on Constructive Solid Geometry (CSG). The file protocol provides a way to define primitives, transformations and operators for 2d and 3d objects. The application processes this information, creating a 3d solid model.

The xcsg file protocol

An XCSG file contains a single root tag <xcsg>. All direct or indirect children of this root tag shall follow strictly the definitions given here. The <xcsg> tag has a version attribute identifying the xcsg protocol version and the optional global secant tolerance attribute. If the optional <metadata> child tag is present, it shall contain a <software>subtag to define which software name/version created the file, and <model> subtag twith model name and ISO 8601 formatted model creation time [UTC].

<?xml version="1.0" encoding="utf-8"?>
<xcsg version="1.0" secant_tolerance="0.01">
    <metadata>
        <software name="angelcad" version="V3.3-02"/>
        <model name="MyModelName" created="2017-05-01T10:35:37"/>
    </metadata>
    .... contents ...
</xcsg>

The file contents are 2d and 3d primitives and operators as shown below. 3d objects and operators define 3d objects directly, while 2d objects exist in the xy-plane and are typically "extruded" to create 3d objects. The top level defines exactly one model object. The primitives and operators may be subject to Transformations. The level of discretization is controlled using the global Secant tolerance.

primitives (2d) operators (2d) primitives (3d) operators (3d)
circle union2d cone union3d
square difference2d cube difference3d
polygon intersection2d cuboid intersection3d
rectangle hull2d cylinder hull3d
offset2d polyhedron linear_extrude
sphere rotate_extrude
                   |                                 |                          | [transform_extrude](transform_extrude) 

The xcsg application

The xcsg application takes a .xcsg file as input and compiles its data into a solid model, and exported to common surface mesh file formats, including STL.

$ xcsg --help

xcsg command line options & arguments:
  -h [ --help ]         Show this help message.
  --amf                 output AMF file (Additive Manufacturing Format)
  --csg                 output CSG file (OpenSCAD)
  --stl                 output STL file (STereoLitography)
  --astl                output STL file (STereoLitography) - ASCII
  --obj                 output OBJ file (Wavefront format)
  --off                 output OFF file (Geomview Object File Format)
  <xcsg-file>           path to input .xcsg file (required)
Clone this wiki locally