Solved Moving\Deleting nodes with Python


I've got a GvNode that I can rename and control, but I'm not sure how I can delete or move it's position in Xpresso.

Thanks in advance,

Hi @sheilan,
Moving Xpresso node have been discussed here, same warning as Andreas did, ID may change in the future and break your stuff since there is no symbols for theses data.

Regarding how to delete a GvNode, as you may have seen, GvNode inherit from BaseList2D which inherit from GeListNode, so you can use the GeListNode.Remove method.

Here an example:

import c4d

def main():
    # Checks if selected object is valid
    if op is None:
        raise ValueError("op is none, please select one object.")

    # Retrieves the xpresso Tag
    xpressoTag = op.GetTag(c4d.Texpresso)
    if xpressoTag is None:
        raise ValueError("Make sure the selected object get an Xpresso Tag.")

    # Retrieves the node master
    gvNodeMaster = xpressoTag.GetNodeMaster()
    if gvNodeMaster is None:
        raise RuntimeError("Failed to retrieves the Node Master.")

    # Retrieves the Root node (the Main XGroup) that holds all others nodes
    gvRoot = gvNodeMaster.GetRoot()
    if gvRoot is None:
        raise RuntimeError("Failed to retrieves the Root Node.")

    # Iterates overs all nodes of this root node.
    firstNode = gvRoot.GetDown()
    if firstNode is None:
        raise RuntimeError("Failed to retrieves the First Node.")

    # Defines Y size
    firstNode.GetDataInstance().GetContainerInstance(1001).GetContainerInstance(1000)[109] = 50

    # Defines X size
    firstNode.GetDataInstance().GetContainerInstance(1001).GetContainerInstance(1000)[108] = 100

    # Defines the Y position
    firstNode.GetDataInstance().GetContainerInstance(1001).GetContainerInstance(1000)[101] = -200

    # Defines the X position
    firstNode.GetDataInstance().GetContainerInstance(1001).GetContainerInstance(1000)[100] = -200

    # GvNode is a GeListNode so you can simply use Remove

    # Updates Cinema 4D

if __name__ == '__main__':

If you have any questions, let me know.

Works perfectly. Thanks!