0

I am trying to export 3d views from the Revit model to IFC. When I run my plugin locally, it works perfectly, and logs in DA4R are correct too, but the result of exporting is 22bytes(empty zip).

I've used this article as an example: https://forge.autodesk.com/blog/how-generate-dynamic-number-output-design-automation-revit-v3

Here is my activity:

{
"commandLine": [
    "$(engine.path)\\\\revitcoreconsole.exe  /al \"$(appbundles[ExportIfcFromZippedApp].path)\""
],
"parameters": {
    "inputFile": {
        "zip":true,
        "verb": "get",
        "description": "Input Revit model(zipped)",
        "required": true,
        "localName":"input"    
    },
"inputModelName":{
    "verb":"get",
     "description": "Additional parameters like : ModelName",
     "localName":"additionalParams.json"
},
    "inputJson": {
        "verb": "get",
        "description": "IFC Export Options",
        "localName": "params.json"
    },
    "outputFile": {
        "zip": true,
        "verb": "put",
        "description": "Ouput IFC views",
        "required": true,
        "localName": "result"
    }
},

Here is my Export

                    if (RuntimeValue.RunOnCloud)
                {
                    try
                    {
                        var res = doc.Export(Directory.GetCurrentDirectory() + "\\result", item.Name, exportOptions);
                        Console.WriteLine($"Log {item.Name} exported:{res}");
                        successItems++;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Log: Error in exporting {item.Name} view from {modelPath}");
                        Console.WriteLine($"{ex.Message}, {ex.Source}");
                        failureItems++;
                    }
                }

Console output:

[02/05/2021 18:17:21] Log: Total amount of 3d Views in the Autodesk.Revit.DB.FilePath : 22 [02/05/2021 18:17:21] Log: 3dViews to export: 2 [02/05/2021 18:17:25] Log ARK IFC-ekport exported:True [02/05/2021 18:17:26] Log ARK IFC-ekport emty exported:True [02/05/2021 18:17:26] Log: 3dViews to export: 2. Success:2. Failure: 0

[02/05/2021 18:17:31] entering finishPlayback .. destroy m_PlaybackState

continuing finishPlayback .. destroy callStream()

exited finishPlayback

[02/05/2021 18:17:31] Finished running. Process will return: Success

[02/05/2021 18:17:34] Zipping directory T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result as T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip. [02/05/2021 18:17:34] Uploading 'T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip': verb - 'PUT', url - 'https://developer.api.autodesk.com/oss/v2/buckets/ifc_export_external/objects/000001-01 Test Autoifc ARK.zip'

"stats": { "timeQueued": "2021-02-05T18:14:17.0325708Z", "timeDownloadStarted": "2021-02-05T18:14:17.314204Z", "timeInstructionsStarted": "2021-02-05T18:14:21.7983855Z", "timeInstructionsEnded": "2021-02-05T18:17:34.7014528Z", "timeUploadEnded": "2021-02-05T18:17:34.9939046Z", "bytesDownloaded": 88722885, "bytesUploaded": 22

UPDATE

It might be a problem with openning Users's Worksets. When i debug it localy, export result depends how i open my worksets. If I open all user worksets, export looks great, if i close all worksets, i am getting very small ifc files, but they are not empty, like in DA4R.

I use this in my plugin:

var openOptions = new OpenOptions();

  openOptions.DetachFromCentralOption = 
      DetachFromCentralOption.DetachAndPreserveWorksets;

  Console.WriteLine($"Log : DetachAndPreserveWorksets,");

  WorksetConfiguration openConfig = new 
  WorksetConfiguration(WorksetConfigurationOption.OpenAllWorksets);

  openOptions.SetOpenWorksetsConfiguration(openConfig);

  Document doc = rvtApp.OpenDocumentFile(modelPath, openOptions);

I've tried to do get User Workset Info

IList<WorksetPreview> worksets = WorksharingUtils.GetUserWorksetInfo(modelPath);

But i am getting an Error: "You shoul be Logged in to A360 to do that."

Also i found a solution to open worksets when the document is open: https://forums.autodesk.com/t5/revit-api-forum/open-closed-worksets-in-open-document/td-p/6238121

This example uses : uidoc.ShowElements(ElementId), but uidoc is part of UI component, so it is not supporrted by DA4R.

UPDATE

I've logged all worksets, all of them are opened and vissible by default.

How can I sort out the problem?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    From what I read, the output in the folder might be just empty. We have no way the check what's inside since the job folders are always cleaned up when the job is done. Could you try add more logging in your addin to see if there is file(e.g. the file size) as the export result in the folder before we zip and upload it? – Emma Zhu Feb 05 '21 at 19:04
  • I've tried to log files inside the result directory, but i had an error – Volodymyr Dobrzhanskyi Feb 05 '21 at 19:08
  • 1
    What error you have? also could you provide WorkItem Id which had the logging err? – Emma Zhu Feb 05 '21 at 19:40
  • Here is the id: 18ff2cb40e7944e8a41b4f8c6360e493. It is not even an error, Logging is ignored – Volodymyr Dobrzhanskyi Feb 05 '21 at 20:01
  • 1
    For logging on DA try to use ```Trace.TraceInformation``` and ```Trace.TraceError``` instead of ```Console.WriteLine``` (In DA 4 Inventor I use this and logging works perfectly) – Michael Navara Feb 06 '21 at 08:22
  • Thank you, I'll try. Perhaps my logging wasn't ignored , the result folder was empty, and there were no files to Enumerate . – Volodymyr Dobrzhanskyi Feb 06 '21 at 10:03
  • I just saw your updates, but what is the exact problem you have now? – Emma Zhu Feb 09 '21 at 06:04

1 Answers1

2

In my case, the problem was caused by the IFCExportOptions

options.AddOption("ExportSchedulesAsPsets","true")

When I set it to "false", output was not empty.

By the way, on local debug, it worked with both options.