DXF import problems

DXF import problems

Anonymous
Not applicable
1,151 Views
4 Replies
Message 1 of 5

DXF import problems

Anonymous
Not applicable

Using the FBX SDK, we have a problem importing DXF files.

 

For some files, it's possible to have one mesh where its face order is flipped, so we see the inside of that mesh. But the other imported meshes are perfectly fine. Is there an easy work around this? We use the same code also to import FBX and everything is fine.

0 Likes
1,152 Views
4 Replies
Replies (4)
Message 2 of 5

regalir
Autodesk
Autodesk

You can try to call FbxMesh::CheckIfVertexNormalsCCW() on all the meshes and when this function returns false, you then know that the polygon winding is reversed and you need to re-calculate the normals to follow the correct CW/CCW order. This, of course can work if all the faces are following the same order. Unfortunately, if only some faces of the mesh are "flipped", the FBX SDK does not provide any functionality to fix them and you will have to code it yourself.

0 Likes
Message 3 of 5

Anonymous
Not applicable

The way I understand it, DXF doesn't have normals, so what would happen in that case?

 

Actually, in the problematic file that we have, the only normal info we have in the file is this:

Normal
350

And not really sure what that means.

 

So, without normals to show in which direction the face should really be, it there a way to detect those?

 

We could import them and specify them as double-sided, but we would like to avoid this solution because it might cause problems for a lot of deformation, like extrude, that goes in the face's direction.

0 Likes
Message 4 of 5

regalir
Autodesk
Autodesk

Well, I was talking about FbxMesh objects. So, basically it would be a post process after the DXF file is read and converted to FBX. If normals don't exist in the FbxMesh, you can call GenerateNormals(...) to create them. But after re-reading your original post ("But the other imported meshes are perfectly fine."), I believe that the problem may not be in the orientation of the faces but, most likely, by "holes" caused by rejected polygons (the same vertex defined twice, or more times, for the given face). If you can, you should check the integrity of the DXF files and clean them before converting to FBX.

 

It may also be possible that your DXF files contains data that is not supported by the FBX SDK's DXF reader. If this is the case, unfortunately, there is not much that can be done.

0 Likes
Message 5 of 5

Anonymous
Not applicable

I suspect that it's the invalid mesh!

 

It's weird that someone would model one mesh in a file that has faces facing backward.

 

Our guess is that the visualizer used always shows double-sided faces, so it's hard for the users to know if they made a mistake like that or not.

Could also be that DXF is supposed to be double-sided by default, so we could try listing the faces onces more, in the other direction to get the right list.

0 Likes