Dear Gitea folks,
I am working on a way to manage CAD files (think STEP, IGES …) in Gitea. Obviously, displaying the contents of CAD files as text is not interesting, we need 2 things:
a 3D viewer (three.js or x3dom)
a way to convert CAD files to a format that can be used by the viewer.
I already have the viewer and the code to convert from CAD to JSON or X3D, and made some code and template modifications to display the viewer when a project file is identified as a CAD file so this is not a problem.
The only thing I miss is an understanding of how to trigger a (Python) procedure just after a repo is pushed to Gitea.
Any help, link to docs, recommendation, suggestion will be happily welcome.
Not sure I explained it properly …
I add and commit CAD files (STEP, IGES, FCStd …) to my repo. Then I push everything. If I use the standard Gitea, what I will see via the web interface is text or a direct download possibility. What I want is a 3D view (three.js or x3dom). So I need to convert my CAD files to a format three.js/x3dom understands: STL or JSON for example (in routers/repo/view.go, I call a Python routine that uses PythonOCC to do the conversion) and modify the templates/repo.view_file.tmpl template to use the converted data when rendering a CAD file.
I tried the hook way but converting the whole git database is hard ! The other way is to convert ‘on-the-fly’: upon a request for a CAD file, I run the conversion server-side and use the converted file to build the 3D display.