How to use the ezdxf.lldxf.tags.DXFTag function in ezdxf

To help you get started, we’ve selected a few ezdxf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozman / ezdxf / tests / test_00_dxf_low_level_structs / test_050_extended_tags.py View on Github external
def test_append_to_existing_reactors(xtags4):
    xtags4.new_app_data(ACAD_REACTORS, [DXFTag(330, 'DEAD')])
    reactors = xtags4.get_app_data_content(ACAD_REACTORS)
    reactors.append(DXFTag(330, 'DEAD2'))
    xtags4.set_app_data_content(ACAD_REACTORS, reactors)

    reactors = xtags4.get_app_data_content(ACAD_REACTORS)
    assert DXFTag(330, 'DEAD') == reactors[0]
    assert DXFTag(330, 'DEAD2') == reactors[1]
github mozman / ezdxf / ezdxf / sections / tables.py View on Github external
dxfversion = self._drawing.dxfversion
            handle = self._drawing.entitydb.get_unique_handle()
        else:  # test environment without Drawing() object
            dxfversion = 'AC1009'  # DXF R12
            handle = '0'

        if dxfversion <= 'AC1009':
            table_entities = [[
                DXFTag(0, 'TABLE'),
                DXFTag(2, name),
                DXFTag(70, 0)
            ]]
        else:
            table_entities = [[
                DXFTag(0, 'TABLE'),
                DXFTag(2, name),
                DXFTag(5, handle),
                DXFTag(330, '0'),
                DXFTag(100, 'AcDbSymbolTable'),
                DXFTag(70, 0)
            ]]
        self._new_table(name, table_entities)
github mozman / ezdxf / ezdxf / sections / tables.py View on Github external
handle = '0'

        if dxfversion <= 'AC1009':
            table_entities = [[
                DXFTag(0, 'TABLE'),
                DXFTag(2, name),
                DXFTag(70, 0)
            ]]
        else:
            table_entities = [[
                DXFTag(0, 'TABLE'),
                DXFTag(2, name),
                DXFTag(5, handle),
                DXFTag(330, '0'),
                DXFTag(100, 'AcDbSymbolTable'),
                DXFTag(70, 0)
            ]]
        self._new_table(name, table_entities)
github mozman / ezdxf / src / ezdxf / tools / complex_ltype.py View on Github external
font = drawing.styles.get_shx(self.font)  # creates new shx or returns existing entry
            else:
                try:
                    font = drawing.styles.get(self.font)  # case insensitive search for text style
                except DXFTableEntryError:
                    font = drawing.styles.new(self.font)
            return font.dxf.handle

        if drawing is not None:
            handle = get_font_handle()
        else:
            handle = 0
        tags = []
        if self.type == 'TEXT':
            tags.append(DXFTag(74, 2))
            tags.append(DXFTag(75, 0))
        else:  # SHAPE
            tags.append(DXFTag(74, 4))
            tags.append(DXFTag(75, self.value))
        tags.append(DXFTag(340, handle))
        tags.extend(self.tags)
        if self.type == 'TEXT':
            tags.append(DXFTag(9, self.value))
        return tags
github mozman / ezdxf / src / ezdxf / addons / dwg / objects.py View on Github external
def load_specific_data(self):
        super().load_specific_data()
        bs = self.data_stream
        self.dxfattribs['description'] = bs.read_text_variable()
        tags = self.pattern_tags
        pattern_length = bs.read_bit_double()
        tags.append(DXFTag(72, bs.read_unsigned_byte()))  # alignment always 'A'
        self.num_dashes = bs.read_unsigned_byte()
        tags.append(DXFTag(73, self.num_dashes))
        tags.append(DXFTag(40, pattern_length))
        for _ in range(self.num_dashes):
            pass
github mozman / ezdxf / ezdxf / legacy / viewport.py View on Github external
def dxftags(self) -> Tags:
        tags = [
            DXFTag(1001, 'ACAD'),
            DXFTag(1000, 'MVIEW'),
            DXFTag(1002, '{', ),
            DXFTag(1070, 16),  # extended data version, always 16 for R11/12
            DXFTag(1010, self.view_target_point),
            DXFTag(1010, self.view_direction_vector),
            DXFTag(1040, self.view_twist_angle),
            DXFTag(1040, self.view_height),
            DXFTag(1040, self.view_center_point[0]),
            DXFTag(1040, self.view_center_point[1],),
            DXFTag(1040, self.perspective_lens_length),
            DXFTag(1040, self.front_clip_plane_z_value),
            DXFTag(1040, self.back_clip_plane_z_value),
            DXFTag(1070, self.view_mode),
            DXFTag(1070, self.circle_zoom),
            DXFTag(1070, self.fast_zoom),
            DXFTag(1070, self.ucs_icon),
            DXFTag(1070, self.snap),
            DXFTag(1070, self.grid),
            DXFTag(1070, self.snap_style),
            DXFTag(1070, self.snap_isopair),
github mozman / ezdxf / src / ezdxf / sections / header.py View on Github external
def default_vars() -> OrderedDict:
    vars = OrderedDict()
    for vardef in HEADER_VAR_MAP.values():
        vars[vardef.name] = HeaderVar(DXFTag(vardef.code, vardef.default))
    return vars
github mozman / ezdxf / src / ezdxf / tools / complex_ltype.py View on Github external
try:
                    font = drawing.styles.get(self.font)  # case insensitive search for text style
                except DXFTableEntryError:
                    font = drawing.styles.new(self.font)
            return font.dxf.handle

        if drawing is not None:
            handle = get_font_handle()
        else:
            handle = 0
        tags = []
        if self.type == 'TEXT':
            tags.append(DXFTag(74, 2))
            tags.append(DXFTag(75, 0))
        else:  # SHAPE
            tags.append(DXFTag(74, 4))
            tags.append(DXFTag(75, self.value))
        tags.append(DXFTag(340, handle))
        tags.extend(self.tags)
        if self.type == 'TEXT':
            tags.append(DXFTag(9, self.value))
        return tags
github mozman / ezdxf / ezdxf / modern / mtext.py View on Github external
def set_text(self, text: str) -> 'MText':
        tags = self.tags.get_subclass('AcDbMText')
        tags.remove_tags(codes=(1, 3))
        str_chunks = split_string_in_chunks(text, size=250)
        if len(str_chunks) == 0:
            str_chunks.append("")
        while len(str_chunks) > 1:
            tags.append(DXFTag(3, str_chunks.pop(0)))
        tags.append(DXFTag(1, str_chunks[0]))
        return self
github mozman / ezdxf / src / ezdxf / tools / complex_ltype.py View on Github external
if self.type == 'SHAPE':
                font = drawing.styles.get_shx(self.font)  # creates new shx or returns existing entry
            else:
                try:
                    font = drawing.styles.get(self.font)  # case insensitive search for text style
                except DXFTableEntryError:
                    font = drawing.styles.new(self.font)
            return font.dxf.handle

        if drawing is not None:
            handle = get_font_handle()
        else:
            handle = 0
        tags = []
        if self.type == 'TEXT':
            tags.append(DXFTag(74, 2))
            tags.append(DXFTag(75, 0))
        else:  # SHAPE
            tags.append(DXFTag(74, 4))
            tags.append(DXFTag(75, self.value))
        tags.append(DXFTag(340, handle))
        tags.extend(self.tags)
        if self.type == 'TEXT':
            tags.append(DXFTag(9, self.value))
        return tags