Load a .dxf file runtime


I would like to load a .dxf file at runtime. I know that Unity only support meshes for the dxf files. But when I load a file like this it doesnt work.

    GameObject myObject = new GameObject("DfxObject");
    MeshFilter wMeshFilter = myObject.AddComponent<MeshFilter>();
    Renderer wRenderer = myObject.AddComponent<MeshRenderer>();
    Mesh myMesh = (Mesh)Resources.Load("AutoCad2000.dxf");          
    wMeshFilter.mesh = myMesh;    

// (AutoCad2000.dxf is in the ressources folder)

In this code the mesh is null and if I load it directly as a GameObject, it’s the same thing. What I’m doing wrong or what is the good way to load that kind of file.

Thank you in advance


You’d have to write a .dxf importer. There is no Resources folder in a build (all resources are compiled into files per level), and there is no built-in way of loading arbitrary mesh files at runtime.