Construction line
We can create a construction line by instantiating an McDbXline() object. A construction line is a straight line that starts from a base point and extends infinitely in both directions along a specified direction, commonly used for auxiliary drawing and positioning reference. Draw a construction line by setting the basePoint and unitDir of the McDbXline() instance object, or you can directly call the setBasePoint(x, y, z) and setUnitDir(x, y, z) methods to set the base point and direction vector respectively, and can also set a variety of properties such as construction line color trueColor, layer layer, linear scale linetypeScale, etc.
McDbXline inherits from McDbCurve, so it can also call curve methods such as getPointAtDist() to get the point at a specified distance on the curve, and getFirstDeriv() to get the first derivative, just like a curve.
Click McDbXline() for detailed property and method descriptions.
import { MxCpp, McCmColor, McDbXline, McGePoint3d, McGeVector3d } from "mxcad"
const mxcad = MxCpp.getCurrentMxCAD()
// Set the base point and direction vector through properties
const xline = new McDbXline()
xline.basePoint = new McGePoint3d(0, 0, 0)
xline.unitDir = new McGeVector3d(1, 1, 0)
xline.trueColor = new McCmColor(255, 0, 0)
mxcad.drawEntity(xline)
// Set the base point and direction vector through methods
const xline_1 = new McDbXline()
xline_1.setBasePoint(100, 0, 0)
xline_1.setUnitDir(1, 0, 0)
xline_1.trueColor = new McCmColor(0, 255, 0)
mxcad.drawEntity(xline_1)