Creating Revolved Solids
We can create a revolved solid by instantiating an Mx3dMkRevol object.
You can construct an Mx3dMkRevol object by providing a shape to be revolved, such as an Mx3dShapeObject, along with a rotation axis defined by an Mx3dGeAxis object and an angle of rotation.
typescript
// Get the document
const doc = mxcad3d.getDocument();
// By default, the right-hand coordinate system is aligned with the world coordinate system
const csysr = new Mx3dGeCSYSR();
// Create a geometric circle with a radius of 5
const circle = new Mx3dGeomCircle(csysr, 5);
// Obtain the wire topology of the circle
const circleWire = circle.Wire();
// Define the rotation axis using a point and a direction
const axis = new Mx3dGeAxis(new Mx3dGePoint(20, 0, 0), new Mx3dGeDir(0, 1, 0));
// Create a revolved solid using the circle wire, axis, and rotation angle of Math.PI / 2
const revolMaker = new Mx3dMkRevol(circleWire, axis, Math.PI / 2);
// Obtain the resulting shape
const revolShape = revolMaker.Shape();
// Create a shape label in the document
const revolLabel = doc.addShapeLabel();
// Set the shape of the label to the revolved shape
revolLabel.setShape(revolShape);
// Update the display (this will update the model displayed in the canvas)
mxcad3d.update();
A revolved solid is formed by rotating a lower-dimensional topological shape around an axis, resulting in a higher-dimensional shape.
Pre-rotation | Post-rotation |
---|---|
Vertex | Edge |
Edge | Face |
Wire | Shell |
Face | Solid |
Shell | CompSolid |
Note
GitHub and network-related issues might cause slow loading times, requiring a few minutes of waiting...