6.1 KiB
Design Tools
Summary
MatterControl includes a comprehensive set of parametric design tools for creating and modifying 3D objects. Tools range from primitive shape generators to advanced boolean operations, mesh modifications, and text/image extrusion.
Technical Description
Architecture
Design tools are implemented as IObject3D subclasses:
Object3D (base)
├── Primitives (generators)
│ ├── CubeObject3D
│ ├── CylinderObject3D
│ ├── SphereObject3D
│ └── ...
├── Operations (modifiers)
│ ├── ScaleObject3D
│ ├── RotateObject3D
│ ├── AlignObject3D
│ └── ...
└── Boolean Operations
├── CombineObject3D (Union)
├── SubtractObject3D
└── IntersectObject3D
Primitive Objects
Shape generators with parametric properties:
| Primitive | Parameters |
|---|---|
CubeObject3D |
Width, Depth, Height |
CylinderObject3D |
Diameter, Height, Sides |
SphereObject3D |
Diameter, Latitude/Longitude Steps |
ConeObject3D |
Top/Bottom Diameter, Height |
TorusObject3D |
Outer Diameter, Ring Diameter |
HemisphereObject3D |
Diameter |
PyramidObject3D |
Width, Depth, Height |
WedgeObject3D |
Width, Depth, Height |
RingObject3D |
Outer/Inner Diameter, Height |
Transform Operations
| Operation | Description | Parameters |
|---|---|---|
ScaleObject3D |
Resize object | X/Y/Z scale factors |
RotateObject3D |
Rotate around axis | Angle, Axis |
TranslateObject3D |
Move object | X/Y/Z offset |
MirrorObject3D |
Mirror across plane | Mirror plane |
AlignObject3D |
Align to reference | Alignment mode |
Array Operations
| Operation | Description |
|---|---|
ArrayLinearObject3D |
Linear array (copies in line) |
ArrayRadialObject3D |
Radial array (copies in circle) |
ArrayAdvancedObject3D |
Custom array patterns |
Mesh Modifications
| Operation | Description |
|---|---|
CurveObject3D |
Bend mesh along curve |
TwistObject3D |
Twist mesh around axis |
PinchObject3D |
Pinch/bulge mesh |
HollowOutObject3D |
Create hollow shell |
DecimateObject3D |
Reduce polygon count |
RepairObject3D |
Fix mesh errors |
PlaneCutObject3D |
Cut with plane |
Boolean Operations
Constructive Solid Geometry (CSG):
| Operation | Result |
|---|---|
CombineObject3D |
Union (merge shapes) |
SubtractObject3D |
Difference (cut away) |
IntersectObject3D |
Intersection (common volume) |
SubtractAndReplaceObject3D |
Subtract with material replacement |
Text and Image Tools
TextObject3D:
- Font selection
- Height/depth parameters
- Bold/italic options
ImageToPathObject3D:
- Image to vector outline
- Threshold control
- Extrusion depth
LinearExtrudeObject3D:
- Extrude 2D path to 3D
- Height, twist, scale parameters
Path Operations
Located in DesignTools/Operations/Path/:
| Operation | Description |
|---|---|
LinearExtrudeObject3D |
Extrude path vertically |
RotateExtrudeObject3D |
Revolve path around axis |
SmoothPathObject3D |
Smooth path curves |
OffsetPathObject3D |
Offset/inset path |
Property System
Design tools use [ShowAsMutableObject] and custom attributes:
[ShowAsMutableObject]
public class CubeObject3D : PrimitiveObject3D
{
[DisplayName("Width")]
public double Width { get; set; } = 20;
[DisplayName("Depth")]
public double Depth { get; set; } = 20;
[DisplayName("Height")]
public double Height { get; set; } = 20;
}
Rebuild System
Objects are rebuilt when properties change:
public override Task Rebuild()
{
// Generate new mesh from parameters
var mesh = CreateMesh();
Mesh = mesh;
return Task.CompletedTask;
}
Undo/Redo Support
Operations integrate with scene undo buffer:
sceneContext.Scene.UndoBuffer.Add(new UndoCommand(
() => { /* undo action */ },
() => { /* redo action */ }
));
Design Rationale
Parametric Objects: Storing parameters instead of fixed meshes enables:
- Non-destructive editing
- Dimension changes without re-creation
- Saved file size reduction
Hierarchical Operations: Nesting objects allows:
- Complex compositions
- Chained operations
- Clear modification history
Property System: Using attributes provides:
- Automatic UI generation
- Type-safe editing
- Validation support
Reference
Primitives
| Class | Location | Description |
|---|---|---|
CubeObject3D |
DesignTools/Primitives/ | Box primitive |
CylinderObject3D |
DesignTools/Primitives/ | Cylinder |
SphereObject3D |
DesignTools/Primitives/ | Sphere |
TextObject3D |
DesignTools/Primitives/ | 3D text |
Operations
| Class | Location | Description |
|---|---|---|
ScaleObject3D |
DesignTools/Operations/ | Scale |
RotateObject3D |
DesignTools/Operations/ | Rotate |
AlignObject3D |
DesignTools/Operations/ | Align |
ArrayLinearObject3D |
DesignTools/Operations/ | Linear array |
Boolean Operations
| Class | Location | Description |
|---|---|---|
CombineObject3D |
DesignTools/ | Union |
SubtractObject3D |
DesignTools/ | Subtraction |
IntersectObject3D |
DesignTools/ | Intersection |
Editors
| Class | Location | Description |
|---|---|---|
PropertyEditor |
DesignTools/EditorTools/ | Property grid |
SheetEditor |
DesignTools/Sheets/ | Spreadsheet editor |