gaphor / gaphor

Gaphor is the simple modeling tool
https://gaphor.org
1.87k stars 200 forks source link

Export all diagrams with one button #1847

Closed aranvir closed 1 year ago

aranvir commented 1 year ago

Is your feature request related to a problem?

I want to use Gaphor to create model-based diagrams but I also want to have a convenient way to "export all diagrams". The rational is that if I change something in one diagram/element I don't want to manually check every existing diagram to see what I need to re-export as well. Or even if I know the change affects only 3 diagrams, it's still more convenient to have an "export all" button.

Describe the solution you'd like

Just a button that allows the user to export all diagrams to SVG or to PNG where filename equals diagram name should suffice as the basic implementation. To add more detail, it could be nice to first open a popup window where you may select only a portion of your diagrams (if this is required for you) or to set a shared prefix to all diagram names, target directory, etc.

Describe alternatives you've considered

Initially, I just wanted to code a small script myself that loads the model, loops all diagrams, and exports them. But under windows this has been a massive struggle for me, so I'd appreciate this as a built-in feature.

Additional context

None

amolenaar commented 1 year ago

Hi @aranvir,

Thank you for your suggestion. What are you using the diagrams for?

Gaphor already has a small "gaphorconvert" script that does just that, from the command line, so it's relatively easy to integrate with CI/CD. Unfortunately that's not exposed from our Gaphor installation on Windows.

aranvir commented 1 year ago

Hi @amolenaar, good to know! I'm looking into using C4 diagrams for software architecture documentation. So it's really just to reliably propagate model changes to all diagrams.

By now, I also managed to get a small custom script running with msys2 but I think this is not ideal for a user-friendly workflow.

amolenaar commented 1 year ago

@aranvir, just out of curiosity. How do you use those exported images? Are they added to a wiki page? Word document? Static website?

aranvir commented 1 year ago

The idea is to use it in adoc documents. Model and exported diagrams would be stored in a git repository together with the document. Windows users cannot use the python API natively so one workaround would be to have the pipeline handling this.

However, for convenience, and in case any automatic export didn't go as expected it still would be nice for Windows users to see the changes in the document before commit&push.

amolenaar commented 1 year ago

The next version of Gaphor will have proper subcommands.

You can do

gaphor export -o outdir mymodel.gaphor

to export all diagrams. That would make it usable from for example a build pipeline.

amolenaar commented 1 year ago

@aranvir I suppose the ability to export all diagrams via the CLI solves this ticket?

aranvir commented 1 year ago

That should be fine. I hadn't had the chance to look at it in detail yet, but it sounds like the ticket can be closed :)