Save text as actual text when saving to DWG | Export all layers to DWG

Hey everyone :wave:,

I am currently checking out Aspose.CAD with java (aspose-cad-25.1). I am trying to load a file from .DWG, add a couple of objects and saving back to a .DWG again.

val image =
    Image.load(“path/to/file.dwg")

val cadImage = image as CadImage

val layer = CadLayerTable()
layer.name = “new_layer”
layer.colorId = 256

cadImage.r().addItem(layer)

val rectangle = CadLwPolyline()

val x = -28633.94720000
val y = 6628.87470000
val width = 4.0
val height = 3.0

rectangle.coordinates = listOf(
    Cad2DPoint(x, y),
    Cad2DPoint(x + width, y),
    Cad2DPoint(x + width, y + height),
    Cad2DPoint(x, y + height)
);

rectangle.flag = CadLwPolylineFlag.Closed
rectangle.constantWidth = 0.01
rectangle.layerName = "new_layer"

cadImage.blockEntities.get_Item("*Model_Space").addEntity(rectangle)

val cadText = CadText()
cadText.styleType = "Standard"
cadText.defaultValue = "Some custom text"
cadText.colorId = 256
cadText.layerName = "new_layer"
cadText.firstAlignment.x = -28633.94720000
cadText.firstAlignment.y = 6628.87470000
cadText.textHeight = 0.8
cadText.scaleX = 1.0

cadImage.blockEntities.get_Item("*Model_Space").addEntity(cadText)

val dwgOptions = DwgOptions()

cadImage.save(
    “Path/to/output-file.dwg",
    dwgOptions
)

This results in two problems:

(1) Only one layer seems to be exported at a time, i.e. either only the original layer or the first previously existing layer is exported. I have not been able to produce a file with more than one layer.
(2) All text is converted to a shape. While I guess this is somewhat intentional, it immediately disqualifies Aspose.CAD as an option for us and we would be interested if there are any plans on exporting text to DWG

That said, export to DXF works like a charm which makes me think that there is some DWG-Export specific problem.

Best Regards,
Paul

@paul_1234.
Hi,
could you please share the sample of some initial file so we can test it directly on our side and see more details. Such behavior could depend on the version of DWG file, as we support writing of 2018 version and can not convert entities between different versions so result is represented as shapes.