Attrib¶
The ATTRIB (DXF Reference) entity represents a text value associated with a tag.
In most cases an ATTRIB is appended to an Insert
entity, but it can also
appear as standalone entity.
Subclass of |
|
DXF type |
|
Factory function |
|
Factory function |
|
Inherited DXF attributes |
See also
Warning
Do not instantiate entity classes by yourself - always use the provided factory functions!
- class ezdxf.entities.Attrib¶
ATTRIB supports all DXF attributes and methods of parent class
Text
.- dxf.tag¶
Tag to identify the attribute (str)
- dxf.text¶
Attribute content as text (str)
- property is_invisible: bool¶
Attribute is invisible (does not appear).
- property is_const: bool¶
This is a constant attribute.
- property is_verify: bool¶
Verification is required on input of this attribute. (CAD application feature)
- property is_preset: bool¶
No prompt during insertion. (CAD application feature)
- property has_embedded_mtext_entity: bool¶
Returns
True
if the entity has an embedded MTEXT entity for multi line support.
- virtual_mtext_entity() ezdxf.entities.mtext.MText ¶
Returns the embedded MTEXT entity as a regular but virtual
MText
entity with the same graphical properties as the host entity.
- plain_mtext(fast=True) str ¶
Returns the embedded MTEXT content without formatting codes. Returns an empty string if no embedded MTEXT entity exist.
The “fast” mode is accurate if the DXF content was created by reliable (and newer) CAD applications like AutoCAD or BricsCAD. The “accurate” mode is for some rare cases where the content was created by older CAD applications or unreliable DXF libraries and CAD applications.
The “accurate” mode is much slower than the “fast” mode.
- Parameters
fast – uses the “fast” mode to extract the plain MTEXT content if
True
or the “accurate” mode if set toFalse
- set_mtext(mtext: ezdxf.entities.mtext.MText, graphic_properties=True) None ¶
Set multi-line properties from a
MText
entity.The multi-line ATTRIB/ATTDEF entity requires DXF R2018, otherwise an ordinary single line ATTRIB/ATTDEF entity will be exported.
- Parameters
mtext – source
MText
entitygraphic_properties – copy graphic properties (color, layer, …) from source MTEXT if
True
- embed_mtext(mtext: ezdxf.entities.mtext.MText, graphic_properties=True) None ¶
Set multi-line properties from a
MText
entity and destroy the source entity afterwards.The multi-line ATTRIB/ATTDEF entity requires DXF R2018, otherwise an ordinary single line ATTRIB/ATTDEF entity will be exported.
- Parameters
mtext – source
MText
entitygraphic_properties – copy graphic properties (color, layer, …) from source MTEXT if
True