Fuse
typescript
// Prepare colors
const redColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_RED);
const blueColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_BLUE);
const greenColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_GREEN);
// Generate shapes
const csysr = new Mx3dGeCSYSR();
csysr.SetLocation(650, 0, 0);
const box = new Mx3dMkBox(csysr, 20, 20, 20);
const boxShape = box.Shape();
csysr.SetLocation(670, 20, 20);
const sphere = new Mx3dMkSphere(csysr, 10);
const sphereShape = sphere.Shape();
const fuseShape = sphereShape.fuse(boxShape);
fuseShape.TranslateByVec(new Mx3dGeVec(0, 50, 0));
// Add shape colors to document
addShapeToDoc(boxShape, redColor);
addShapeToDoc(sphereShape, greenColor);
addShapeToDoc(fuseShape, blueColor);
// Update display (will update the model displayed in the canvas)
mxcad3d.update();
Cut
typescript
// Prepare colors
const redColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_RED);
const blueColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_BLUE);
const greenColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_GREEN);
// Generate shapes
const csysr = new Mx3dGeCSYSR();
csysr.SetLocation(700, 0, 0);
const box = new Mx3dMkBox(csysr, 20, 20, 20);
const boxShape = box.Shape();
csysr.SetLocation(720, 20, 20);
const sphere = new Mx3dMkSphere(csysr, 10);
const sphereShape = sphere.Shape();
const cutShape = boxShape.cut(sphereShape);
cutShape.TranslateByVec(new Mx3dGeVec(0, 50, 0));
// Add shape colors to document
addShapeToDoc(boxShape, redColor);
addShapeToDoc(sphereShape, greenColor);
addShapeToDoc(cutShape, blueColor);
// Update display (will update the model displayed in the canvas)
mxcad3d.update();
Common
typescript
// Prepare colors
const redColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_RED);
const blueColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_BLUE);
const greenColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_GREEN);
// Generate shapes
const csysr = new Mx3dGeCSYSR();
csysr.SetLocation(750, 0, 0);
const box = new Mx3dMkBox(csysr, 20, 20, 20);
const boxShape = box.Shape();
csysr.SetLocation(770, 20, 20);
const sphere = new Mx3dMkSphere(csysr, 10);
const sphereShape = sphere.Shape();
const commonShape = boxShape.common(sphereShape);
commonShape.TranslateByVec(new Mx3dGeVec(0, 50, 0));
// Add shape colors to document
addShapeToDoc(boxShape, redColor);
addShapeToDoc(sphereShape, greenColor);
addShapeToDoc(commonShape, blueColor);
// Update display (will update the model displayed in the canvas)
mxcad3d.update();
Section
typescript
// Prepare colors
const redColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_RED);
const blueColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_BLUE);
const greenColor = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_GREEN);
// Generate shapes
const csysr = new Mx3dGeCSYSR();
csysr.SetLocation(800, 0, 0);
const box = new Mx3dMkBox(csysr, 20, 20, 20);
const boxShape = box.Shape();
csysr.SetLocation(820, 20, 20);
const sphere = new Mx3dMkSphere(csysr, 10);
const sphereShape = sphere.Shape();
const sectionShape = boxShape.section(sphereShape);
sectionShape.TranslateByVec(new Mx3dGeVec(0, 50, 0));
// Add shape colors to document
addShapeToDoc(boxShape, redColor);
addShapeToDoc(sphereShape, greenColor);
addShapeToDoc(sectionShape, blueColor);
// Update display (will update the model displayed in the canvas)
mxcad3d.update();