Linearize text in DXF

Hello,

We have some problem regarding linearizing text in DXF files using Aspose.CAD.
Could you please have a look at the following code and advise? The DXF file is attached.
Abcd123FontChanged.zip (832 Bytes)

We mention that the text is rendered using the ISOCP.shx font and it was created with Aspose.Imaging. After creation, we replaced times.ttf with ISOCP.shx, in order to linearize it later.
We tried to set TextAsLines = true and ConvertTextBeziers = true on Aspose.CAD.ImageOptions.DxfOptions object sent for export, but didn’t help. It seems that the exported file is exactly the input file.

Thank you,
Andrei

public static void Linearize(string inputDxfFile, string outputDxfFile)
{
    using (CadImage cadImage = (CadImage)Image.Load(inputDxfFile))
    {
        CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();

        ImageOptionsBase dxfOptions = new DxfOptions
        {
            VectorRasterizationOptions = rasterizationOptions,
            TextAsLines = true,
            ConvertTextBeziers = true
        };

        cadImage.Save(outputDxfFile, dxfOptions);
    }
}

@andreimoldovansnapon,
Hi.
Could you please clarify the goal - do you need to have “ABCD123” text looking as sequence of lines in result DXF?

Hi @oleksii.gorokhovatskyi ,

Yes, we need the text to be replaced by a sequence of lines in the final DXF.

Thanks,
Andrei

@andreimoldovansnapon,
we can confirm the issue and we have created CADNET-9660 to investigate and fix it.

@oleksii.gorokhovatskyi , thank you for your follow-up.

Actually we’re on our trial period and linearizing text is the most important for us right now.
If we manage to make it work as expected, our plan is to proceed with buying the license.

We would highly appreciate an update on your progress whenever you have any as right now we are spending time we don’t really have looking into alternatives. We’re mainly interested if you think if there will be a solution for this problem in the end.

@andreimoldovansnapon,
we hope to have this feature delivered in the upcoming Aspose.CAD for .NET 24.2 release at the end of the month. In the meantime you could temporarily downgrade library to 22.6 version and try, as I can see, this feature works there. Additionally, you could also apply SHX font directly:

  using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
  {
      CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
     
      cadRasterizationOptions.ShxFonts = new string[]
      { 
          "isocp.shx",
      };

      DxfOptions dxfOptions = new DxfOptions();
      dxfOptions.VectorRasterizationOptions = cadRasterizationOptions;
      dxfOptions.TextAsLines = true;

      cadImage.Save(outPath, dxfOptions);
  }

@oleksii.gorokhovatskyi , thank you for your quick response on this topic.
The text seems to be linearized now, but the characters are double lines, not like in isocp.shx.
Please let us know if there is a solution to have the characters as single lines as the isocp.shx does.
AsposeLinesCompare.png (39.3 KB)

We attach a picture with what we have now and what we need.

Regards,
Andrei

@andreimoldovansnapon,
could you please test my example above with setting of SHX font?

@oleksii.gorokhovatskyi , I already did that, if I move back to Aspose 24, it renders SHX correctly as text, but not linearized, just duplicates the initial DXF.
We also tried to linearize with Aspose 22.6 a text with SHX font obtained with Aspose 24 and it adds doubles lines as well.

Thanks,
Andrei

@andreimoldovansnapon
could you please test if the attached sample works as desired?
22_6_withSHX.zip (736.0 KB)

@oleksii.gorokhovatskyi , thanks a lot.
It seems that Abcd123FontChanged.dxf.dxf from your zip is what we need but our application doesn’t generate this.
I’ll compare the code to see what’s different, but at a first glance it looks the same.
Will come back with news.

Regards,
Andrei

1 Like

@oleksii.gorokhovatskyi , it seems that we needed to add the absolute path to the shx file, even if it was deployed to bin.
Thanks for your support.

@andreimoldovansnapon,
glad to hear it worked :slight_smile:

1 Like