This is my first time posting here. I am making 3D models of houses using python and I would like to visualise the output using FreeCAD. I found the ezdxf interface (https://pypi.org/project/ezdxf/) which writes to dxf format and I ran the below code (this is one of the examples provided there)
import ezdxf
# 8 corner vertices
cube_vertices = [
(0, 0, 0),
(1, 0, 0),
(1, 1, 0),
(0, 1, 0),
(0, 0, 1),
(1, 0, 1),
(1, 1, 1),
(0, 1, 1),
]
# 6 cube faces
cube_faces = [
[0, 1, 2, 3],
[4, 5, 6, 7],
[0, 1, 5, 4],
[1, 2, 6, 5],
[3, 2, 6, 7],
[0, 3, 7, 4]
]
doc = ezdxf.new('R2000') # MESH requires DXF R2000 or later
msp = doc.modelspace()
mesh = msp.add_mesh()
mesh.dxf.subdivision_levels = 0 # do not subdivide cube, 0 is the default value
with mesh.edit_data() as mesh_data:
mesh_data.vertices = cube_vertices
mesh_data.faces = cube_faces
doc.saveas("cube_mesh.dxf")
However, when I open the output in FreeCAD nothing is displayed. Freecad doesn't display mesh Perhaps I am making a simple error. FreeCAD is totally new to me so maybe I have to enable something in FreeCAD before I can see the mesh. I could draw each of the edges by drawing lines between vertices but I would prefer to input vertices and faces and draw the mesh that way. Can anyone tell me what I am doing wrong or another way to do what I am trying to do, export meshes from python and open them in FreeCad. Thanks for you help