{"id":3752,"library":"pycollada","title":"pycollada","description":"pycollada is a Python library for reading, writing, and creating COLLADA (COLLAborative Design Activity) documents, an interchange file format for interactive 3D applications. It allows users to load a COLLADA file and interact with it as a Python object, supporting creation from scratch and in-place editing. The current version is 0.9.3, released on January 24, 2026, with a fairly active release cadence addressing compatibility and performance improvements.","status":"active","version":"0.9.3","language":"en","source_language":"en","source_url":"https://github.com/pycollada/pycollada","tags":["3d","collada","dae","modeling","geometry"],"install":[{"cmd":"pip install pycollada","lang":"bash","label":"Install pycollada"}],"dependencies":[{"reason":"Used for numerical arrays, made an explicit install requirement since version 0.8.","package":"numpy","optional":false},{"reason":"Recommended for XML loading, construction, and saving due to performance, though compatible with Python's built-in ElementTree API since 0.9.3.","package":"lxml","optional":true}],"imports":[{"note":"The primary class for interacting with COLLADA documents is `Collada`, typically imported directly.","wrong":"import collada","symbol":"Collada","correct":"from collada import Collada"},{"note":"Common for quick access to all pycollada components in small scripts or interactive sessions.","symbol":"*","correct":"from collada import *"}],"quickstart":{"code":"import os\nfrom collada import Collada, material, geometry, source\nimport numpy as np\n\n# 1. Create a new COLLADA document\nmesh = Collada()\n\n# 2. Define geometry: a simple triangle\n# Vertices\nverts = np.array([\n    0.0, 0.0, 0.0,\n    1.0, 0.0, 0.0,\n    0.0, 1.0, 0.0\n])\nnormals = np.array([\n    0.0, 0.0, 1.0,\n    0.0, 0.0, 1.0,\n    0.0, 0.0, 1.0\n])\n\nvert_src = source.FloatSource('my_verts-positions', verts, ('X', 'Y', 'Z'))\nnorm_src = source.FloatSource('my_normals-normals', normals, ('X', 'Y', 'Z'))\n\n# Indices for a single triangle\ntriangles = np.array([0, 0, 1, 1, 2, 2]) # vertex index, normal index, ...\n\ngeom = geometry.Geometry(mesh, 'geometry0', 'my_triangle_geometry',\n                       [geometry.Triangles(vert_src, norm_src, triangles, 'material0')])\n\nmesh.geometries.append(geom)\n\n# 3. Create a material\neffect = material.Effect('effect0', [], 'phong', diffuse=(1, 0, 0, 1))\nmat = material.Material('material0', 'red_material', effect)\nmesh.materials.append(mat)\nmesh.effects.append(effect)\n\n# 4. Save the COLLADA document\noutput_file = 'my_first_collada.dae'\nmesh.write(output_file)\nprint(f\"Created '{output_file}'\")\n\n# 5. Load an existing COLLADA document (or the one we just created)\n# For demonstration, we'll try to load the file we just saved.\nif os.path.exists(output_file):\n    loaded_mesh = Collada(output_file)\n    print(f\"Loaded '{output_file}' with {len(loaded_mesh.geometries)} geometries.\")\n    # Example: Accessing a geometry\n    if loaded_mesh.geometries:\n        print(f\"First geometry ID: {loaded_mesh.geometries[0].id}\")\nelse:\n    print(f\"Could not load '{output_file}'. Make sure the file exists.\")\n","lang":"python","description":"This quickstart demonstrates how to create a simple COLLADA document containing a single red triangle and then save it. It also shows how to load an existing COLLADA file and access its basic properties. Requires numpy to be installed."},"warnings":[{"fix":"Ensure you are using a supported Python version. For pycollada 0.9.3, Python 3.14+ is supported, and for 0.8+, Python 3.8+ (up to 3.12 for 0.8) is required. Python 3.9 is not supported by 0.9.3.","message":"Python 3.9 support was removed in pycollada 0.9.3, as Python 3.9 reached end-of-life. Python versions prior to 3.8 were dropped in 0.8.","severity":"breaking","affected_versions":"0.9.3+, 0.8+"},{"fix":"Always explicitly install `numpy` alongside `pycollada` (`pip install pycollada numpy`). If encountering issues with NumPy versions, ensure you have the latest `pycollada` (0.9.2 or newer for NumPy 2.x compatibility).","message":"NumPy became an explicit install requirement starting from version 0.8. Prior to this, it might have been an implicit dependency or optional. Additionally, versions 0.9.2 and 0.9 included fixes for compatibility with NumPy 2.0/2.3 after `fromstring` byte deprecation.","severity":"breaking","affected_versions":"0.8+, 0.9+, 0.9.2+"},{"fix":"Upgrade to pycollada 0.8 or newer. If you are unable to upgrade and dealing with large XML, you might need to manually configure `lxml` parsing options if pycollada exposes them, or consider pre-processing the DAE file.","message":"Loading large COLLADA XML documents might fail without explicit `huge_tree` support enabled for the underlying `lxml` parser. This was addressed in version 0.8.","severity":"gotcha","affected_versions":"0.1 - 0.7.2"},{"fix":"To ignore specific errors and attempt to continue loading, pass a list of exception types to the `ignore` parameter of the `Collada` constructor: `mesh = Collada('file.dae', ignore=[DaeUnsupportedError, DaeBrokenRefError])`. Any errors encountered will be available in `Collada.errors`.","message":"When loading COLLADA documents, `pycollada` can raise exceptions like `DaeUnsupportedError` or `DaeBrokenRefError`. By default, these can halt loading.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For optimal performance and to avoid potential parsing quirks, ensure `lxml` is installed (`pip install lxml`).","message":"While pycollada 0.9.3 introduced compatibility with Python's built-in `ElementTree` API, `lxml` is still the recommended XML parser for better performance and robustness.","severity":"gotcha","affected_versions":"0.9.3+"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}