Closed machine-w closed 4 months ago
import ezdxf doc = ezdxf.new('R2010') msp = doc.modelspace() mesh = msp.add_polyface() 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), ] for vertex in vertices: mesh.append_vertex(vertex) faces = [ [1, 2, 3, 4], [5, 6, 7, 8], [1, 2, 6, 5], [2, 3, 7, 6], [3, 4, 8, 7], [4, 1, 5, 8], ] for face in faces: mesh.append_face(face) doc.saveas("polyface_mesh_example.dxf") print("DXF file created successfully.") ` throw error : ` Traceback (most recent call last): File "/Users/machine/myworkspace/oper_dxf/ref/savedxf.py", line 38, in <module> mesh.append_face(face) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/polyline.py", line 610, in append_face self.append_faces([face], dxfattribs) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/polyline.py", line 655, in append_faces face_mesh_vertices = self._points_to_dxf_vertices(face, {}) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/polyline.py", line 630, in _points_to_dxf_vertices cast("DXFVertex", self._new_compound_entity("VERTEX", dxfattribs)) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/dxfgfx.py", line 630, in _new_compound_entity entity = factory.create_db_entry(type_, dxfattribs, self.doc) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/factory.py", line 63, in create_db_entry entity = new(dxftype=dxftype, dxfattribs=dxfattribs) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/factory.py", line 53, in new entity = cls(dxftype).new( File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/dxfentity.py", line 166, in new entity.update_dxf_attribs(attribs) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/dxfentity.py", line 448, in update_dxf_attribs setter(key, value) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/dxfns.py", line 230, in set self.__setattr__(key, value) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/dxfns.py", line 172, in __setattr__ self.__dict__[key] = check(value) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/entities/dxfns.py", line 152, in check value = cast_value(attrib_def.code, value) File "/Users/machine/.pyenv/versions/oper_dxf/lib/python3.10/site-packages/ezdxf/lldxf/types.py", line 435, in cast_value return Vec3(value) File "src/ezdxf/acc/vector.pyx", line 417, in ezdxf.acc.vector.Vec3.__cinit__ TypeError: object of type 'int' has no len()