How to extract Images from Capella model?

Hello,
I want to extract/export diagrams from Capella model in the image format.
Could you please help with this?

Thank you in advance

Hi,

Yes, we can. You will find that in the documentation.

Hello,
Thank you for quick answer.

But I want to do it programmatically

Hi,
You can do it with command line

Or programmatically like the code of the command line :

Philippe

This API is for Collection but I want to extract a single image by using only DRepresentation

I am trying to use this code:

org.eclipse.sirius.ui.business.api.dialect.DialectUIManager.INSTANCE.export(
											representation, session, fullOutputPath,
											new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.JPG),
											new NullProgressMonitor());

but by using this I get the popup message in Capell:
The following file is out of synchronization with the workspace:
output folder path (it is in the project )

Hi,

If you already have a representation, you can use Arrays.asList(representation) to create a collection with your representation.

The “The following file is out of synchronization with the workspace:” can be fixed by clicking on the project in Capella project explorer and do a “rightclick > refresh” on it.

Programmatically, you can retrieve a given project by its name
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
and do project.refreshLocal(IResource.DEPTH_INFINITE, null); on it.

Hello,

IPath absoluteImagePath = ResourcesPlugin.getWorkspace().getRoot()
											.getProject(p.getName()).getLocation().append("temp.jpg");

									org.eclipse.sirius.ui.business.api.dialect.DialectUIManager.INSTANCE.export(
											representation, session, absoluteImagePath,
											new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.JPG),
											new NullProgressMonitor());

now my code is work fine because I am passing path argument as file you can see in code.
it works fine.

Thank you for your help

Copyright © Eclipse Capella, the Eclipse Capella logo, Eclipse and the Eclipse logo are Trademarks of The Eclipse Foundation.