def test_polymesh(self): mesh = Polymesh(2, 2) mesh.set_vertex(0, 0, (1, 1, 0)) vt1 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n1.0\n 30\n0.0\n 70\n64\n" mesh.set_vertex(0, 1, (2, 1, 0)) vt2 = " 0\nVERTEX\n 8\n0\n 10\n2.0\n 20\n1.0\n 30\n0.0\n 70\n64\n" mesh.set_vertex(1, 0, (1, 2, 0)) vt3 = " 0\nVERTEX\n 8\n0\n 10\n1.0\n 20\n2.0\n 30\n0.0\n 70\n64\n" mesh.set_vertex(1, 1, (2, 2, 0)) vt4 = " 0\nVERTEX\n 8\n0\n 10\n2.0\n 20\n2.0\n 30\n0.0\n 70\n64\n" expected = " 0\nPOLYLINE\n 8\n0\n 66\n1\n" \ " 70\n16\n 71\n2\n 72\n2\n" + vt1 + vt2 + vt3 + vt4 + " 0\nSEQEND\n" self.assertEqual(dxfstr(mesh), expected)
def test_set_nclosed(self): mesh = Polymesh(2, 2) mesh.set_nclosed(True) self.assertTrue(mesh['flags'] & const.POLYLINE_MESH_CLOSED_N_DIRECTION) mesh.set_nclosed(False) self.assertFalse(mesh['flags'] & const.POLYLINE_MESH_CLOSED_N_DIRECTION)
def polymesh(nrows, ncols, **kwargs): """ Create a new polymesh entity. nrows and ncols >=2 and <= 256, greater meshes have to be divided into smaller meshes. The flags-bit **POLYLINE_3D_POLYMESH** is set. :param int nrows: count of vertices in m-direction, nrows >=2 and <= 256 :param int ncols: count of vertices in n-direction, ncols >=2 and <= 256 """ return Polymesh(nrows, ncols, **kwargs)