How to use the ezdxf.modern.graphics.DXFAttr 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 / ezdxf / modern / mleader.py View on Github external
'landing_gap': DXFAttr(42),
    'enable_dog_leg': DXFAttr(291),
    'dog_leg_length': DXFAttr(43),
    'name': DXFAttr(3),
    'arrow_head_id': DXFAttr(341),
    'arrow_head_size': DXFAttr(44),
    'default_mtext_contents': DXFAttr(300),
    'mtext_style_id': DXFAttr(342),
    'text_left_attachment_type': DXFAttr(174),
    'text_angle_type': DXFAttr(175),
    'text_right_attachment_type': DXFAttr(178),
    'text_color': DXFAttr(93),
    'text_height': DXFAttr(45),
    'enable_frame_text': DXFAttr(292),
    'text_align_always_left': DXFAttr(297),
    'align_space': DXFAttr(46),
    'enable_block_content_scale': DXFAttr(293),
    'block_content_id': DXFAttr(343),
    'block_content_color': DXFAttr(94),
    'block_content_scale_x': DXFAttr(47),
    'block_content_scale_y': DXFAttr(49),
    'block_content_scale_z': DXFAttr(140),
    'enable_block_content_rotation': DXFAttr(294),
    'block_content_rotation': DXFAttr(141),
    'block_content_connection_type': DXFAttr(177),
    'scale': DXFAttr(142),
    'overwrite_property_value': DXFAttr(295),
    'is_annotative': DXFAttr(296),
    'break_gap_size': DXFAttr(143),
    'mtext_attachment_direction': DXFAttr(271),  # 0 = Horizontal; 1 = Vertical
    'bottom_text_attachment_direction': DXFAttr(272),  # 9 = Center; 10 = Underline and Center
    'top_text_attachment_direction': DXFAttr(272),  # 9 = Center; 10 = Overline and Center
github mozman / ezdxf / ezdxf / modern / text.py View on Github external
0
"""
text_subclass = (
    DefSubclass('AcDbText', {
        'insert': DXFAttr(10, xtype=XType.any_point),
        'height': DXFAttr(40),
        'text': DXFAttr(1),
        'rotation': DXFAttr(50, default=0.0),  # in degrees (circle = 360deg)
        'oblique': DXFAttr(51, default=0.0),  # in degrees, vertical = 0deg
        'style': DXFAttr(7, default='STANDARD'),  # text style
        'width': DXFAttr(41, default=1.0),  # width FACTOR!
        'text_generation_flag': DXFAttr(71, default=0),  # 2 = backward (mirror-x), 4 = upside down (mirror-y)
        'halign': DXFAttr(72, default=0),  # horizontal justification
        'align_point': DXFAttr(11, xtype=XType.any_point),
        'thickness': DXFAttr(39, default=0.0),
        'extrusion': DXFAttr(210, xtype=XType.point3d, default=(0.0, 0.0, 1.0)),
    }),
    DefSubclass('AcDbText', {'valign': DXFAttr(73, default=0)}))


class Text(text.Text, ModernGraphicEntityExtension):
    __slots__ = ()
    TEMPLATE = ExtendedTags.from_text(_TEXT_TPL)
    DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, *text_subclass)
github mozman / ezdxf / ezdxf / modern / acad_table.py View on Github external
block_reference_subclass = DefSubclass('AcDbBlockReference', {
    'block_name': DXFAttr(2),  # Block name; an anonymous block begins with a *T value
    'insert': DXFAttr(10, xtype=XType.point3d),  # Insertion point
})

table_subclass = DefSubclass('AcDbTable', {
    'version': DXFAttr(280),  # Table data version number: 0 = 2010
    'table_style_id': DXFAttr(342),  # Hard pointer ID of the TABLESTYLE object
    'block_record': DXFAttr(343),  # Hard pointer ID of the owning BLOCK record
    'horizontal_direction': DXFAttr(11),  # Horizontal direction vector
    'table_value': DXFAttr(90),  # Flag for table value (unsigned integer)
    'n_rows': DXFAttr(91),  # Number of rows
    'n_cols': DXFAttr(92),  # Number of columns
    'override_flag': DXFAttr(93),  # Flag for an override
    'border_color_override_flag': DXFAttr(94),  # Flag for an override of border color
    'border_lineweight_override_flag': DXFAttr(95),  # Flag for an override of border lineweight
    'border_visibility_override_flag': DXFAttr(96),  # Flag for an override of border visibility
    # 141: Row height; this value is repeated, 1 value per row
    # 142: Column height; this value is repeated, 1 value per column
    # for every cell:
    #      171: Cell type; this value is repeated, 1 value per cell:
    #           1 = text type
    #           2 = block type
    #      172: Cell flag value; this value is repeated, 1 value per cell
    #      173: Cell merged value; this value is repeated, 1 value per cell
    #      174: Boolean flag indicating if the autofit option is set for the cell; this value is repeated, 1 value per cell
    #      175: Cell border width (applicable only for merged cells); this value is repeated, 1 value per cell
    #      176: Cell border height (applicable for merged cells); this value is repeated, 1 value per cell
    #       91: Cell override flag; this value is repeated, 1 value per cell (from AutoCAD 2007)
    #      178: Flag value for a virtual edge
    #      145: Rotation value (real; applicable for a block-type cell and a text-type cell)
    #      344: Hard pointer ID of the FIELD object. This applies only to a text-type cell. If the text in the cell
github mozman / ezdxf / ezdxf / modern / polyline.py View on Github external
70
0
10
0.0
20
0.0
30
0.0
"""

polyline_subclass = DefSubclass('AcDb2dPolyline', {
    'elevation': DXFAttr(10, xtype=XType.point3d),
    'flags': DXFAttr(70, default=0),
    'default_start_width': DXFAttr(40, default=0.0),
    'default_end_width': DXFAttr(41, default=0.0),
    'm_count': DXFAttr(71, default=0),
    'n_count': DXFAttr(72, default=0),
    'm_smooth_density': DXFAttr(73, default=0),
    'n_smooth_density': DXFAttr(74, default=0),
    'smooth_type': DXFAttr(75, default=0),
    'thickness': DXFAttr(39, default=0.0),
    'extrusion': DXFAttr(210, xtype=XType.point3d, default=(0.0, 0.0, 1.0)),
})


class Polyline(polyline.Polyline, ModernGraphicEntityExtension):
    __slots__ = ()
    TEMPLATE = ExtendedTags.from_text(_POLYLINE_TPL)
    DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, polyline_subclass)

    def post_new_hook(self) -> None:
        super(Polyline, self).post_new_hook()
github mozman / ezdxf / ezdxf / modern / lwpolyline.py View on Github external
70
0
43
0.0
"""

# Order doesn't matter, not valid for AutoCAD:
# If tag 90 is not the first TAG, AutoCAD does not close the polyline when the `close` flag is set.
lwpolyline_subclass = DefSubclass('AcDbPolyline', {
    'count': DXFAttr(90, xtype=XType.callback, getter='__len__', setter='_set_count'),
    # always return actual length and set tag 90
    '_count': DXFAttr(90),  # special attribute to update length
    'elevation': DXFAttr(38, default=0.0),
    'thickness': DXFAttr(39, default=0.0),
    'flags': DXFAttr(70, default=0),
    'const_width': DXFAttr(43, default=0.0),
    'extrusion': DXFAttr(210, xtype=XType.point3d, default=(0.0, 0.0, 1.0)),
})

LWPOINTCODES = (10, 20, 40, 41, 42)


class LWPolylinePoints(VertexArray):
    code = -10  # compatible with DXFTag.code
    VERTEX_CODE = 10
    START_WIDTH_CODE = 40
    END_WIDTH_CODE = 41
    BULGE_CODE = 42
    VERTEX_SIZE = 5
    __slots__ = ('value',)

    @classmethod
github mozman / ezdxf / ezdxf / modern / leader.py View on Github external
210
0.0
220
0.0
230
1.0
213
0.0
223
0.0
233
0.0
"""

leader_subclass = DefSubclass('AcDbLeader', {
    'dimstyle': DXFAttr(3),  # Dimension style name
    'has_arrowhead': DXFAttr(71),  # Arrowhead flag: 0/1 = no/yes
    'path_type': DXFAttr(72),  # Leader path type: 0 = Straight line segments; 1 = Spline
    'annotation_type': DXFAttr(73, default=3),  # Leader creation flag:
    # 0= Created with text annotation
    # 1 = Created with tolerance annotation;
    # 2 = Created with block reference annotation
    # 3 = Created without any annotation
    'hookline_direction': DXFAttr(74),  # Hookline direction flag:
    # 0 = Hookline (or end of tangent for a splined leader) is the opposite direction from the horizontal vector
    # 1 = Hookline (or end of tangent for a splined leader) is the same direction as horizontal vector (see code 75)
    'has_hookline': DXFAttr(75),  # Hookline flag: 0/1 = no/yes
    'text_height': DXFAttr(40),  # Text annotation height
    'text_width': DXFAttr(41),  # Text annotation width
    'n_vertices': DXFAttr(76),  # Number of vertices in leader (ignored for OPEN)
    # 10, 20, 30 - Vertex coordinates (one entry for each vertex)
    'block_color': DXFAttr(76),  # Color to use if leader's DIMCLRD = BYBLOCK
github mozman / ezdxf / ezdxf / modern / surface.py View on Github external
lofted_surface_subclass = DefSubclass('AcDbLoftedSurface', {
    # 16x group code 40: Transform matrix of loft entity (16 floats; row major format; default = identity matrix)
    'plane_normal_lofting_type': DXFAttr(70),
    'start_draft_angle': DXFAttr(41, default=0.),  # in radians
    'end_draft_angle': DXFAttr(42, default=0.),  # in radians
    'start_draft_magnitude': DXFAttr(43, default=0.),
    'end_draft_magnitude': DXFAttr(44, default=0.),
    'arc_length_parameterization': DXFAttr(290, default=0),  # true/false
    'no_twist': DXFAttr(291, default=1),  # true/false
    'align_direction': DXFAttr(292, default=1),  # true/false
    'simple_surfaces': DXFAttr(293, default=1),  # true/false
    'closed_surfaces': DXFAttr(294, default=0),  # true/false
    'solid': DXFAttr(295, default=0),  # true/false
    'ruled_surface': DXFAttr(296, default=0),  # true/false
    'virtual_guide': DXFAttr(297, default=0),  # true/false
})


class LoftedSurface(Surface):
    __slots__ = ()
    TEMPLATE = ExtendedTags.from_text(_LOFTEDSURFACE_TPL)
    CLASS = (
        ExtendedTags.from_text(_LOFTEDSURFACE_CLS),
        ExtendedTags.from_text(_ACDBASSOCLOFTEDSURFACEACTIONBODY_CLS),
    )
    DXFATTRIBS = DXFAttributes(
        none_subclass,
        entity_subclass,
        modeler_geometry_subclass,
        surface_subclass,
        lofted_surface_subclass,
github mozman / ezdxf / ezdxf / modern / mleader.py View on Github external
3.75
271
0
272
9
273
9
"""

mleader_style_subclass = DefSubclass('AcDbMLeaderStyle', {
    'content_type': DXFAttr(170),
    'draw_mleader_order_type': DXFAttr(171),
    'draw_leader_order_type': DXFAttr(172),
    'max_leader_segments_points': DXFAttr(90),  # MaxLeader Segments Points
    'first_segment_angle_constraint': DXFAttr(40),  # First Segment Angle Constraint
    'second_segment_angle_constraint': DXFAttr(41),  # Second Segment Angle Constraint
    'leader_line_type': DXFAttr(173),
    'leader_line_color': DXFAttr(91),
    'leader_line_type_id': DXFAttr(340),  # handle
    'leader_line_weight': DXFAttr(92),
    'enable_landing': DXFAttr(290),
    'landing_gap': DXFAttr(42),
    'enable_dog_leg': DXFAttr(291),
    'dog_leg_length': DXFAttr(43),
    'name': DXFAttr(3),
    'arrow_head_id': DXFAttr(341),
    'arrow_head_size': DXFAttr(44),
    'default_mtext_contents': DXFAttr(300),
    'mtext_style_id': DXFAttr(342),
    'text_left_attachment_type': DXFAttr(174),
    'text_angle_type': DXFAttr(175),
    'text_right_attachment_type': DXFAttr(178),
github mozman / ezdxf / ezdxf / modern / leader.py View on Github external
0.0
"""

leader_subclass = DefSubclass('AcDbLeader', {
    'dimstyle': DXFAttr(3),  # Dimension style name
    'has_arrowhead': DXFAttr(71),  # Arrowhead flag: 0/1 = no/yes
    'path_type': DXFAttr(72),  # Leader path type: 0 = Straight line segments; 1 = Spline
    'annotation_type': DXFAttr(73, default=3),  # Leader creation flag:
    # 0= Created with text annotation
    # 1 = Created with tolerance annotation;
    # 2 = Created with block reference annotation
    # 3 = Created without any annotation
    'hookline_direction': DXFAttr(74),  # Hookline direction flag:
    # 0 = Hookline (or end of tangent for a splined leader) is the opposite direction from the horizontal vector
    # 1 = Hookline (or end of tangent for a splined leader) is the same direction as horizontal vector (see code 75)
    'has_hookline': DXFAttr(75),  # Hookline flag: 0/1 = no/yes
    'text_height': DXFAttr(40),  # Text annotation height
    'text_width': DXFAttr(41),  # Text annotation width
    'n_vertices': DXFAttr(76),  # Number of vertices in leader (ignored for OPEN)
    # 10, 20, 30 - Vertex coordinates (one entry for each vertex)
    'block_color': DXFAttr(76),  # Color to use if leader's DIMCLRD = BYBLOCK
    'annotation': DXFAttr(340),  # Hard reference to associated annotation (mtext, tolerance, or insert entity)
    'normal_vector': DXFAttr(210, xtype=XType.point3d),  # Normal vector
    'horizontal_direction': DXFAttr(211, xtype=XType.point3d),  # 'horizontal' direction for leader
    'leader_offset_block_ref': DXFAttr(212, xtype=XType.point3d),  # Offset of last leader vertex from block reference insertion point
    'leader_offset_annotation_placement': DXFAttr(213, xtype=XType.point3d),  # Offset of last leader vertex from annotation placement point
    # Xdata belonging to the application ID "ACAD" follows a leader entity if any dimension overrides have been applied
    # to this entity. See Dimension Style Overrides.
})


class Leader(ModernGraphicEntity):
github mozman / ezdxf / ezdxf / modern / surface.py View on Github external
extruded_surface_subclass = DefSubclass('AcDbExtrudedSurface', {
    'class_id': DXFAttr(90),
    'sweep_vector': DXFAttr(10, xtype=XType.point3d),
    # 16x group code 40: Transform matrix of extruded entity (16 floats; row major format; default = identity matrix)
    'draft_angle': DXFAttr(42, default=0.),  # in radians
    'draft_start_distance': DXFAttr(43, default=0.),
    'draft_end_distance': DXFAttr(44, default=0.),
    'twist_angle': DXFAttr(45, default=0.),  # in radians?
    'scale_factor': DXFAttr(48, default=0.),
    'align_angle': DXFAttr(49, default=0.),  # in radians
    # 16x group code 46: Transform matrix of sweep entity (16 floats; row major format; default = identity matrix)
    # 16x group code 47: Transform matrix of path entity (16 floats; row major format; default = identity matrix)
    'solid': DXFAttr(290, default=0),  # true/false
    'sweep_alignment_flags': DXFAttr(290, default=0),  # 0=No alignment; 1=Align sweep entity to path
    # 2=Translate sweep entity to path; 3=Translate path to sweep entity
    'align_start': DXFAttr(292, default=0),  # true/false
    'bank': DXFAttr(293, default=0),  # true/false
    'base_point_set': DXFAttr(294, default=0),  # true/false
    'sweep_entity_transform_computed': DXFAttr(295, default=0),  # true/false
    'path_entity_transform_computed': DXFAttr(296, default=0),  # true/false
    'reference_vector_for_controlling_twist': DXFAttr(11, xtype=XType.point3d),
})


class ExtrudedSurface(Surface):
    __slots__ = ()
    TEMPLATE = ExtendedTags.from_text(_EXTRUDEDSURFACE_TPL)
    CLASS = (
        ExtendedTags.from_text(_EXTRUDEDSURFACE_CLS),
        ExtendedTags.from_text(_ACDBASSOCEXTRUDEDSURFACEACTIONBODY_CLS),
    )
    DXFATTRIBS = DXFAttributes(