My requirement is to convert DWG to DXF , need quick help to understand the process using Design API v3 and .net c# , and I want to use all DWG files from local computer and output also should happen locally. There is no reference for this anywhere , I am totally new to Design Automation API.
`
var workItemStatus = await api.CreateWorkItemAsync(new WorkItem()
{
ActivityId = myActivity,
Arguments = new Dictionary<string, IArgument>()
{
{ "input", new XrefTreeArgument() { Url = UploadUrl } },
{ "params", new XrefTreeArgument() { Url = $"data:application/json, {JsonConvert.SerializeObject(new CrxApp.Parameters { ExtractBlockNames = true, ExtractLayerNames = true })}" } },
{ "result", new XrefTreeArgument() { Verb=Verb.Put, Url = DownloadUrl } }
}
});
`
Also want to understand the params to convert from DWG to DXF, I have no AutoCad installed. Ex. "params", new XrefTreeArgument()
DXFOUT
Sample Activity Spec in .NET core
private async Task<string> SetupActivityAsync(string myApp = null)
{
Console.WriteLine("Setting up activity...");
var myActivity = $"{Owner}.{ActivityName}+{Label}";
var actResponse = await this.api.ActivitiesApi.GetActivityAsync(myActivity, throwOnError: false);
/*
* The default or basic CommandLine syntax, for this application we don't need bundle.
* CommandLine = new List<string>()
{
$"$(engine.path)\\accoreconsole.exe /i $(args[inputFile].path) /al $(appbundles[{PackageName}].path) /s $(settings[script].path)"
},
*/
var activity = new Activity()
{
CommandLine = new List<string>()
{
$"$(engine.path)\\accoreconsole.exe /i $(args[inputFile].path) /s $(settings[script].path)"
},
Engine = TargetEngine,
Settings = new Dictionary<string, ISetting>()
{
{ "script", new StringSetting() { Value = "DXFOUT\nresult.dxf\n\n" } }
},
Parameters = new Dictionary<string, Parameter>()
{
{ "inputFile", new Parameter() { Verb= Verb.Get, LocalName = "$(HostDwg)", Required = true } },
{ "outputFile", new Parameter() { Verb= Verb.Put, LocalName = "result.dxf", Required= true} }
},
Id = ActivityName
};
if(myApp != null)
{
activity.Appbundles = new List<string>()
{
myApp
};
}
if (actResponse.HttpResponse.StatusCode == HttpStatusCode.NotFound)
{
Console.WriteLine($"Creating activity {myActivity}...");
await api.CreateActivityAsync(activity, Label);
return myActivity;
}
await actResponse.HttpResponse.EnsureSuccessStatusCodeAsync();
Console.WriteLine("\tFound existing activity...");
if (!Equals(activity, actResponse.Content))
{
Console.WriteLine($"\tUpdating activity {myActivity}...");
await api.UpdateActivityAsync(activity, Label);
}
return myActivity;
}