示例#1
0
    def linepattern(pattern):
        """ Create a :ref:`Linepattern` object from pattern-list.

        example linepattern([2.0, -0.25, 0, -0.25, 0.25, -0.25]), for format
        description see :ref:`Linepattern`.
        """
        return Linetype.make_line_pattern_definition(pattern)
示例#2
0
    def linetype(name, **kwargs):
        """ Create a new linetype.

        :param str name: linetype name
        :param int flags: standard flag values, bit-coded, default=0
        :param str description: descriptive text for linetype, default=""
        :param pattern: :ref:`LinePatternDef`, line pattern definition, see method
                   DXFEngine.linepattern()

        """
        return Linetype(name, **kwargs)
示例#3
0
class TestLinetypeTableEntry(unittest.TestCase):
    pattern = Linetype.make_line_pattern_definition([0.6, 0.5, -0.1])
    expected = "  0\nLTYPE\n  2\nDASHED\n 70\n0\n  3\nstrichliert\n%s" % dxfstr(
        pattern)

    def test_linepattern(self):
        expected = " 72\n65\n 73\n2\n 40\n0.6\n" \
                   " 49\n0.5\n 49\n-0.1\n"
        self.assertEqual(dxfstr(self.pattern), expected)

    def test_create_table_entry(self):
        ltype = Linetype('DASHED',
                         description="strichliert",
                         pattern=self.pattern)

        self.assertEqual(dxfstr(ltype), self.expected)

    def test_create_table_entry_by_factory(self):
        ltype = DXFEngine.linetype('DASHED',
                                   description="strichliert",
                                   pattern=self.pattern)

        self.assertEqual(dxfstr(ltype), self.expected)
示例#4
0
    def test_create_table_entry(self):
        ltype = Linetype('DASHED',
                         description="strichliert",
                         pattern=self.pattern)

        self.assertEqual(dxfstr(ltype), self.expected)