Overview

The rosemath library contains functions to read and write mesh data as XML elements. The STEP and IFC faceting libraries use this XML as a baseline and may add additional information to describe product and assembly structure.

Meshes, Faces, and Facets

The shell element contains a single RoseMesh. There is an element that contains all of the vertices, and then a list of facet collections. If the facet set has no faces, all facets will be written as a single collection. If the facet set contains faces, a <facets> element will be written for each face and facets that do not belong to a face will not be written.

The XML for a simple mesh is shown below. The mesh is a box with eight vertices. The first two facets describe the bottom of the box and the surface normal at each vertex points down (-Z direction). Each facet references three vertices by index. Facets are connected when they share vertices. No faces are defined so all of the facets are written in one group.

<?xml version="1.0" encoding="UTF-8" ?>
<shell id="id123030" color="a1a14f">
<verts>
    <v p="-1 -2 -3"/>
    <v p="5 -2 -3"/>
    <v p="5 6 -3"/>
    <v p="-1 6 -3"/>
    <v p="-1 -2 7"/>
    <v p="5 -2 7"/>
    <v p="5 6 7"/>
    <v p="-1 6 7"/>
</verts>
<facets>
    <f v="0 3 2">
        <n d="0 0 -1"/>
        <n d="0 0 -1"/>
        <n d="0 0 -1"/>
    </f>
    <f v="2 1 0">
        <n d="0 0 -1"/>
        <n d="0 0 -1"/>
        <n d="0 0 -1"/>
    </f>

    [ ... more facets omitted ... ]

</facets>
</shell>

The structure above is written by rose_mesh_xml_save() and associated functions. This is available to any application that uses the mesh definitions in the rosemath library. The STEP and IFC faceting libraries add product and assembly data and use a different API to generate files with extra information.

The elements used for mesh data are described below:

shell

The shell element contains the faceted geometry of a shape. It contains the verts element with a list of vertices and facets elements with lists of facets. The following attributes may be used

shell / verts

The verts elements contains the list of vertices in a shell. The element has no attrbiutes, and contains v elements, which define the vertices. There must be exactly one verts element within each shell.

shell / verts / v

The v element defines a single vertex. This is used to provide a cartesian point. The vertices are factored out, so that topological analysis of the shell can be performed. These vertices are identified by index in the facets. (e.g. the first v element is index 0, the second one is at index 1, etc.)

shell / facets

The facets element is a container for a set of facets. There may be multiple facets elements within a shell. Each facets element defined the facets of a single face in the STEP data, and may override the color specified in the shell.

shell / facets / f

Each facet is repressented by an f element. The contains the vertices and normals that define the given facet.

shell / facets / n

The n element gives the surface normal at one of the three vertices of the facet. Each facet (f element) will have exactly 3 n elements corresponding to the vertices in the same order given in the v attribute.

Product and Assembly Structure

The elements below describe how the XML document is extended to include STEP and IFC product structure and assembly information. The rosemath library does not provide functions to parse or write these. The STEP faceting library and the IFC faceting library have functions and applications to write additional data.

step-assembly

The root element in a STEP assembly XML file is the step-assembly element. This element has the following attributes:

product

The product element identifes a single STEP product STEP data. This corresponds to a step product_definition instance. There may be multiple products in the file nested within each other to give the assembly tree of the model.

shape

The shape element defines a single shape in the STEP data. It corresponds to an instance of a shape_representation. Like product elements, shape elements may have child elements, which represents the assembly tree. This means that there may be some redundant object hierarchy prepresented in the shape and product elements. This complexity is due to the way the STEP handles assemblies. Generally, the product tree should be used to label and identify object, and then the shape objects should be traversed to get the geometry.

shape / child

The child element is used to specify a child shape and a transformation matrix for the child coordinate system.

shell or shell stub

A shell element is mesh data as described above, while a shell stub element is a reference to a shell inanother file. This feature is used to split assemblies into multiple files, each of which can be loaded on demand. A shell may either be a proxy or it may contain the geometry. (The options to the authoring tools determine if a single file is created, or if multiple file are, with the geometry split out into separate files.)