解释 File "C:\Users\zzl\PycharmProjects\pythonProject\main.py", line 34, in <module> random_triangle(msp) File "C:\Users\zzl\PycharmProjects\pythonProject\main.py", line 21, in random_triangle dw.add_lwpolyline([p1, p2, p3, p1], dxfattribs={'color': 1, 'layer': 'Triangles', 'closed': True, 'fill': color, 'fill_opacity': 0.5}) File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\graphicsfactory.py", line 631, in add_lwpolyline lwpolyline: LWPolyline = self.new_entity("LWPOLYLINE", dxfattribs) # type: ignore File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\graphicsfactory.py", line 105, in new_entity entity = factory.create_db_entry(type_, dxfattribs, self.doc) File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\entities\factory.py", line 63, in create_db_entry entity = new(dxftype=dxftype, dxfattribs=dxfattribs) File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\entities\factory.py", line 53, in new entity = cls(dxftype).new( File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\entities\dxfentity.py", line 166, in new entity.update_dxf_attribs(attribs) File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\entities\dxfentity.py", line 448, in update_dxf_attribs setter(key, value) File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\entities\dxfns.py", line 230, in set self.__setattr__(key, value) File "C:\Users\zzl\Desktop\xxtest\lib\site-packages\ezdxf\entities\dxfns.py", line 174, in __setattr__ raise const.DXFAttributeError( ezdxf.lldxf.const.DXFAttributeError: Invalid DXF attribute "fill" for entity LWPOLYLINE
时间: 2023-07-12 18:59:00 浏览: 88
Python库 | light1_zzl-0.0.3-py3-none-any.whl
这个错误是因为在创建 LWPolyline 对象时,传递的 dxfattribs 参数中包含了一个无效的属性 "fill"。LWPolyline 对象没有 "fill" 属性,因此会抛出 DXFAttributeError 异常。你需要检查代码中传递的 dxfattribs 参数,确保它包含 LWPolyline 对象支持的有效属性。
阅读全文