예제 #1
0
    def mtext(num):
        height = 1.0
        width = 1.0
        p1 = Vector(0, 0, 0)

        t = MText.new(dxfattribs={
            'char_height': height,
            'width': width,
            'text_direction': (1, 0, 0),
            'attachment_point': 7,
            'layer': 'text',
        },
                      doc=doc)
        t.text = content.format(num)
        tlen = height * len(t.text) * width
        p2 = p1.replace(x=tlen)
        p3 = p2.replace(y=height)
        p4 = p1.replace(y=height)
        v = [p1, p2, p3, p4, p3.lerp(p4), p2.lerp(p3)]
        return t, v
    def mtext(num):
        height = 1.0
        width = 1.0
        p1 = Vec3(0, 0, 0)

        t = MText.new(
            dxfattribs={
                "char_height": height,
                "width": width,
                "text_direction": (1, 0, 0),
                "attachment_point": 7,
                "layer": "text",
            },
            doc=doc,
        )
        t.text = content.format(num)
        tlen = height * len(t.text) * width
        p2 = p1.replace(x=tlen)
        p3 = p2.replace(y=height)
        p4 = p1.replace(y=height)
        v = [p1, p2, p3, p4, p3.lerp(p4), p2.lerp(p3)]
        return t, v
예제 #3
0
 def entities(self):
     return EntityQuery([
         MText.new(
             dxfattribs={"text": "content"}),  # virtual text attribute
         Text.new(dxfattribs={"text": "content"})
     ])
예제 #4
0
 def test_set_mtext(self):
     attrib = Attrib.new(dxfattribs={"color": 3, "text": "TEST"})
     mtext = MText.new(dxfattribs={"color": 3})
     mtext.text = "LINE1\nLINE2"
     attrib.set_mtext(mtext)
     assert attrib.has_embedded_mtext_entity is True