Skip to content
Carsten Arnholm edited this page Aug 18, 2019 · 14 revisions

xcsg wiki

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 fill2d cylinder hull3d
. hull2d polyhedron linear_extrude
. offset2d sphere rotate_extrude
. minkowski2d . transform_extrude
. projection2d . sweep
. . . minkowski3d