MultiLeader
The MULTILEADER entity (DXF Reference) represents one or more leaders,
made up of one or more vertices (or spline fit points) and an arrowhead.
In contrast to the Leader
entity the text- or block content is part of
the MULTILEADER entity.
AutoCAD, BricsCAD and maybe other CAD applications do accept “MLEADER” as type string but they always create entities with “MULTILEADER” as type string.
Because of the complexity of the MULTILEADER entity, the usage of factory methods to create new entities by special builder classes is recommended:
add_multileader_mtext()
returns a newMultiLeaderMTextBuilder
instanceadd_multileader_block()
returns a newMultiLeaderBlockBuilder
instance
The visual design is based on an associated MLeaderStyle
,
but almost all attributes are also stored in the MULTILEADER entity itself.
The attribute MultiLeader.dxf.property_override_flags
should indicate
which MLEADERSTYLE attributes are overridden by MULTILEADER attributes,
but these flags do not always reflect the state of overridden attributes.
The ezdxf MULTILEADER renderer uses always the attributes from
the MULTILEADER entity and ignores the override flags.
All vertices are WCS coordinates, even those for BLOCK entities which are OCS coordinates for regular usage.
See also
Subclass of |
|
DXF type |
|
Factory functions |
|
Inherited DXF attributes |
|
Required DXF version |
DXF R2000 ( |
- class ezdxf.entities.MultiLeader
- dxf.arrow_head_handle
handle of the arrow head, see also
ezdxf.render.arrows
module, “closed filled” arrow if not set
- dxf.arrow_head_size
arrow head size in drawing units
- dxf.block_connection_type
0
center extents
1
insertion point
- dxf.block_record_handle
handle to block record of the BLOCK content
- dxf.block_rotation
BLOCK rotation in radians
- dxf.block_scale_vector
Vec3
object which stores the scaling factors for the x-, y- and z-axis
- dxf.content_type
0
none
1
BLOCK
2
MTEXT
3
TOLERANCE
- dxf.dogleg_length
dogleg length in drawing units
- dxf.has_dogleg
- dxf.has_landing
- dxf.has_text_frame
- dxf.is_annotative
- dxf.is_text_direction_negative
- dxf.leader_extend_to_text
- dxf.leader_linetype_handle
handle of the leader linetype, “CONTINUOUS” if not set
- dxf.leader_lineweight
- dxf.leader_type
0
invisible
1
straight line leader
2
spline leader
- dxf.property_override_flags
Each bit shows if the MLEADERSTYLE is overridden by the value in the MULTILEADER entity, but this is not always the case for all values, it seems to be save to always use the value from the MULTILEADER entity.
- dxf.scale
overall scaling factor
- dxf.style_handle
handle to the associated MLEADERSTYLE object
- dxf.text_IPE_align
unknown meaning
- dxf.text_alignment_type
unknown meaning - its not the MTEXT attachment point!
- dxf.text_angle_type
0
text angle is equal to last leader line segment angle
1
text is horizontal
2
text angle is equal to last leader line segment angle, but potentially rotated by 180 degrees so the right side is up for readability.
- dxf.text_attachment_direction
defines whether the leaders attach to the left & right of the content BLOCK/MTEXT or attach to the top & bottom:
0
horizontal - left & right of content
1
vertical - top & bottom of content
- dxf.text_attachment_point
MTEXT attachment point
1
top left
2
top center
3
top right
- dxf.text_bottom_attachment_type
9
center
10
overline and center
- dxf.text_left_attachment_type
0
top of top MTEXT line
1
middle of top MTEXT line
2
middle of whole MTEXT
3
middle of bottom MTEXT line
4
bottom of bottom MTEXT line
5
bottom of bottom MTEXT line & underline bottom MTEXT line
6
bottom of top MTEXT line & underline top MTEXT line
7
bottom of top MTEXT line
8
bottom of top MTEXT line & underline all MTEXT lines
- dxf.text_right_attachment_type
0
top of top MTEXT line
1
middle of top MTEXT line
2
middle of whole MTEXT
3
middle of bottom MTEXT line
4
bottom of bottom MTEXT line
5
bottom of bottom MTEXT line & underline bottom MTEXT line
6
bottom of top MTEXT line & underline top MTEXT line
7
bottom of top MTEXT line
8
bottom of top MTEXT line & underline all MTEXT lines
- dxf.text_style_handle
handle of the MTEXT text style, “Standard” if not set
- dxf.text_top_attachment_type
9
center
10
overline and center
- dxf.version
always 2?
- context
MLeaderContext
instance
- arrow_heads
list of
ArrowHeadData
- block_attribs
list of
AttribData
- property has_mtext_content: bool
True
if MULTILEADER has MTEXT content.
- get_mtext_content() str
Get MTEXT content as string, return “” if MULTILEADER has BLOCK content.
- set_mtext_content(text: str)
Set MTEXT content as string, does nothing if MULTILEADER has BLOCK content.
- property has_block_content: bool
True
if MULTILEADER has BLOCK content.
- get_block_content() dict[str, str]
Get BLOCK attributes as dictionary of (tag, value) pairs. Returns an empty dictionary if MULTILEADER has MTEXT content.
- set_block_content(content: dict[str, str])
Set BLOCK attributes by a dictionary of (tag, value) pairs. Does nothing if MULTILEADER has MTEXT content.
- virtual_entities() Iterator[DXFGraphic]
Yields the graphical representation of MULTILEADER as virtual DXF primitives.
These entities are located at the original location, but are not stored in the entity database, have no handle and are not assigned to any layout.
- explode(target_layout: BaseLayout | None = None) EntityQuery
Explode MULTILEADER as DXF primitives into target layout, if target layout is
None
, the target layout is the layout of the source entity.Returns an
EntityQuery
container with all DXF primitives.- Parameters:
target_layout – target layout for the DXF primitives,
None
for same layout as the source entity.
- class ezdxf.entities.MLeaderContext
- leaders
list of
LeaderData
objects
- scale
redundant data:
MultiLeader.dxf.scale
- base_point
insert location as
Vec3
of the MTEXT or the BLOCK entity?
- char_height
MTEXT char height, already scaled
- arrow_head_size
redundant data:
MultiLeader.dxf.arrow_head_size
- landing_gap_size
- left_attachment
redundant data:
MultiLeader.dxf.text_left_attachment_type
- right_attachment
redundant data:
MultiLeader.dxf.text_right_attachment_type
- text_align_type
redundant data:
MultiLeader.dxf.text_attachment_point
- attachment_type
BLOCK alignment?
0
content extents
1
insertion point
- plane_origin
Vec3
- plane_x_axis
Vec3
- plane_y_axis
Vec3
- plane_normal_reversed
the plan normal is x-axis “cross” y-axis (right-hand-rule), this flag indicates to invert this plan normal
- top_attachment
redundant data:
MultiLeader.dxf.text_top_attachment_type
- bottom_attachment
redundant data:
MultiLeader.dxf.text_bottom_attachment_type
- class ezdxf.entities.LeaderData
- lines
list of
LeaderLine
- has_last_leader_line
unknown meaning
- has_dogleg_vector
- last_leader_point
WCS point as
Vec3
- dogleg_vector
WCS direction as
Vec3
- dogleg_length
redundant data:
MultiLeader.dxf.dogleg_length
- index
leader index?
- attachment_direction
redundant data:
MultiLeader.dxf.text_attachment_direction
- breaks
list of break vertices as
Vec3
objects
- class ezdxf.entities.LeaderLine
- vertices
list of WCS coordinates as
Vec3
- breaks
mixed list of mixed integer indices and break coordinates or
None
leader lines without breaks in it
- index
leader line index?
- color
leader line color override, ignore override value if BY_BLOCK_RAW_VALUE
- class ezdxf.entities.AttribData
- handle
handle to
Attdef
entity in the BLOCK definition
- index
unknown meaning
- width
text width factor?
- class ezdxf.entities.MTextData
stores the content and attributes of the MTEXT entity
- default_content
content as string
- extrusion
extrusion vector of the MTEXT entity but MTEXT is not an OCS entity!
- style_handle
redundant data:
MultiLeader.dxf.text_style_handle
- insert
insert location in WCS coordinates, same as
MLeaderContext.base_point
?
- text_direction
“horizontal” text direction vector in WCS
- rotation
rotation angle in radians (!) around the extrusion vector, calculated as it were an OCS entity
- width
unscaled column width
- defined_height
unscaled defined column height
- line_spacing_factor
- line_spacing_style
- color
redundant data:
MultiLeader.dxf.text_color
- alignment
redundant data:
MultiLeader.dxf.text_attachment_point
- flow_direction
1
horizontal
3
vertical
6
by text style
- bg_scale_factor
- bg_transparency
background transparency value
- use_window_bg_color
- has_bg_fill
- column_type
unknown meaning - most likely:
0
none
1
static
2
dynamic
- use_auto_height
- column_gutter_width
unscaled column gutter width
- column_flow_reversed
- column_sizes
list of unscaled columns heights for dynamic column with manual heights
- use_word_break
- class ezdxf.entities.BlockData
stores the attributes for the
Insert
entity- block_record_handle
redundant data:
MultiLeader.dxf.block_record_handle
- extrusion
extrusion vector in WCS
- insert
insertion location in WCS as
Vec3
, same asMLeaderContext.base_point
?
- scale
redundant data:
MultiLeader.dxf.block_scale_vector
- rotation
redundant data:
MultiLeader.dxf.block_rotation
- color
redundant data:
MultiLeader.dxf.block_color