【问题标题】:Autodesk Forge Create ActivityAutodesk Forge 创建活动
【发布时间】:2020-09-20 02:17:24
【问题描述】:

我在 C# 中使用 Autodesk Forge DesignAutomatin V3,但在创建 Activity 时出现错误。

这是我收到的错误:System.IO.InvalidDataException: 'CommandLine 是 Activity 的必需属性,不能为空'

这是我设置活动的方式。

var activity = new Activity()
{
    CommandLine = new List<string>() { $"$(engine.path)\\accoreconsole.exe /i $(args[InputModel].path) /al $(appbundles[{_bundleId}].path) /s $(settings[script].path)" },
    Parameters = new Dictionary<string, ModelParameter>()
    {
        { "HostDwg", new ModelParameter() { Verb = ModelParameter.VerbEnum.Get, LocalName = "$(HostDwg)", Required = true } },
        { "InputModel", new ModelParameter() { Verb = ModelParameter.VerbEnum.Get, LocalName = "3DBuild.dxf", Required = true, } },
        { "Result", new ModelParameter() { Verb = ModelParameter.VerbEnum.Put, Zip = true, LocalName = _outPutFileName, Required = true } }
    },
    Engine = _engineVersion,
    Appbundles = new List<string>() { myApp },
    Settings = new Dictionary<string, dynamic>()
    {
        { "script", new StringSetting() { Value = string.Format("DXFIN\n\"3DBuild.dxf\"\nExplodeModel\n-view sw\nDXFOUT\n{0}\n16\n", _outPutFileName) } }
    },
    Description = "DXF processor",
    Version = 1,
    Id = _activityName
};

【问题讨论】:

    标签: c# autodesk-forge autodesk-designautomation


    【解决方案1】:

    请使用 v3 的专属设计自动化 .NET 核心 SDK,您似乎指的是来自 autodesk.forge 的设计自动化命名空间。 添加新 SDK 时,请确保从代码中删除 - using Autodesk.Forge.Model.DesignAutomation.v3;

    var activity = new Activity() {
     CommandLine = new List < string > () {
      $ "$(engine.path)\\accoreconsole.exe /i $(args[InputModel].path) /al $(appbundles[{PackageName}].path) /s $(settings[script].path)"
     }, Parameters = new Dictionary < string, Parameter > () {
      {
       "HostDwg",
       new Parameter() {
        Verb = Verb.Get, LocalName = "$(HostDwg)", Required = true
       }
      }, {
       "InputModel",
       new Parameter() {
        Verb = Verb.Get, LocalName = "3DBuild.dxf", Required = true,
       }
      }, {
       "Result",
       new Parameter() {
        Verb = Verb.Put, Zip = true, LocalName = outputFile, Required = true
       }
      }
     }, Engine = TargetEngine, Appbundles = new List < string > () {
      myApp
     }, Settings = new Dictionary < string, ISetting > () {
      {
       "script",
       new StringSetting() {
        Value = string.Format("DXFIN\n\"3DBuild.dxf\"\nExplodeModel\n-view sw\nDXFOUT\n{0}\n16\n", outputFile)
       }
      }
     }, Description = "DXF processor", Version = 1, Id = ActivityName
    };
    

    【讨论】:

      猜你喜欢
      • 2018-08-28
      • 2022-01-08
      • 2020-02-17
      • 2022-01-22
      • 1970-01-01
      • 2021-11-19
      • 2018-10-26
      • 2021-08-05
      • 2022-11-01
      相关资源
      最近更新 更多