0

I am using Autodesk Forge DesignAutomatin V3 in C# and am getting an error when creating an Activity.

this is the error i receive: System.IO.InvalidDataException: 'CommandLine is a required property for Activity and cannot be null'

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
};
Rahul Bhobe
  • 4,165
  • 4
  • 17
  • 32

1 Answers1

1

Please use exclusive Design Automation .NET core SDK for v3, it appears that you are referring Design Automation namespace from autodesk.forge. When you add new SDK, make sure you remove this - 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
};
Madhukar Moogala
  • 635
  • 1
  • 5
  • 11