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
def entities(self): return EntityQuery([ MText.new( dxfattribs={"text": "content"}), # virtual text attribute Text.new(dxfattribs={"text": "content"}) ])
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