DWF export output empty file when revit model is big

DWF export output empty file when revit model is big

Raymond_Fan
Contributor Contributor
2,193 Views
12 Replies
Message 1 of 13

DWF export output empty file when revit model is big

Raymond_Fan
Contributor
Contributor

Hi,

 

In Revit 2016, I developed a plugin, which calls Document.Export API to export 3D View to DWFx file(One view only). I got a problem. In my case, the Revit project is quite big, which has 26 linked files. Dwfx export function always generate an empty dwfx file (file size is not zero, but cannot see anything inside), API result is 'True'.  Then I tried that, unload some linked files, it will work then.

 

So my question is, this is a known issue to DWF export function? Is there any limit of model size for DWF export function? My machine has 32GB memory, when DWF export function runs, used memory may reach to about 21GB, is it because memory is not enough? What can I do now? 

 

Anybody get the same problem as mine? Can this problem be solved?

 

Thanks,

Raymond

 

 

0 Likes
2,194 Views
12 Replies
Replies (12)
Message 2 of 13

Raymond_Fan
Contributor
Contributor

After further investigation, I think the problem maybe is not because of lack of memory. Because I didn't see the used memory reach to very high percentage, and the problem still come out.

 

I checked the temp folder during DWF export processing, there is one temp file named 'model_w3d_xx' generated, and this file was created at the last stage of DWF export, maybe it stores data to be written to the final dwfx file, I guess. If DWF export succeeds, the temp file will be gone; but if DWF file is created and no contents in it, I saw the temp file remained in the temp folder. So I think DWF export function failed at the last step to output data to dwfx file.  Sometimes I saw a few stream files were created before the final dwfx file was generated successfully. Does it use multi-threads to output file? Is it possible that multi-thread failed and caused the problem? And the problem happens when temp file size is not too big, in my test, the temp file is only about 50MB, and export may fail.

 

In my test, the DWF export function looks unreliable, sometimes I may export DWFx file successfully at the first time, but failed at the next time. That is very bad to my application, it becomes unreliable, too. 

 

I tried Revit2018, it has the same problem. 

 

I have upgraded Revit 2016 to latest update, but it doesn't help. 

 

Maybe the problem is not easy to reproduce if model size is not big. 

 

Can Autodesk Revit Developer help to clarify what problem it is here?

 

Thanks.

Raymond

0 Likes
Message 3 of 13

JimJia
Alumni
Alumni

Dear Raymond,

 

I'm communicating with engineering team, will keep you updated on any progress.

Thanks for your patience and cooperation.


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 4 of 13

JimJia
Alumni
Alumni

Dear Rong Fan,

 

I communicated with engineering team and I was told Revit ever had one similar issue REVIT-107587 [Exporting DWF/DWFx files from Revit results in empty (0kb) files], but the issue has been already fixed in Revit 2017.2, 2018.1 and later versions.

 

Can you help to share which Revit version you're using? can you help to check this against fixed versions above?

 

Thanks a lot for your great understand patience.


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 5 of 13

Raymond_Fan
Contributor
Contributor

I have tested my application in both Revit 2016 R2 Update7 and Revit 2018.2, both have the problem.

 

I read that issue you mentioned, but it is different, my case is, just export one 3D View to DWFx file, without exporting properties data and  texture, it has nothing to do with sheet, and output DWF file is not 0KB, it can be opened, just it is blank and no contents inside, Actually I tried the solution to Revit-107587 already, add 'ExportDwfNumberOfWorkers=0' into Revit.ini, it doesn't solve my problem.

 

Thanks,

Raymond

0 Likes
Message 6 of 13

JimJia
Alumni
Alumni

Dear rong fan, 

 

Thanks a lot for your prompt update and clarify!

 

can you provide a reproducible case for it?

 

In order to explore this matter further, we will need to provide a minimal reproducible case for the development team to analyse in depth.

 

In order to understand exactly what you mean and be able to research possible reasons for the discrepancy between the observed and expected behaviour, they require:
· A short exact description of what you are trying to achieve.
· The behavior you observe versus what you expect, and why this is a problem.
· A complete yet minimal Revit sample model to run a test in.
· A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyse its behavior live in the sample model.
· Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.
· http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 7 of 13

Raymond_Fan
Contributor
Contributor

Dear Jim Jia,

 

Sorry, the model I used in my test is customer's model which has sensitive data, so I cannot provide it. Hope your engineer may use your own model to investigate the issue. 

 

The problem is, after export 3D view to Dwfx file, dwfx is blank(DWFx file size is not 0kb and it can be opened in Design Review).

 

It is not hard to reproduce it, as long as the model is big enough. You just need create an empty host model, and add about 15 linked file, each linked file is about 100MB size, and then use Revit Export function to export current 3D view to DWFx file, the problem likely will come out. If first time it passed, do it again, the second export most likely will show the problem.

 

Problem can be reproduced in latest update of Revit2016, Revit2018.

 

Thanks,

Raymond

0 Likes
Message 8 of 13

JimJia
Alumni
Alumni

Dear Rong Fan,

 

It's challenging for me to setup the reproducible environment your mentioned to reproduce this case.

 

Can you help to narrow down the reproducible steps because you couldn't provide the reproducible .rvt models:
1: Can you ensure the issue occur only when the host links 15 models and each model must be large than 100M?
2: Can you provide the API export code? because DWGExportOptions has some properties which may impact the export.

 

Thanks for your understand and patience. 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 9 of 13

Raymond_Fan
Contributor
Contributor

I have a model, Autodesk_Hospital_Metric_Architectural, whose file size is about 100MB, and then I created a new model, linked that file in, and created 15 instances of the linked file (I used array function to create them), after that, I used Revit UI function to export the current 3d view to Dwfx file, in the option, I unchecked 'Element Properties' and 'Texture settings...' options, in this way, the problem can be reproduced, Dwfx file will blank.

 

I am using Revit 2016 R2 update 7, and my test machine has 16GB memory.

 

I tried to upload the file, but it is more that maximum file size that can be uploaded, if you really need that file, let me know, I may share it via Dropbox. 

 

 

0 Likes
Message 10 of 13

Mustafa.Salaheldin
Collaborator
Collaborator

Can you upload the file to any file hosting servers (e.g. 4Shared) and then send us the link?


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 11 of 13

Raymond_Fan
Contributor
Contributor

I post the model at TestDwfxExport.zip 

 

0 Likes
Message 12 of 13

Mustafa.Salaheldin
Collaborator
Collaborator

Hello

 

I was able successfully to create the DWFX of the attached file you sent in Revit 2016 R2 Update 6, and Revit 2017.2.1. Pleas find hereinafter the code I have written to do the task.

 

#region Namespaces

using System;
using System.Linq;
using Autodesk.Revit.Attributes;

using Autodesk.Revit.DB;

using Autodesk.Revit.UI;

//using Autodesk.Revit.Collections;

using RvtApplication = Autodesk.Revit.ApplicationServices.Application;
using RvtDocument = Autodesk.Revit.DB.Document;
using System.Diagnostics;

#endregion

namespace Toolbox
{
    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]
    public class DwfxExporter : IExternalCommand
    {
        #region Cached Variables

        private static ExternalCommandData _cachedCmdData;

        public static UIApplication CachedUiApp
        {
            get
            {
                return _cachedCmdData.Application;
            }
        }

        public static RvtApplication CachedApp
        {
            get
            {
                return CachedUiApp.Application;
            }
        }

        public static RvtDocument CachedDoc
        {
            get
            {
                return CachedUiApp.ActiveUIDocument.Document;
            }
        }

        #endregion

        #region IExternalCommand Members         

        public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elemSet)
        {
            _cachedCmdData = cmdData;

            try
            {
                View3D v = new FilteredElementCollector(CachedDoc).OfClass(typeof(View3D)).FirstOrDefault() as View3D;
                ViewSet vs = new ViewSet();
                vs.Insert(v);

                //TODO: add your code below.
                DWFXExportOptions opt = new DWFXExportOptions();
                opt.ExportTexture = true;
                opt.MergedViews = true;
                opt.StopOnError = true;
                opt.ExportTexture = true;
                opt.ExportObjectData = true;

                Stopwatch sw = new Stopwatch();

                sw.Start();

                using (Transaction trans = new Transaction(CachedDoc, "DWF Export"))
                {
                    trans.Start();
                    CachedDoc.Export("D:\\test", "test2016-API", vs, opt); // the actual export method as you have it
                    trans.Commit();
                }

                sw.Stop();

                TaskDialog.Show("Revit", string.Format("The export process time is {0}:{1}", sw.Elapsed.TotalMinutes.ToString(), sw.Elapsed.TotalSeconds.ToString()));
                return Result.Succeeded;
            }
            catch (Exception ex)
            {
                msg = ex.ToString();
                return Result.Failed;
            }
        }

        #endregion
    }
}

It took 8 minutes on a machine with i7 processor and 128 GB of RAM. I think this process is consuming a lot of memory on your machine that is why it fails.

Pleas try the code and tell me if it works because may be you are missing some settings of the export options.

If this reply satisfies your need pleas mark it as an answer.

 


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 13 of 13

Raymond_Fan
Contributor
Contributor

Hi Mustafa,

 

I have tried this model on another machine which is more powerful, it has i7 CPU and 32GB memory, using Revit 2016 R2 Update 7 to export the model to Dwfx, still got blank dwfx file.

 

In my addin, I use the same API to do Dwfx export, only DWFXExportOptions setting is different with yours, in my codes, I set following values,

 

dwfOptions.ExportObjectData = false;
dwfOptions.ExportingAreas = false;

dwfOptions.ExportTexture = false;

 

And then I changed dwfOptions.ExportTexture value to true and exported model again, to my surprise, Dwfx export succeeded, using Revit UI Export function to do the export, and enable Texture option, it also succeeded. I thought maybe it is because of this option, and then I tried to export another big model ( I found the issue with that model at the beginning) with the same options, but it still failed. 

 

After that, I changed Project2.rvt, and increased the instances of linked file to 20, the problem came out again even if Texture option is on. So I think changing Texture Option is not the answer to this issue.

 

From your machine, can you try that, if set export options as mine, will the problem come out?

 

I think, Revit native DWF/DWFx export function (in Revit UI) also failed , so something is wrong in native DWF export function, please help investigate it. 

 

Your machine has 128GB memory, which is very high configuration, I am not sure whether it is because of memory, I don't have the machine with the similar configuration, so cannot try it. Can you try it on some machine with less memory? Maybe it is easier to reproduce the problem.

 

Thanks,

Raymond

 

 

 

0 Likes