pyvista_cad.CadDataSetAccessor.set_metadata#
- CadDataSetAccessor.set_metadata(*, units=None, label=None, color=None, transform=None, source_format=None, source_format_version=None, guid=None, metadata=None)[source]#
Write the standard
cad.*metadata into this dataset.Symmetric write side of the read-only metadata properties (
units,label,color, …) and themetadataview. Every populated keyword is validated and written into field data viaCadMetadata; any previously storedcad.*schema key is cleared first, so this replaces the metadata rather than merging into it.- Parameters:
- unitsstr, optional
Canonical length-unit string (
'mm','inch', …).- labelstr, optional
Whole-dataset label.
- colortuple of float, optional
RGB 3-tuple or RGBA 4-tuple in
[0, 1]. Alpha rides on the color; there is no separate opacity key.- transformarray-like, optional
4x4assembly-local-to-world transform.- source_formatstr, optional
Originating CAD format (
'STEP','DXF', …).- source_format_versionstr, optional
Format-specific version stamp (e.g. a DXF release).
- guidstr, optional
Stable unique identifier (IFC
GlobalId, etc.).- metadatadict, optional
Free-form JSON-serializable bag stored under
cad.metadata.
- Raises:
- pyvista_cad.MetadataError
If
unitsis not a known unit,coloris not a 3- or 4-tuple in[0, 1],transformis not4x4, ormetadatais not a dict.
- Parameters:
- Return type:
None
Examples
>>> import pyvista as pv >>> import pyvista_cad >>> mesh = pv.Sphere() >>> mesh.cad.set_metadata( ... units='mm', label='widget', color=(0.2, 0.4, 0.6, 0.5) ... ) >>> mesh.cad.units 'mm' >>> mesh.cad.metadata.color (0.2, 0.4, 0.6, 0.5)