Skip to content

Dimension annotation ​

A notation is a graphic element used in a drawing to provide information about size, position, orientation, etc. It is the main technical basis for graphic reading and production guidance. Annotations can be created for various types of objects in a variety of directions as required. mxcad provides the Alignment annotation class and the rotation annotation class, if you have other annotation needs such as: Plan approval mark, arrow mark, and cloud line marked reference mxdraw library provides the dimensioning methods.

Note common concepts:

NameDescriptionto add
Annotated textThe stringused to indicate the measured value the text may also contain prefixes, suffixes, and tolerances
dimension lineindicates the direction and range of the annotationfor Angle annotation, the dimension line is an arc
The arrowdisplayed at both ends of the size linecan be used to specify different sizes and shapes for the arrow or slash
The dimension boundaryextends from the component to the dimension line

Align annotated dimension classes ​

You can create alignment annotations by instantiating a McDbAlignedDimension() object. Setting the start point xLine1Point, end point xLine2Point, location point dimLinePoint, and text attachment mode of McDbAlignedDimension() instance object textAttachment, Tilt Angle oblique, and other Settings to draw alignment annotations.

In addition, alignment annotations can be drawn directly through the drawDimAligned() method provided by the mxcad instance object.

Click McDbAlignedDimension() to check the properties and methods in detail.

Click drawDimAligned() to check the properties and methods in detail.

ts
import {
  MxCpp,
  McGePoint3d,
  McCmColor,
  McDb,
  McDbAlignedDimension,
} from "mxcad";

const mxcad = MxCpp.getCurrentMxCAD();
const mDimension = new McDbAlignedDimension();
mDimension.xLine1Point = new McGePoint3d(-1800, 0);
mDimension.xLine2Point = new McGePoint3d(0, 0);
mDimension.dimLinePoint = new McGePoint3d(-500, -500);
mDimension.textAttachment = McDb.AttachmentPoint.kTopLeft;
mDimension.trueColor = new McCmColor(200, 255, 0);
mDimension.oblique = 0;
mxcad.drawEntity(mDimension);

mxcad.addDimStyle(
  "MyDimStyle",
  "41,0.18,141,0.09,40,200",
  "77,1,271,3",
  "",
  "",
);
mxcad.drawDimStyle = "MyDimStyle";
mxcad.drawDimAligned(100, 0, 2000, 0, 1200, 0);

Rotate the dimensioning class ​

We can create a spin annotation by instantiating a McDbRotatedDimension() object.

In addition, rotation annotations can be drawn directly using the drawDimRotated() method provided by the mxcad instance object.

tap McDbRotatedDimension(), drawDimRotated() to check the detailed description attributes and methods.

ts
import {
  MxCpp,
  McGePoint3d,
  McCmColor,
  McDb,
  McDbRotatedDimension,
} from "mxcad";

const mxcad = MxCpp.getCurrentMxCAD();
const rDimension = new McDbRotatedDimension();
rDimension.xLine1Point = new McGePoint3d(100, -137);
rDimension.xLine2Point = new McGePoint3d(161, 30);
rDimension.dimLinePoint = new McGePoint3d(80, -60);
rDimension.textAttachment = McDb.AttachmentPoint.kTopLeft;
rDimension.textRotation = 1.5;
rDimension.trueColor = new McCmColor(200, 255, 0);
rDimension.oblique = 0;
rDimension.rotation = 0;
mxcad.drawEntity(rDimension);

mxcad.addDimStyle(
  "MyDimStyle",
  "41,0.18,141,0.09,40,200",
  "77,1,271,3",
  "",
  "",
);
mxcad.drawDimStyle = "MyDimStyle";
mxcad.drawDimRotated(0, 7000, 600, 7000, 250, 7050, 0);

Angle annotation ​

We can draw Angle annotations directly through the drawDimAngular() method provided by the mxcad instance object.

Click drawDimAngular() to check the properties and methods in detail.

ts
import { MxCpp } from "mxcad";

let mxcad = MxCpp.getCurrentMxCAD();

mxcad.addDimStyle(
  "MyDimStyle2",
  "41,0.18,141,0.09,40,200",
  "77,1,271,3",
  "",
  "",
);
mxcad.drawDimStyle = "MyDimStyle2";
mxcad.drawDimAngular(500, 5000, 0, 5500, 1000, 5500, 500, 5500);

Radial dimension (radius) ​

We can create a radial dimension (radius dimension) by instantiating a McDbRadialDimension() object. Setting the center point center, the chord point chordPoint (the endpoint of the radius on the circumference), the leader length leaderLength, and text attachment mode textAttachment of McDbRadialDimension() instance object, and other Settings to draw a radius dimension.

In addition, radial dimensions can be drawn directly through the drawDimRadial() method provided by the mxcad instance object.

Click McDbRadialDimension(), drawDimRadial() to check the properties and methods in detail.

ts
import {
  MxCpp,
  McGePoint3d,
  McCmColor,
  McDb,
  McDbCircle,
  McDbRadialDimension,
} from "mxcad";

const mxcad = MxCpp.getCurrentMxCAD();
// Draw a circle first
const circle = new McDbCircle(-1200, 0, 0, 200);
mxcad.drawEntity(circle);
// Dimension the radius of the circle: from the center point center to the chord point chordPoint on the circumference
const radialDim = new McDbRadialDimension();
radialDim.center = new McGePoint3d(-1200, 0, 0);
radialDim.chordPoint = new McGePoint3d(-1000, 0, 0);
radialDim.textPosition = new McGePoint3d(-800, 0, 0);
radialDim.textAttachment = McDb.AttachmentPoint.kTopLeft;
radialDim.trueColor = new McCmColor(200, 255, 0);
mxcad.drawEntity(radialDim);

// Or draw the radius dimension directly through the convenient method: center point, chord point, leader length
mxcad.drawDimRadial(-1200, 0, -1000, 0, 60);

Diametric dimension ​

We can create a diametric dimension by instantiating a McDbDiametricDimension() object. Setting the chord point chordPoint, the far chord point farChordPoint (the two points are the two endpoints of a diameter on the circle), the leader length leaderLength, and text attachment mode textAttachment of McDbDiametricDimension() instance object, and other Settings to draw a diameter dimension.

In addition, diametric dimensions can be drawn directly through the drawDimDiametric() method provided by the mxcad instance object.

Click McDbDiametricDimension(), drawDimDiametric() to check the properties and methods in detail.

ts
import {
  MxCpp,
  McGePoint3d,
  McCmColor,
  McDb,
  McDbCircle,
  McDbDiametricDimension,
} from "mxcad";

const mxcad = MxCpp.getCurrentMxCAD();
// Draw a circle first
const circle = new McDbCircle(1200, 0, 0, 200);
mxcad.drawEntity(circle);
// Dimension the diameter of the circle: the chord point chordPoint and the far chord point farChordPoint are the two endpoints of a diameter
const diametricDim = new McDbDiametricDimension();
diametricDim.chordPoint = new McGePoint3d(1400, 0, 0);
diametricDim.farChordPoint = new McGePoint3d(1000, 0, 0);
diametricDim.textPosition = new McGePoint3d(600, 0, 0);
diametricDim.textAttachment = McDb.AttachmentPoint.kTopLeft;
diametricDim.trueColor = new McCmColor(255, 102, 0);
mxcad.drawEntity(diametricDim);

// Or draw the diameter dimension directly through the convenient method: chord point, far chord point, leader length
mxcad.drawDimDiametric(1400, 0, 1000, 0, 60);