From fb30e0e00c4e5a45e66e32e73f73f038a5000ee9 Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Mon, 28 Apr 2025 02:57:48 -0700 Subject: [PATCH] Add docs for mjSpec serialization. PiperOrigin-RevId: 752230683 Change-Id: Id237ccc1b265e99bf15892f8fd208ba38f4c6ded --- doc/python.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/python.rst b/doc/python.rst index 85a54b73..61ebcdc8 100644 --- a/doc/python.rst +++ b/doc/python.rst @@ -628,6 +628,12 @@ Parent: The parent body of a given element -- including bodies and frames -- can be accessed via the ``parent`` property. For example, the parent of a site can be accessed via ``site.parent``. +Serialization +^^^^^^^^^^^^^ +The ``MjSpec`` object can be serialized with all of its assets using the function ``spec.to_zip(file)``, where ``file`` +can be either a path to a file or a file object. In order to load the spec from a zip file, use ``spec = +MjSpec.from_zip(file)``, where ``file`` is a path to a zip file or a zip file object. + .. _PyMJCF: Relationship to ``PyMJCF`` and ``bind``