예제 #1
0
 def test_init(self):
     rect = Rectangle(insert=(0, 0),
                      width=5,
                      height=3,
                      rotation=45,
                      halign=dxfwrite.CENTER,
                      valign=dxfwrite.MIDDLE,
                      color=2,
                      bgcolor=3,
                      layer='RECTANGLE',
                      linetype="DASHED")
     dxf = dxfstr(rect)
     self.assertTrue("DASHED" in dxf)
     self.assertTrue("RECTANGLE" in dxf)
예제 #2
0
파일: test_rectangle.py 프로젝트: msarch/py
 def test_components(self):
     expected = "  0\nPOLYLINE\n 62\n256\n  8\nRECTANGLE\n 66\n1\n 10\n"\
              "0.0\n 20\n0.0\n 30\n0.0\n 70\n9\n  0\nVERTEX\n  8\n0\n 10\n"\
              "0.0\n 20\n0.0\n 30\n0.0\n  0\nVERTEX\n  8\n0\n 10\n"\
              "3.53553390593\n 20\n3.53553390593\n 30\n0.0\n  0\nVERTEX\n"\
              "  8\n0\n 10\n1.41421356237\n 20\n5.65685424949\n 30\n0.0\n"\
              "  0\nVERTEX\n  8\n0\n 10\n-2.12132034356\n 20\n2.12132034356\n"\
              " 30\n0.0\n  0\nSEQEND\n  0\nSOLID\n 62\n3\n  8\nRECTANGLE\n"\
              " 10\n0.0\n 20\n0.0\n 30\n0.0\n 11\n3.53553390593\n 21\n"\
              "3.53553390593\n 31\n0.0\n 13\n1.41421356237\n 23\n"\
              "5.65685424949\n 33\n0.0\n 12\n-2.12132034356\n 22\n"\
              "2.12132034356\n 32\n0.0\n"
     rectangle = Rectangle((0, 0), 5, 3,
                           rotation=45,
                           bgcolor=3,
                           layer='RECTANGLE')
     self.assertSequenceEqual(normalize_dxf_chunk(dxfstr(rectangle)), normalize_dxf_chunk(expected))
예제 #3
0
    def rectangle(insert, width, height, **kwargs):
        """ 2D Rectangle, build with a polyline and a solid as background filling

        :param point insert: where to place the rectangle
        :param float width: width in drawing units
        :param float height: height in drawing units
        :param float rotation: in degree (circle = 360 degree)
        :param int halign: **LEFT**, **CENTER**, **RIGHT**
        :param int valign: **TOP**, **MIDDLE**, **BOTTOM**
        :param int color: dxf color index, default is **BYLAYER**, if color is None, no
             polyline will be created, and the rectangle consist only of the
             background filling (if bgcolor != `None`)
        :param int bgcolor: dxf color index, default is `None` (no background filling)
        :param str layer: target layer, default is ``'0'``
        :param str linetype: linetype name, None = **BYLAYER**

        """
        return Rectangle(insert, width, height, **kwargs)