Skip to content
On this page

Circle

We can create a circle by instantiating an McDbCircle() object. To draw a circle by setting the radius of the center of the McDbCircle() instance object, you can also directly use the constructor of McDbCircle() to directly set the center and radius of the circle, such as new McDbCircle(x, y, z, r).

In addition, circles can be drawn directly through the drawCircle() method provided by the mxcad instance object.

Click McDbCircle()drawCircle() for a detailed property and method description.

ts
import { MxCpp, McCmColor, McDbCircle } from "mxcad"

const mxcad = MxCpp.getCurrentMxCAD()
const circle = new McDbCircle(-100, 300, 0, 20)
circle.trueColor = new McCmColor(255, 0, 0)
mxcad.drawEntity(circle)

const circle_2 = new McDbCircle()
circle_2.center = new McGePoint3d(-100, 300, 0)
circle_2.radius = 10
circle_2.trueColor = new McCmColor(0, 255, 0)
mxcad.drawEntity(circle_2)

mxcad.drawCircle(-100, 300, 30)