0

I can successfully read binary files of different extensions(fbx, blend, ifc and etc.) with assimp but if file is not binary assimp failed reading.

#include <string>

#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/Importer.hpp>

int main() {

    Assimp::Importer importer;

    std::string path = "myFile.ifc";

    const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_GenNormals);

    if (scene == nullptr 
            || scene->mFlags == AI_SCENE_FLAGS_INCOMPLETE 
            || scene->mRootNode == nullptr) {
        return false;
    }

    // ProcessNode(scene->mRootNode, scene);


    return 0;
}

I did not find any flags in docs for solving this problem. And nowhere is it said about file types.

For example, if .fbx file in ASCII format - aiScene* is just nullptr but if .ifc file in ASCII program throw exception
enter image description here

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
  • What are you trying to accomplish? C++ can read any file type. if ( aiScene == NULL) ; – Johnny Feb 08 '23 at 13:44
  • See the image at the and of the post. I passed the assimp simple .ifc file(which is not binary) and it generated this problem. Try-catch don`t catch this exception. Does Assimp can not read non-binary files? – Arkady Rudenko Feb 08 '23 at 14:17
  • I get it. I can't presently find any doc about supporting ASCII-based fbx in Assimp. If it can't, it's not alone: https://stackoverflow.com/questions/28635736/blender-fbx-import-from-ascii-format – Topological Sort Feb 08 '23 at 16:53

1 Answers1

0

The Asset-Importer-Library will detect the kind of data automatically. So when loading an IFC-File the loader will take care which kind of import much be used.

So the problem you are dealing with is not a missing ASCII-Import-Option you have forgotten.

My first guess would be that there is an issue created by your IFC-File WOuld it be possible to check it? You can create an issue-report with our issue-tracker

KimKulling
  • 2,654
  • 1
  • 15
  • 26