From 6e19035aabf75c6f1de5101cd437d56231d70452 Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Fri, 28 Mar 2025 01:57:56 -0700 Subject: [PATCH] Add delete and detach docs. PiperOrigin-RevId: 741444657 Change-Id: I4207eaf74524e8a3ca46130967c6fb0dd62b4d64 --- doc/python.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/python.rst b/doc/python.rst index edb2067b..62541701 100644 --- a/doc/python.rst +++ b/doc/python.rst @@ -601,6 +601,14 @@ Lists of all elements in a spec can be accessed using named properties, using th ``equalities``, ``tendons``, ``actuators``, ``skins``, ``textures``, ``texts``, ``tuples``, ``flexes``, ``hfields``, ``keys``, ``numerics``, ``excludes``, ``sensors``, ``plugins``. +Element removal +^^^^^^^^^^^^^^^ +For elements that can have children (bodies and defaults), the methods ``spec.detach_body(body)`` and +``spec.detach_default(def)`` remove, respectively, ``body`` and ``def`` from the spec, together with all of their +children. When detaching body subtrees, all elements which reference elements in the subtree, will also be removed. For +all other elements, the method ``delete()`` removes the corresponding element from the spec, e.g. +``spec.geom('my_geom').delete()`` will remove the geom named "my_geom" and all of the elements that reference it. + Tree traversal ^^^^^^^^^^^^^^ Traversal of the kinematic tree is aided by the following methods which return tree-related lists of elements: