Skip to content

Commit

Permalink
edit docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mozman committed Jun 27, 2024
1 parent 80d28df commit a33a307
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions src/ezdxf/entities/dxfgfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ class DXFGraphic(DXFEntity):
"""Common base class for all graphic entities, a subclass of
:class:`~ezdxf.entities.dxfentity.DXFEntity`. These entities resides in
entity spaces like modelspace, paperspace or block.
"""

DXFTYPE = "DXFGFX"
Expand Down Expand Up @@ -217,7 +216,8 @@ class processing by parent class.
return dxf

def post_new_hook(self) -> None:
"""Post-processing and integrity validation after entity creation
"""Post-processing and integrity validation after entity creation.
(internal API)
"""
if self.doc:
Expand All @@ -228,16 +228,18 @@ def post_new_hook(self) -> None:

@property
def rgb(self) -> tuple[int, int, int] | None:
"""Returns RGB true color as (r, g, b) tuple or None if true_color is
not set.
"""
"""Returns RGB true color as (r, g, b) tuple or None if true_color is not set."""
if self.dxf.hasattr("true_color"):
return clr.int2rgb(self.dxf.get("true_color"))
return None

@rgb.setter
def rgb(self, rgb: clr.RGB | tuple[int, int, int]) -> None:
"""Set RGB true color as (r, g , b) tuple e.g. (12, 34, 56)."""
"""Set RGB true color as (r, g , b) tuple e.g. (12, 34, 56).
Raises:
TypeError: input value `rgb` has invalid type
"""
self.dxf.set("true_color", clr.rgb2int(rgb))

@rgb.deleter
Expand Down Expand Up @@ -278,7 +280,6 @@ def is_transparency_by_block(self) -> bool:
def graphic_properties(self) -> dict:
"""Returns the important common properties layer, color, linetype,
lineweight, ltscale, true_color and color_name as `dxfattribs` dict.
"""
attribs = dict()
for key in GRAPHIC_PROPERTIES:
Expand All @@ -290,7 +291,6 @@ def ocs(self) -> OCS:
"""Returns object coordinate system (:ref:`ocs`) for 2D entities like
:class:`Text` or :class:`Circle`, returns a pass-through OCS for
entities without OCS support.
"""
# extrusion is only defined for 2D entities like Text, Circle, ...
if self.dxf.is_supported("extrusion"):
Expand Down Expand Up @@ -381,7 +381,6 @@ def unlink_from_layout(self) -> None:
It is more efficient to call the
:meth:`~ezdxf.layouts.BaseLayout.unlink_entity` method of the associated
layout, especially if you have to unlink more than one entity.
"""
if not self.is_alive:
raise TypeError("Can not unlink destroyed entity.")
Expand Down Expand Up @@ -410,7 +409,6 @@ def move_to_layout(
Raises:
DXFStructureError: for moving between different DXF drawings
"""
if source is None:
source = self.get_layout()
Expand All @@ -429,7 +427,6 @@ def copy_to_layout(self, layout: BaseLayout) -> Self:
Raises:
DXFStructureError: for copying between different DXF drawings
"""
if self.doc != layout.doc:
raise const.DXFStructureError(
Expand All @@ -451,7 +448,6 @@ def audit(self, auditor: Auditor) -> None:
auditor.trash(entity)
to delete invalid entities after auditing automatically.
"""
assert self.doc is auditor.doc, "Auditor for different DXF document."
if not self.is_alive:
Expand All @@ -478,7 +474,6 @@ def transform(self, m: Matrix44) -> Self:
Args:
m: 4x4 transformation matrix (:class:`ezdxf.math.Matrix44`)
"""
raise NotImplementedError()

Expand All @@ -498,21 +493,18 @@ def translate(self, dx: float, dy: float, dz: float) -> Self:
Basic implementation uses the :meth:`transform` interface, subclasses
may have faster implementations.
"""
return self.transform(Matrix44.translate(dx, dy, dz))

def scale(self, sx: float, sy: float, sz: float) -> Self:
"""Scale entity inplace about `dx` in x-axis, `dy` in y-axis and `dz`
in z-axis, returns `self` (floating interface).
"""
return self.transform(Matrix44.scale(sx, sy, sz))

def scale_uniform(self, s: float) -> Self:
"""Scale entity inplace uniform about `s` in x-axis, y-axis and z-axis,
returns `self` (floating interface).
"""
return self.transform(Matrix44.scale(s))

Expand All @@ -523,7 +515,6 @@ def rotate_axis(self, axis: UVec, angle: float) -> Self:
Args:
axis: rotation axis as tuple or :class:`Vec3`
angle: rotation angle in radians
"""
return self.transform(Matrix44.axis_rotate(axis, angle))

Expand All @@ -533,7 +524,6 @@ def rotate_x(self, angle: float) -> Self:
Args:
angle: rotation angle in radians
"""
return self.transform(Matrix44.x_rotate(angle))

Expand All @@ -543,7 +533,6 @@ def rotate_y(self, angle: float) -> Self:
Args:
angle: rotation angle in radians
"""
return self.transform(Matrix44.y_rotate(angle))

Expand All @@ -553,7 +542,6 @@ def rotate_z(self, angle: float) -> Self:
Args:
angle: rotation angle in radians
"""
return self.transform(Matrix44.z_rotate(angle))

Expand Down Expand Up @@ -693,7 +681,6 @@ def add_entity(entity: DXFGraphic, layout: BaseLayout) -> None:
def replace_entity(source: DXFGraphic, target: DXFGraphic, layout: BaseLayout) -> None:
"""Add `target` entity to the entity database and to the given `layout`
and replace the `source` entity by the `target` entity.
"""
assert target.dxf.handle is None
assert layout is not None
Expand Down

0 comments on commit a33a307

Please sign in to comment.