Skip to content
On this page

Polyline

We can create a multiline by instantiating an McDbPolyline() object.

A multi-segment line is a multi-segment connection line composed of arcs and lines. Users can draw multiple lines with any line type. After at least one multi-segment line has been drawn, the erase() method can be called to remove the previous line segment. After two or more multi-segment lines are drawn, the isClosed() method can be called to close the current multiple lines and draw a line segment that ends with the start of the first line segment. The addVertexAt() method can also be called to set the vertex position of the multi-segment line, the width of the line and the crown of the arc. Combined with command mode, you can add vertices, delete vertices, convert to arc, convert to line and other complete functions.

Click McDbPolyline() to view detailed property and method descriptions.

ts
import { MxCpp, McGePoint3d, McDbPolyline } from "mxcad"
const mxcad = MxCpp.getCurrentMxCAD()
const polyline = new McDbPolyline()
polyline.isClosed = true
polyline.constantWidth = 10
polyline.addVertexAt(new McGePoint3d(800, 300, 0))
polyline.addVertexAt(new McGePoint3d(900, 300, 0))
polyline.addVertexAt(new McGePoint3d(900, 400, 0))
mxcad.drawEntity(polyline)