Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

autodesk forge - Design Automation for Revit output zipped file is empty

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 ammount 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:AcesJobs18ff2cb40e7944e8a41b4f8c6360e493 esult as T:AcesJobs18ff2cb40e7944e8a41b4f8c6360e493 esult.zip. [02/05/2021 18:17:34] Uploading 'T:AcesJobs18ff2cb40e7944e8a41b4f8c6360e493 esult.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?

question from:https://stackoverflow.com/questions/66068894/design-automation-for-revit-output-zipped-file-is-empty

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...