Skip to content

A python COLLADA library. Can be used to create, edit and load COLLADA documents (forked from https://github.com/pycollada/pycollada/fork).

License

Notifications You must be signed in to change notification settings

ogsadmin/pycollada

 
 

Repository files navigation

pycollada

h+e ogsadmin notes

This is a fork of pycollada to allow custom node names. All changes are done in the add-optional-node-name branch and integrated into the official build through the pycollada pull request 131.

The actual aim of this change is to make FreeCAD export the "correct" node names to the collada file, so a *.gltf file for web can be generated (and displayed/modified using babylonjs). The main benefit is that this allows a workflow for converting step files to *.gltf files without loosing the structural (component names) information. This would work in combination with the updated FreeCAD Collada *.dae exporter (from the forum A more user friendly Collada .dae exporter).

The overall process is then as follows:

  • import the *.stp file into FreeCAD
  • select everything and export it as Collada (*.dae) file (using the updated collada exporter)
  • use COLLADA2GLTF to convert the collada file to a gltf file

Here is a sample batch file:

@echo off
:: To use a STEP mode, open it in Freecad and export is as COLLADA (*.dae)
set MODELPATH=..\models
:: Use only filename without extension
::set FILENAME=MSTKN-H-S14-HM-WLAN-24V v5
set FILENAME=Zellmodul
::.\collada2gltf\COLLADA2GLTF-bin "%MODELPATH%\%FILENAME%.dae" "%MODELPATH%\%FILENAME%.glTF"
.\collada2gltf\COLLADA2GLTF-bin "%MODELPATH%\%FILENAME%.dae" "%MODELPATH%\%FILENAME%.glb" -b true

To automate the process, see https://forum.freecad.org/viewtopic.php?t=14734 for some hints.

FreeCAD installation notes

Unfortunately, FreeCAD does not use an up-to-date release of pycollada (as of today, FreeCAD V0.21.1), so the following steps must be done manually to fix the FreeCAD export:

  1. Update the pycollada library

    Copy the scene.py file from this repo to <FreeCAD>\bin\Lib\site-packages\collada (overwrite the existing file).

  2. Update the FreeCAD *.dae importer (which is also the exporter for collada files)

    Replace the file <FreeCAD>\Mod\Arch\importDAE.py from the tkinnovations.net updated FreeCAD *.dae export forum entry. Note, that this also needs webcolors installed into the ``` installation folder!

For convenience, the files are also available in the main branch under patches.

Overview

pycollada is a python module for creating, editing and loading COLLADA, which is a COLLAborative Design Activity for establishing an interchange file format for interactive 3D applications.

The library allows you to load a COLLADA file and interact with it as a python object. In addition, it supports creating a collada python object from scratch, as well as in-place editing.

You can get help at the pycollada mailing list.

See the pycollada Documentation for more information.

Build Status

Projects using pycollada

About

A python COLLADA library. Can be used to create, edit and load COLLADA documents (forked from https://github.com/pycollada/pycollada/fork).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 100.0%