CAD files in Gitea + View the CAD files

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.
Thx

1 Like

Sounds like you want a CI/CD workflow to publish a static site based off git source and automatically deploy it.

Here’s what I’d do:

  1. Create a Hugo custom output type to generate the files by acceptable MIME type
  2. Make a layout to first display the CAD files using library of choice (canvas render optimal)
  3. Stand up a Drone server to trigger builds based on webhook from Gitea
  4. Add a build config to pull data from CAD repo
  5. Trigger a Hugo build to display your custom output format in your layout
  6. And deploy your updated site

That’s just a rough sketch. TL;DR is you probably want a CI/CD workflow triggered by a webhook upon commit. Use Hugo because it’s the fastest way to iterate on a website.

If you’re looking for a Hugo base theme please consider saving time with https://after-dark.habd.as it’s extendible for your needs assuming my suggested approach is viable.

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.

You are not alone.
I have thought this way to trace CAD file.
The other site had this post. I think you may have interest on here.

In addition, I think git repos is good for those article writer. If they want a drama script, this is a good tool to collaborate, version management and something else.

For CAD, it is not only on code or letters of the article. The viewer is important when animation is needed by people.

You may visit cadracks.org for an example of using Gitea with CAD file support/viewing.
You may sign up at http://cadracks.org/user/sign_up to be able to create a repository and add/commit/push CAD files.

The currently available project documentation is available at cadracks.github.io
So cadracks.org is currently a sort of GitHub with enhanced CAD file support.

But more is on the way (see cadracks.github.io/blog/2019/01/15/The_roadmap)

Cheers