dxfEntities = (objects, options) => {
  const entityContents = objects.map((object, i) => {
    if (geom2.isA(object)) {
      const color = object.color
      const name = object.name
      const outlines = geom2.toOutlines(object)
      const paths = outlines.map((outline) => ({ closed: true, points: outline, color, name }))
      if (options.geom2To === 'polyline') {
        return PathsToPolyine(paths, options)
      }
      return PathsToLwpolyline(paths, options)
    }
    if (geom3.isA(object)) {
      // TODO object = ensureManifoldness(object)
      if (options.geom3To === 'polyline') {
        return PolygonsToPolyline(object, options)
      }
      return PolygonsTo3DFaces(object, options)
    }
    if (path2.isA(object)) {
      // mimic a path (outline) from geom2
      const color = object.color
      const name = object.name
      const path = { closed: object.isClosed, points: path2.toPoints(object), color, name }
      return PathsToLwpolyline([path], options)
    }
    return ''
  })
  let section = `  0
SECTION
  2
ENTITIES
`
  entityContents.forEach((content) => {
    if (content) {
      section += content
    }
  })
  section += `  0
ENDSEC`
  return section
}
Serialize the given objects as a DXF entity section
@param {Array} objects - objects to serialize as DXF
@param {Object} options - options for serialization
@returns {Object} serialized contents, DXF format