Skip to content
On this page

Ellipse

We can create an ellipse by instantiating an McDbEllipse() object. Draw the ellipse by setting the center center of the McDbEllipse() instance object, the main axis vector majorAxis, the minor axis vector minorAxis, or the ratio radiusRatio of the short axis to the long axis. You can also draw elliptic arcs by setting the startAngle and endAngle of the instance object.

In addition, ellipses and ellipses can be drawn directly by drawEllipse() method and drawEllipseArc() method provided by mxcad instance objects.

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

Click drawEllipse()、drawEllipseArc() to check the properties and methods in detail.

ts
import { MxCpp, McGePoint3d, McDbEllipse, McCmColor, McGeVector3d } from "mxcad"

const mxcad = MxCpp.getCurrentMxCAD()
const ellipse = new McDbEllipse()
ellipse.center = new McGePoint3d(-200, -200),
ellipse.majorAxis = new McGeVector3d(0, 300, 0)
ellipse.minorAxis = new McGeVector3d(33, 0, 0)
ellipse.radiusRatio = 0.5
ellipse.startAngle = Math.PI / 2
ellipse.endAngle = Math.PI * 3 / 2
ellipse.trueColor = new McCmColor(255, 233, 0)
mxcad.drawEntity(ellipse)

mxcad.drawEllipse(0, -200, 200, 0, 1.5)

mxcad.drawEllipseArc(200, -200, 200, 0, 1.5, 100, 650)