Constructive Solid Geometry

Commands: XSOLIDEDIT, XPURGE

The method used by Bricscad to construct complex solid models from simple shapes is called Constructive Solid Geometry, or CSG. The CSG definition data is stored in a CSG Tree, a simple structure that organizes the primitives and operators in a hierarchy that reflects the steps used in creating a complex solid. Editing a CSG tree is equivalent to changing the steps used to create the solid. The XSOLIDEDIT command, accesses a solid's CSG tree and allows it to be changed in the way it was created. Component primitives within a composite solid can be changed as well as any chamfers, fillets, or slices that have been applied to the solid. X-Solids keeps track of any such changes and automatically recomputes the solid when the changes are complete.  

Note that Bricscad's native solid modeling commands do not maintain this CSG data. Consequently construction and editing operations performed with the native Bricscad solid modeling commands are not written to the CSG tree and so cannot be edited at a later time.

The SOLIDEDIT command changes a solid's geometry by manipulating it's faces. Theses manipulations are NOT recorded in the X-Solids CSG tree. This is best understood by example. Suppose a 1x1x1 box with a through hole of diameter 0.5 is created with X-Solids. The SOLIDEDIT command is then used to resize the box to 1x1x2. This lengthening operation is NOT written to the solid's CSG data. If the solid is then changed via the  XSOLIDEDIT command (e.g. the hole is resized to diameter 0.25 diameter), when the editing operation is complete the solid will revert back to it's original 1x1x1 size, obviously not what the user wanted. To prevent such incidents it is highly recommended that the solid's history be removed via the XPURGE command before it is used with the SOLIDEDIT  command. While this will make the solid uneditable via the XSOLIDEDIT command it will prevent unintended changes to the solid. XPURGE should also be run on any solid created by X-Solids that has been subsequently changed by a non-X-Solids equipped user as those changes will also be lost if the solid is later changed via the XSOLIDEDIT command.

CSG Trees

A CSG tree is a data structure consisting of terminal nodes or leaf nodes, representing the primitives, and internal or branch nodes representing the Boolean operations (Union, Intersect, Subtract). Unlike some implementations, X-Solids tree structure is not necessarily binary; a branch node can have more than two subtrees. The "shape" of the tree (depth or width) has virtually no impact on performance. The "root node" represents the most recent operation used to create the solid. Solid primitives are represented by a CSG tree that consists of a single node, which is also the root. Once you’ve done one or more Boolean operations, the root is a branch node representing the most recent operation.

Chamfers and fillets do not fit neatly into the "classic" CSG tree concept, since they represent procedures that modify the solid rather than Boolean operations. (Special cases of these procedures can be realized as Boolean operations, but the approach does not easily extend to complex geometry). X-Solids represents these procedures through modifier nodes that attach to the CSG tree at leaf or branch nodes. The modifiers attach to the "root" of the tree when they are created, so that as you build up a complex tree through successive operations, you can have modifiers at any level in the tree.


© Menhirs NV. All rights reserved.