|
| 1 | +# MatterCAD Documentation |
| 2 | + |
| 3 | +Welcome to the MatterCAD documentation. This guide provides an overview of all available shapes, transformations, and operations in the MatterCAD library. |
| 4 | + |
| 5 | +## Shapes |
| 6 | + |
| 7 | +### Box |
| 8 | +Creates a rectangular box. |
| 9 | +- **Constructors**: |
| 10 | + - `Box(double sizeX, double sizeY, double sizeZ, string name = "", bool createCentered = true)` |
| 11 | + - `Box(Vector3 size, string name = "", bool createCentered = true)` |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +### Cylinder |
| 16 | +Creates a cylinder or cone. |
| 17 | +- **Constructors**: |
| 18 | + - `Cylinder(double radius, double height, int sides, Alignment alignment = Alignment.z, string name = "")` |
| 19 | + - `Cylinder(double radius1, double radius2, double height, int sides, Alignment alignment = Alignment.z, string name = "")` |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +### Sphere |
| 24 | +Creates a sphere. |
| 25 | +- **Constructors**: |
| 26 | + - `Sphere(double radius, string name = "")` |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +### Torus |
| 31 | +Creates a torus (donut shape). |
| 32 | +- **Constructors**: |
| 33 | + - `Torus(double majorRadius, double minorRadius, int sides = 20, int segments = 20, string name = "")` |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +### NGonExtrusion |
| 38 | +Creates an extrusion of a regular polygon. |
| 39 | +- **Constructors**: |
| 40 | + - `NGonExtrusion(double radius1, double numSides, double height, Alignment alignment = Alignment.z, string name = "")` |
| 41 | + |
| 42 | +### LinearExtrude |
| 43 | +Extrudes a 2D shape along a linear path. |
| 44 | +- **Constructors**: |
| 45 | + - `LinearExtrude(double[] points, double height, Alignment alignment = Alignment.z, double twistRadians = 0, string name = "")` |
| 46 | + - `LinearExtrude(Vector2[] points, double height, Alignment alignment = Alignment.z, double twistRadians = 0, string name = "")` |
| 47 | + |
| 48 | +### RotateExtrude |
| 49 | +Extrudes a 2D shape by rotating it around an axis. |
| 50 | +- **Constructors**: |
| 51 | + - `RotateExtrude(double[] points, double axisOffset = 0, Alignment alignment = Alignment.z, string name = "")` |
| 52 | + - `RotateExtrude(Vector2[] points, double axisOffset, Alignment alignment = Alignment.z, string name = "")` |
| 53 | + |
| 54 | +### MeshContainer (Import STL) |
| 55 | +Loads a mesh from a file (e.g., STL). |
| 56 | +- **Constructors**: |
| 57 | + - `MeshContainer(string fileOnDisk, string name = "")` |
| 58 | + |
| 59 | +### Round |
| 60 | +Creates a box with rounded edges or corners. |
| 61 | +- **Constructors**: |
| 62 | + - `Round(Vector3 size, string name = "")` |
| 63 | + - `Round(double xSize, double ySize, double zSize, string name = "")` |
| 64 | +- **Methods**: |
| 65 | + - `RoundFace(Face faceToRound, double radius)` |
| 66 | + - `RoundEdge(Edge edgeToRound, double radius)` |
| 67 | + - `RoundPoint(Face threeFacesThatSharePoint, double radius)` |
| 68 | + - `RoundAll(double radius)` |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## Transformations |
| 73 | + |
| 74 | +### Translate |
| 75 | +Moves an object in 3D space. |
| 76 | +- **Example**: `new Translate(myObject, x: 10, y: 0, z: 5);` |
| 77 | +- **Example**: `new Translate(myObject, new Vector3(10, 0, 5));` |
| 78 | + |
| 79 | +### Rotate |
| 80 | +Rotates an object around the X, Y, and Z axes (in radians). |
| 81 | +- **Example**: `new Rotate(myObject, x: MathHelper.DegreesToRadians(45));` |
| 82 | + |
| 83 | +### Scale |
| 84 | +Changes the size of an object. |
| 85 | +- **Example**: `new Scale(myObject, x: 2, y: 1, z: 1);` |
| 86 | +- **Example**: `new Scale(myObject, new Vector3(2, 1, 1));` |
| 87 | + |
| 88 | +### Align |
| 89 | +Aligns one object to another based on their faces. |
| 90 | +- **Example**: `new Align(objectToMove, Face.Left, targetObject, Face.Right);` |
| 91 | + |
| 92 | +### SetCenter |
| 93 | +Sets the center of an object to a specific position. |
| 94 | +- **Example**: `new SetCenter(myObject, x: 0, y: 0, z: 0);` |
| 95 | +- **Example**: `new SetCenter(myObject, new Vector3(0, 0, 0));` |
| 96 | + |
| 97 | +### Mirror |
| 98 | +Mirrors an object across a plane. |
| 99 | +- **Methods**: |
| 100 | + - `myObject.NewMirrorAccrossX(double offsetFromOrigin = 0)` |
| 101 | + - `myObject.NewMirrorAccrossY(double offsetFromOrigin = 0)` |
| 102 | + - `myObject.NewMirrorAccrossZ(double offsetFromOrigin = 0)` |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +## Operations (CSG) |
| 107 | + |
| 108 | +### Union |
| 109 | +Combines multiple objects into one. |
| 110 | +- **C# operator**: `obj1 + obj2` |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +### Difference |
| 115 | +Subtracts one object from another. |
| 116 | +- **C# operator**: `obj1 - obj2` |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +### Intersection |
| 121 | +Keeps only the overlapping part of two objects. |
| 122 | +- **C# operator**: `obj1 & obj2` (Not directly supported as operator in some versions, use `new Intersection(obj1, obj2)`) |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Constants and Enums |
| 129 | + |
| 130 | +### Alignment |
| 131 | +Used to specify the primary axis of a shape. |
| 132 | +- `Alignment.x`, `Alignment.y`, `Alignment.z` |
| 133 | +- `Alignment.negX`, `Alignment.negY`, `Alignment.negZ` |
| 134 | + |
| 135 | +### Face |
| 136 | +Used for alignment and rounding. |
| 137 | +- `Face.Left`, `Face.Right`, `Face.Front`, `Face.Back`, `Face.Bottom`, `Face.Top` |
| 138 | + |
| 139 | +### Edge |
| 140 | +Used for rounding edges. |
| 141 | +- `Edge.LeftFront`, `Edge.LeftBack`, `Edge.LeftTop`, `Edge.LeftBottom`, etc. |
0 commit comments