Skip to content
On this page

Creating a Swept Path

We can create a swept path by instantiating an Mx3dMkPipe object.

You can construct an Mx3dMkPipe object by providing a sweep path, represented by an Mx3dShapeWire, and the shape to be swept, represented by an Mx3dShapeObject. The sweep path must be G1 continuous, and the shape to be swept should not contain solids.

typescript
// Get the document
const doc = mxcad3d.getDocument();
// Define the profile shape to be swept
const profile = new Mx3dShapeEdge(new Mx3dGePoint(0, 0, 0), new Mx3dGePoint(-1, 1, 1));
// Create an arc edge
const arcEdge = Mx3dGeomCircle.MakeArcOfCircle([0, 0, 0], [1, 0.5, 0], [2, 0, 0]);
// Convert the arc edge to a wire (sweep path)
const spine = Mx3dWireTool.EdgeToWire(arcEdge);
// Create the swept object
const pipe = new Mx3dMkPipe(spine, profile);
// Get the topological shape
const pipeShape = pipe.Shape();
// Create a shape label in the document
const pipeLabel = doc.addShapeLabel();
// Set the shape to the label
pipeLabel.setShape(pipeShape);
// Update the display (updates the model shown in the canvas)
mxcad3d.update();

Note

Loading from GitHub or the web might be slow due to network issues and could take a few minutes...