The annotations and text labels created in MXCAD3D are temporarily displayed in the viewport and are not saved in the document.
Length Dimension
typescript
// Two endpoints of the length dimension
const pt1 = new Mx3dGePoint(0, 0, 0);
const pt2 = new Mx3dGePoint(50, 50, 0);
// Plane on which the dimension symbol lies
const plane = new Mx3dGePlane();
// Length dimension
const lenDim = new Mx3dDimLength(pt1, pt2, plane);
// Dimension style
const dimAspect = new Mx3dAspectDim();
// Arrow style for the dimension
const arrowAspect = new Mx3dAspectArrow(Math.PI / 12, 3);
const color = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_RED);
arrowAspect.SetZoomable(true);
arrowAspect.SetColor(color);
// Text style for the dimension
const textAspect = new Mx3dAspectText();
textAspect.SetHeight(3);
// Set the dimension styles
dimAspect.SetArrowAspect(arrowAspect);
dimAspect.SetTextAspect(textAspect);
dimAspect.MakeText3d(true);
// Set the dimension style for the length dimension
lenDim.SetDimensionAspect(dimAspect);
// Display the dimension object in the document view
mxcad3d.displayDimension(lenDim);
Radius Dimension
typescript
const csysr = new Mx3dGeCSYSR();
// Circle to be dimensioned
const circle = new Mx3dGeCircle(csysr, 50);
// Radius dimension
const rdim = new Mx3dDimRadius(circle);
// Dimension style
const dimAspect = new Mx3dAspectDim();
dimAspect.MakeText3d(true);
// Set the dimension style for the radius dimension
rdim.SetDimensionAspect(dimAspect);
// Display the dimension object in the document view
mxcad3d.displayDimension(rdim);
Diameter Dimension
typescript
const csysr = new Mx3dGeCSYSR();
// Circle to be dimensioned
const circle = new Mx3dGeCircle(csysr, 50);
// Diameter dimension
const ddim = new Mx3dDimDiameter(circle);
// Dimension style
const dimAspect = new Mx3dAspectDim();
dimAspect.MakeText3d(true);
// Set the dimension style for the diameter dimension
ddim.SetDimensionAspect(dimAspect);
// Display the dimension object in the document view
mxcad3d.displayDimension(ddim);
Angle Dimension
typescript
const pnt1 = new Mx3dGePoint(100, 0, 0);
const pnt2 = new Mx3dGePoint(0, 0, 0);
const pnt3 = new Mx3dGePoint(0, 0, 100);
// Define the angle dimension using three points
const angDim = new Mx3dDimAngle(pnt1, pnt2, pnt3);
// Dimension style
const dimAspect = new Mx3dAspectDim();
// Arrow style
const arrowAspect = new Mx3dAspectArrow(Math.PI / 12, 3);
const color = new Mx3dGeColor(MdGe.MxNameOfColor.Color_NOC_RED);
arrowAspect.SetZoomable(true);
arrowAspect.SetColor(color);
// Text style
const textAspect = new Mx3dAspectText();
textAspect.SetHeight(3);
textAspect.SetColor(color);
dimAspect.SetArrowAspect(arrowAspect);
dimAspect.SetTextAspect(textAspect);
dimAspect.MakeText3d(true);
angDim.SetDimensionAspect(dimAspect);
angDim.SetFlyout(15);
mxcad3d.displayDimension(angDim);
Text Label Symbol
typescript
// Anchor point for the text label symbol
const pt = new Mx3dGePoint();
// Construct a text label symbol using text content, font size, and anchor point
const textlabel = new Mx3dSymbolText("MxCAD 3D", 20, pt);
// Set whether the text label symbol scales with the view zoom
textlabel.SetZoomable(true);
// Display the text label symbol object in the document view
mxcad3d.displaySymbolText(textlabel);