How I can create Object3d format from dxf-file?

Hi everyone, I want to create the 3d application with three.js. I want to give an opportunity for users to save and viewing dxf file in website. I have a problem when I try to convert dxf file by dxf-parser and display by method scene.add I have an error that I have the wrong format, the object is not object3d. How I can correctly convert my dxf file to object3d?
before that, I use Three-Dxf to display this file, but it was just in 2d.

Are you talking about this npm module?

Besides, any chances to demonstrate the issue with a live example? When the mentioned error message occurs, it means you pass an invalid object to scene.add(). If you think it’s a problem by the npm module, it’s probably best to file an issue at the respective github repo.

I think the module is work correctly. I don’t know how I can fix this error. what I must to do?
I send the query to our back-end and it returns dxf file, after that, I use this module and try to add to the scene and I have an error that I try set to scene the wrong format.

Is it possible to display the dxf-file in 3D?

What happens if you log the object you want to add to the scene via console.log()?

const parser = new DxfParser();
const dxf = parser1.parseSync(data);

where data is my dxf file and I get

THREE.Object3D.add: object not an instance of THREE.Object3D. {header: {…}, tables: {…}, blocks: {…}, entities: Array(1399)}


give me an object

blocks: {},
entities: [],
header: {},
tables: {}

link to my dxf in google drive

And please check fiddle link

It seems I have no permission to download your DXF file…

Since your dxf variable is not of type Object3D, your current code is not valid. The official github page of the npm module promotes this:

// See index.js in the sample for more details
var parser = new DxfParser();
var dxf = parser.parseSync( data );
cadCanvas = new ThreeDxf.Viewer(dxf, document.getElementById('cad-view'), 400, 400);

As you can see, dxf is added to a special class of the package. Have you considered to use this approach in your project?

update link with permission

Sure I’m considered this in my project but it just creates svg variant display in 2d without 3d

Um, dxf-parser.min.js reports an error in the fiddle:

Cannot read dxf source of type `object

It seems you can not just use the file by doing this:

var file = e.srcElement.files[0];

Try it with the File API instead:

Yeah, it’s just a draft variant in client side I use Angular so I have another logic and I haven’t this error

What can you advise in order to solve my problem?

Sorry, I’m not familiar with three-dxf. I suggest you open an issue here:

Thanks for this

Anybody Solved this problem, I want to parse and show the result in scene.
I have 2D DXF file.