MLine¶
The MLINE entity (DXF Reference).
Subclass of |
|
DXF type |
|
factory function |
|
Inherited DXF attributes |
|
Required DXF version |
DXF R2000 ( |
- class ezdxf.entities.MLine¶
- dxf.style_name¶
MLineStylename stored inDrawing.mline_stylesdictionary, useset_style()to change the MLINESTYLE and update geometry accordingly.
- dxf.style_handle¶
Handle of
MLineStyle, useset_style()to change the MLINESTYLE and update geometry accordingly.
- dxf.scale_factor¶
MLINE scaling factor, use method
set_scale_factor()to change the scaling factor and update geometry accordingly.
- dxf.justification¶
Justification defines the location of the MLINE in relation to the reference line, use method
set_justification()to change the justification and update geometry accordingly.Constants defined in
ezdxf.lldxf.const:dxf.justification
Value
MLINE_TOP
0
MLINE_ZERO
1
MLINE_BOTTOM
2
MLINE_RIGHT (alias)
0
MLINE_CENTER (alias)
1
MLINE_LEFT (alias)
2
- dxf.flags¶
Use method
close()and the propertiesstart_capsandend_capsto change these flags.Constants defined in
ezdxf.lldxf.const:dxf.flags
Value
MLINE_HAS_VERTEX
1
MLINE_CLOSED
2
MLINE_SUPPRESS_START_CAPS
4
MLINE_SUPPRESS_END_CAPS
8
- dxf.start_location¶
Start location of the reference line. (read only)
- dxf.count¶
Count of MLINE vertices. (read only)
- dxf.style_element_count¶
Count of elements in
MLineStyledefinition. (read only)
- dxf.extrusion¶
Normal vector of the entity plane, but MLINE is not an OCS entity, all vertices of the reference line are WCS! (read only)
- vertices¶
MLINE vertices as
MLineVertexobjects, stored in a regular Python list.
- property style: MLineStyle | None¶
Get associated MLINESTYLE.
- set_style(name: str) None¶
Set MLINESTYLE by name and update geometry accordingly. The MLINESTYLE definition must exist.
- set_scale_factor(value: float) None¶
Set the scale factor and update geometry accordingly.
- set_justification(value: int) None¶
Set MLINE justification and update geometry accordingly. See
dxf.justificationfor valid settings.
- close(state: bool = True) None¶
Get/set closed state of MLINE and update geometry accordingly. Compatibility interface to
Polyline
- property start_caps: bool¶
Get/Set start caps state.
Trueto enable start caps andFalsetu suppress start caps.
- property end_caps: bool¶
Get/Set end caps state.
Trueto enable end caps andFalsetu suppress start caps.
- __len__()¶
Count of MLINE vertices.
- start_location() Vec3¶
Returns the start location of the reference line. Callback function for
dxf.start_location.
- extend(vertices: Iterable[UVec]) None¶
Append multiple vertices to the reference line.
It is possible to work with 3D vertices, but all vertices have to be in the same plane and the normal vector of this plan is stored as extrusion vector in the MLINE entity.
- clear() None¶
Remove all MLINE vertices.
- update_geometry() None¶
Regenerate the MLINE geometry based on current settings.
- generate_geometry(vertices: list[Vec3]) None¶
Regenerate the MLINE geometry for new reference line defined by vertices.
- transform(m: Matrix44) DXFGraphic¶
Transform MLINE entity by transformation matrix m inplace.
- virtual_entities() Iterator[DXFGraphic]¶
Yields virtual DXF primitives of the MLINE entity as LINE, ARC and HATCH entities.
These entities are located at the original positions, 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 the MLINE entity as LINE, ARC and HATCH entities into target layout, if target layout is
None, the target layout is the layout of the MLINE. This method destroys the source entity.Returns an
EntityQuerycontainer referencing all DXF primitives.- Parameters:
target_layout – target layout for DXF primitives,
Nonefor same layout as source entity.
- class ezdxf.entities.MLineVertex¶
- location¶
Reference line vertex location.
- line_direction¶
Reference line direction.
- miter_direction¶
- line_params¶
The line parameterization is a list of float values. The list may contain zero or more items.
The first value (miter-offset) is the distance from the vertex
locationalong themiter_directionvector to the point where the line element’s path intersects the miter vector.The next value (line-start-offset) is the distance along the
line_directionfrom the miter/line path intersection point to the actual start of the line element.The next value (dash-length) is the distance from the start of the line element (dash) to the first break (gap) in the line element. The successive values continue to list the start and stop points of the line element in this segment of the mline.
- fill_params¶
The fill parameterization is also a list of float values. Similar to the line parameterization, it describes the parameterization of the fill area for this mline segment. The values are interpreted identically to the line parameters and when taken as a whole for all line elements in the mline segment, they define the boundary of the fill area for the mline segment.
- class ezdxf.entities.MLineStyle¶
The
MLineStylestores the style properties for the MLINE entity.- dxf.name¶
- dxf.description¶
- dxf.flags¶
- dxf.fill_color¶
AutoCAD Color Index (ACI) value of the fill color
- dxf.start_angle¶
- dxf.end_angle¶
- elements¶
MLineStyleElementsobject
- update_all()¶
Update all MLINE entities using this MLINESTYLE.
The update is required if elements were added or removed or the offset of any element was changed.
- class ezdxf.entities.mline.MLineStyleElements¶
- elements¶
List of
MLineStyleElementobjects, one for each line element.
- MLineStyleElements.__len__()¶
- MLineStyleElements.__getitem__(item)¶
- MLineStyleElements.append(offset: float, color: int = 0, linetype: str = 'BYLAYER') None¶
Append a new line element.
- Parameters:
offset – normal offset from the reference line: if justification is
MLINE_ZERO, positive values are above and negative values are below the reference line.color – AutoCAD Color Index (ACI) value
linetype – linetype name