Aspose.CAD Can not convert specific ifc file

I’m trying to convert an ifc file to a PNG, but I get the following error:

Aspose.CAD.CadExceptions.ImageLoadException: Drawing loading failed: Unexpected character '\"' at [769:32]\n ---> Aspose.CAD.FileFormats.Stp.Reader.StepReadException: Unexpected character '\"' at [769:32]\n   at #=zd_TOMrciFU5dfhPZOg$4x2yqF7FWXyePhiKRWEw=.#=zwt1QFO5k94x6uXgWig==.MoveNext()\n   at #=zgJebeoqFRepQNSFJICTRG7wRnU4tyoicUowEPg0=.#=zVlI_Alo=()\n   at #=zgJebeoqFRepQNSFJICTRG7wRnU4tyoicUowEPg0=.#=zPQzM7h0YOFB5()\n   at #=zgJebeoqFRepQNSFJICTRG7wRnU4tyoicUowEPg0=.#=zgL4n4NOJVQBh()\n   at #=zgJebeoqFRepQNSFJICTRG7wRnU4tyoicUowEPg0=.#=zrGQwtDYtd4w9()\n   at #=zgJebeoqFRepQNSFJICTRG7wRnU4tyoicUowEPg0=.#=z24kioLPKHDMI()\n   at #=zgJebeoqFRepQNSFJICTRG7wRnU4tyoicUowEPg0=.#=zomGFYI8EDEIe()\n   at #=z6KpLY_Uqq8qr2$NjclnyvZ8NuLvroNSMVktlCtg=.#=z$bmnRrU=()\n   at #=zDCCdFW87SSZ7PaGLW28nr1km1x93X7108_a3GbM=.#=zMMkMAo0=(StreamContainer #=zmbALnihbDsrM, LoadOptions #=zEoGjoEF7DIzu)\n   at Aspose.CAD.Image.#=zyFePX9YP1$fm(StreamContainer #=zmbALnihbDsrM, LoadOptions #=zEoGjoEF7DIzu)\n   --- End of inner exception stack trace ---\n   at Aspose.CAD.Image.#=zyFePX9YP1$fm(StreamContainer #=zmbALnihbDsrM, LoadOptions #=zEoGjoEF7DIzu)\n   at Aspose.CAD.Image.Load(Stream stream, LoadOptions loadOptions)\n   at Aspose.CAD.Image.Load(Stream stream)

I’m using the following code to convert the ifc file:

var image = Image.Load(input.Stream);
await image.SaveAsync(outputStream, new PngOptions
{
    ResolutionSettings = new ResolutionSetting(image.Height, image.Width), 
    VectorRasterizationOptions = new CadRasterizationOptions
    {
        DrawType = CadDrawTypeMode.UseObjectColor
    }, 
    CancellationToken = cancellationToken,
});

This is the ifc file that I’m trying to convert:
ifc.7z (6.5 KB)

@TobiasNissen,
Hi.
We have created CADNET-9689 to fix this issue.

@TobiasNissen,
Hello.
Hi.
Unfortunately, this file has IFC 2.0 file format. We don’t have support for it and the documentation is not also available. We will fix the issue with exception, so the proper one will be thrown in next version for such cases. The best option is to resave this file to more recent IFC format, we have support for IFC 2.3 and 4.0.

@oleksii.gorokhovatskyi Thanks for looking into this and getting back with a response :slight_smile:

1 Like