Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide stl download link #48

Open
geiseri opened this issue May 26, 2023 · 1 comment
Open

Provide stl download link #48

geiseri opened this issue May 26, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@geiseri
Copy link

geiseri commented May 26, 2023

First of all THANKS! I was using cadquery-server to generate a static site with my models. While it works very well it is quite hard to customize. Sphinx makes that MUCH easier. One feature I miss though is the ability to export links to the models for download.

When I present my models I like to provide a download link to the part. Like below:

image

Right now I just have my pipeline run the export before the sphinx round and throw them in the _static directory. It would be cool to have a directive like this:

.. cadquery-export::
    :format: stl
    :caption: 3D print
    :name: front.stl

    result = cadquery.Workplane("front").box(2, 2, 0.5)

Where :format: is optional and the :name: would be used similarly to the cadquery export behavior.

That would present a link for download similar to the download directive below:

:download:`3D print <front.stl>`

Theoretically, the export function of the cqgi interface could be used. I have never written a directive before, so maybe that won't work for generating a file.

One other choice (while IMHO less flexible) could be to add a parameter like :export: file.stl that can add a download link next to the image like the image above.

.. cadquery-svg::
    :export: file.3mf

    result = cadquery.Workplane("front").box(2, 2, 0.5)
    show_object(result)
@sethfischer sethfischer added the enhancement New feature or request label May 26, 2023
@sethfischer
Copy link
Owner

sethfischer commented May 27, 2023

@geiseri I think this feature would be a great addition to the extension. My intention is to add new features as a Sphinx domain so the syntax would be something like:

.. cadquery:export::
    :format: stl
    :caption: 3D print
    :name: front.stl

    result = cadquery.Workplane("front").box(2, 2, 0.5)
:cadquery:download:`3D print <front.stl>`

@sethfischer sethfischer self-assigned this May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants