Design Automation for AutoCAD: Command Method Not Getting Called

Design Automation for AutoCAD: Command Method Not Getting Called

h_celikJASY7
Participant Participant
968 Views
3 Replies
Message 1 of 4

Design Automation for AutoCAD: Command Method Not Getting Called

h_celikJASY7
Participant
Participant

Hello,

I am currently working on a project using Design Automation for AutoCAD and I'm encountering an issue where my command method is not getting called. I have a .NET application that defines a command method, a command script that calls this command, and an activity that runs this command script. However, when I run the activity, the command method does not seem to be executed.

Here are the relevant parts of my code:

 

MainApp.cs

 

using System;
using Autodesk.AutoCAD.Runtime;
using MergeDwgs;

[assembly: CommandClass(typeof(Commands))]
[assembly: ExtensionApplication(null)]

namespace MergeDwgs
{
    public class Commands
    {
        [CommandMethod("MergeDwg")]
        public static void MergeDwg()
        {
            Console.WriteLine("Starting program");
        }
    }
}

 

 

commands.scr

 

MergeDwg

 

 

Activity

 

{
  "commandLine": [
    "$(engine.path)\\\\accoreconsole.exe /i \"$(args[emptyInputFile].path)\" /al \"$(appbundles[MergeDwgs].path)\" /s \"$(args[scriptFile].path)\""
  ],
  "parameters": {
    "emptyInputFile": {
      "verb": "get",
      "description": "Empty Input DWG File",
      "required": true,
      "localName": "empty.dwg"
    },
    "outputFile": {
      "verb": "put",
      "description": "Output Merged DWG File (same as input file for now)",
      "localName": "empty.dwg"
    },
    "scriptFile": {
      "verb": "get",
      "description": "Script File",
      "required": true,
      "localName": "commands.scr"
    }
  },
  "id": "USERID.MergeDwgs",
  "engine": "Autodesk.AutoCAD+24_3",
  "appbundles": [
    "USERID.MergeDwgs+dev"
  ],
  "description": "Merges multiple DWG files into a single DWG file"
}

 

 

I've checked the logs and there are no error messages or exceptions. The command script is correctly formatted and includes the `MergeDwg` command. The .NET application is correctly defining the `MergeDwg` command and is correctly compiled into a DLL. The AppBundle includes all the necessary files and is correctly uploaded to Design Automation. The activity definition is correctly referencing the AppBundle and the command script.

Despite all this, the command method is not getting called. Here is the log from the work item:

 

 

Starting work item e35e536ff2914a4f9c310bd91eab54fc
Start download phase.
Start downloading input: verb - 'GET', url - 'urn:adsk.objects:os.object:BUCKET/empty.dwg'
Start downloading input: verb - 'GET', url - 'urn:adsk.objects:os.object:BUCKET/commands.scr'
End downloading file. Source=urn:adsk.objects:os.object:BUCKET/commands.scr,LocalFile=T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc\commands.scr,BytesDownloaded=11,Duration=2039ms
End downloading file. Source=urn:adsk.objects:os.object:BUCKET/empty.dwg,LocalFile=T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc\empty.dwg,BytesDownloaded=18123,Duration=2216ms
End download phase successfully.
Start preparing script and command line parameters.
Command line: [ /i "T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc\empty.dwg" /al "T:\Aces\Applications\6beaa06f3e6233f9c86eec9d7e171a7c.4w6wjxIxixxtVckrPuLaJYtSun3tKohb.SwoopDaAddinMergeDwgs[1].package" /s "T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc\commands.scr"]
End preparing script and command line parameters.
Start script phase.
Start AutoCAD Core Engine standard output dump.
Redirect stdout (file: T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc\tmp\accc2282).
AcCoreConsole: StdOutConsoleMode: processed-output: disabled,auto
AutoCAD Core Engine Console - Copyright 2023 Autodesk, Inc.  All rights reserved. (U.61.0.160)
Execution Path:
T:\Aces\AcesRoot\24.3\coreEngine\Exe\accoreconsole.exe
Current Directory: T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc
Isolating to regkey=HKEY_CURRENT_USER\SOFTWARE\AppDataLow\Software\Autodesk\CoreUser\WorkItem_e35e536ff2914a4f9c310bd91eab54fc, userDataFolder=T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc\userdata.
Version Number: U.61.0.160 (UNICODE)
LogFilePath has been set to the working folder.
Regenerating model.
AutoCAD menu utilities loaded.
Command:
Command:
Command:
End AutoCAD Core Engine standard output dump.
End script phase.
Start upload phase.
Uploading 'T:\Aces\Jobs\e35e536ff2914a4f9c310bd91eab54fc\empty.dwg': verb - 'PUT', url - 'urn:adsk.objects:os.object:BUCKET/output.dwg'
End upload phase successfully.
Job finished with result Succeeded
Job Status:

 

 

As you can see, the work item completes successfully, but the command method is not called. Any help would be greatly appreciated.

Best

0 Likes
Accepted solutions (1)
969 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor

you may get better feedback posting in the .net forum:

https://forums.autodesk.com/t5/net/bd-p/152


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 4

JamesMaeding
Advisor
Advisor

all that command does is issue a message. Where is the code that actually merges the drawings?

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 4 of 4

h_celikJASY7
Participant
Participant
Accepted solution
0 Likes