簡體   English   中英

Autodesk Forge 創建活動

[英]Autodesk Forge Create Activity

我在 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
};

請使用v3專用的 Design Automation .NET core SDK ,看來您是指來自autodesk.forge的 Design Automation 命名空間。 添加新的 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
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM