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

Fix export linked file using api #782

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mostafa901
Copy link

@mostafa901 mostafa901 commented Jun 14, 2024

This fix is targeting exporting Linked Revit files via Revit Api. not through the UI,
The implementation was already set but very coupled to the UI, I separated the export code, and placed it in another IFCLinkDocumentExporter. We may change the name " I don't like long ones"

usage via API is straight forward:

Document doc = uidoc.Document;
View view = uidoc.ActiveGraphicalView;
IFCExportOptions ifcOptions = new IFCExportOptions();

IFCExportConfiguration configExporter= IFCExportConfiguration.CreateDefaultConfiguration();
configExporter.IFCVersion = IFCVersion.IFC2x3;
configExporter.UseActiveViewGeometry = true;
configExporter.UpdateOptions(ifcOptions, view.Id);

configExporter.ExportLinkedFiles = LinkedFileExportAs.ExportSameProject;
doc.Export(@"d:\", "IFC_TestSampleFile", ifcOptions);

// if separated
configExporter.ExportLinkedFiles = LinkedFileExportAs.ExportAsSeparate;
configExporter.LinkExporter.ExportSeparateDocuments(@"d:\IFC_TestSampleFile"); 

This is tested over Revit 2025
I have also made a workaround sample till this is merged over here

@mostafa901 mostafa901 force-pushed the fix-Export-linked-file-using-api branch from ba857ea to f0d0130 Compare June 15, 2024 03:11
@denizmaral
Copy link

Thank you very much for that! I also struggled to export it via API. In Revit 2024 we shelved that functionality because we did not have much time to find a solution. I hope your pull request will be accepted and will be released soon.

FYI: @andydandy74

@o-babii
Copy link
Collaborator

o-babii commented Jun 20, 2024

Hi @mostafa901 ,

Thank you for this submission and detailed description, we will look into your approach and consider implementing this fix.

Regards,
Oleksandr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants