Autodesk Forge 创建活动
Posted
技术标签:
【中文标题】Autodesk Forge 创建活动【英文标题】:Autodesk Forge Create Activity 【发布时间】: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\n0\n16\n", _outPutFileName)
,
Description = "DXF processor",
Version = 1,
Id = _activityName
;
【问题讨论】:
【参考方案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\n0\n16\n", outputFile)
, Description = "DXF processor", Version = 1, Id = ActivityName
;
【讨论】:
以上是关于Autodesk Forge 创建活动的主要内容,如果未能解决你的问题,请参考以下文章
无法获取 Forge 清单 - Autodesk Forge 查看器
Autodesk Forge - 将文件作为块上传到 Node JS 中的 BIM 360 存储时出现 504 网关超时