Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mozman committed Oct 26, 2024
1 parent 1c8d45a commit fa1c932
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/source/tasks/add_layouts.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _add_layouts:

Add Layouts And Blocks
Add Layouts and Blocks
======================

Layouts are containers for DXF entities like LINE or CIRCLE.
Expand Down
69 changes: 65 additions & 4 deletions docs/source/tasks/delete_layouts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
Delete Layouts and Blocks
=========================

TODO

Modelspace
----------

Expand All @@ -13,9 +11,72 @@ This is not possible.
Paperspace Layouts
------------------

TODO
Delete a paperspace layout and it's entities.

.. code-block::
name = "MyLayout"
try:
doc.layouts.delete(name)
except ezdxf.DXFKeyError:
print(f"layout '{name}' not found")
except ezdxf.DXFValueError:
print(f"layout '{name}' cannot be deleted")
# modelspace or last remaining paperspace layout
Block Definitions
-----------------

TODO
Delete a block definition:

.. code-block::
try:
doc.blocks.delete_block(name, safe=True)
except ezdxf.DXFBlockInUseError:
print(f"cannot delete block '{name}'")
Raises a :class:`DXFBlockInUseError` exception if the block is referenced by an INSERT
entity or if it is an anonymous/special block.

Purge/delete unused (unreferenced) block definitions:

.. versionadded:: 1.3.5

.. code-block::
from ezdxf import blkrefs
...
for name in blkrefs.find_unreferenced_blocks(doc)
doc.blocks.delete_block(name, safe=False)
.. seealso::

**Tasks:**

- :ref:`add_layouts`
- :ref:`get_layouts`
- :ref:`add_blockrefs`
- :ref:`delete_dxf_entities`

**Tutorials:**

- :ref:`tut_blocks`

**Basics:**

- :ref:`layout`
- :ref:`modelspace_concept`
- :ref:`paperspace_concept`
- :ref:`block_concept`

**Classes:**

- :class:`ezdxf.layouts.Layouts`
- :class:`ezdxf.document.Drawing`

**Modules:**

- :mod:`ezdxf.blkrefs`
47 changes: 31 additions & 16 deletions docs/source/tasks/get_layouts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ class returns the :class:`~ezdxf.layouts.Modelspace` object.
msp = doc.modelspace()
- :ref:`modelspace_concept` Concept
- :class:`ezdxf.layouts.Modelspace`
- :class:`ezdxf.document.Drawing`


Paperspace Layouts
------------------

Expand All @@ -54,12 +49,6 @@ Get a paperspace layout by name:
The `name` argument is the name shown in the tabs of CAD applications.


- :ref:`paperspace_concept` Concept
- :class:`ezdxf.layouts.Paperspace`
- :class:`ezdxf.document.Drawing`


Block Layouts
-------------

Expand Down Expand Up @@ -108,9 +97,35 @@ Find unused (unreferenced) block definitions:
for name in blkrefs.find_unreferenced_blocks(doc)
block = doc.blocks.get(name)
.. seealso::

**Tasks:**

- :ref:`add_layouts`
- :ref:`delete_layouts`
- :ref:`add_blockrefs`
- :ref:`delete_dxf_entities`

**Tutorials:**

- :ref:`tut_blocks`

**Basics:**

- :ref:`layout`
- :ref:`modelspace_concept`
- :ref:`paperspace_concept`
- :ref:`block_concept`

**Classes:**

- :class:`ezdxf.layouts.Modelspace`
- :class:`ezdxf.layouts.Paperspace`
- :class:`ezdxf.layouts.BlockLayout`
- :class:`ezdxf.sections.blocks.BlocksSection`
- :class:`ezdxf.document.Drawing`

**Modules:**

- :mod:`ezdxf.blkrefs`

- :ref:`block_concept` Concept
- :class:`ezdxf.layouts.BlockLayout`
- :class:`ezdxf.sections.blocks.BlocksSection`
- :class:`ezdxf.document.Drawing`
- :mod:`ezdxf.blkrefs`

0 comments on commit fa1c932

Please sign in to comment.