简体   繁体   English

Autodesk Forge 创建活动

[英]Autodesk Forge Create Activity

I am using Autodesk Forge DesignAutomatin V3 in C# and am getting an error when creating an Activity.我在 C# 中使用 Autodesk Forge DesignAutomatin V3,在创建 Activity 时出现错误。

this is the error i receive: System.IO.InvalidDataException: 'CommandLine is a required property for Activity and cannot be null'这是我收到的错误:System.IO.InvalidDataException:'CommandLine 是 Activity 的必需属性,不能为空'

Here is how i am setting up the 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
};

Please use exclusive Design Automation .NET core SDK forv3 , it appears that you are referring Design Automation namespace from autodesk.forge .请使用v3专用的 Design Automation .NET core SDK ,看来您是指来自autodesk.forge的 Design Automation 命名空间。 When you add new SDK, make sure you remove this - using Autodesk.Forge.Model.DesignAutomation.v3;添加新的 SDK 时,请确保删除它 - using Autodesk.Forge.Model.DesignAutomation.v3; from your code.从你的代码。

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