def test_optimize_simple_4points_polyface(self): pface = Polyface() pface.add_face([(0,0), (1,0), (1,1), (0,0)]) # 1 == 4 -> use vt1 instead of vt4 vt1 = " 0\nVERTEX\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n192\n" vt2 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n0.0\n 30\n0.0\n 70\n192\n" vt3 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n1.0\n 30\n0.0\n 70\n192\n" vtface = " 0\nVERTEX\n 62\n0\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n128\n" \ " 71\n1\n 72\n2\n 73\n3\n 74\n1\n" expected = " 0\nPOLYLINE\n 8\n0\n 66\n1\n" \ " 70\n64\n 71\n3\n 72\n1\n" + vt1 + vt2 + vt3 + vtface + " 0\nSEQEND\n" self.assertEqual(dxfstr(pface), expected)
def test_stable_order(self): pface = Polyface() pface.add_face([(0, 0), (1, 1), (1, 0)]) vt1 = " 0\nVERTEX\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n192\n" vt2 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n1.0\n 30\n0.0\n 70\n192\n" vt3 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n0.0\n 30\n0.0\n 70\n192\n" vtface = " 0\nVERTEX\n 62\n0\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n128\n" \ " 71\n1\n 72\n2\n 73\n3\n" expected = " 0\nPOLYLINE\n 8\n0\n 66\n1\n" \ " 70\n64\n 71\n3\n 72\n1\n" + vt1 + vt2 + vt3 + vtface + " 0\nSEQEND\n" self.assertEqual(dxfstr(pface), expected)
def test_stable_order(self): pface = Polyface() pface.add_face([(0,0), (1,1), (1,0)]) vt1 = " 0\nVERTEX\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n192\n" vt2 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n1.0\n 30\n0.0\n 70\n192\n" vt3 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n0.0\n 30\n0.0\n 70\n192\n" vtface = " 0\nVERTEX\n 62\n0\n 8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n128\n" \ " 71\n1\n 72\n2\n 73\n3\n" expected = " 0\nPOLYLINE\n 8\n0\n 66\n1\n" \ " 70\n64\n 71\n3\n 72\n1\n" + vt1 + vt2 + vt3 + vtface + " 0\nSEQEND\n" self.assertEqual(dxfstr(pface), expected)