I have several (AutoCAD) LISP scripts running locally with accoreconsole.exe I have tested some tutorials (.NET) with VS Code (APS extension) with success on APS Design API. I couldn't find somebody's else sample about running LISP files on API. As I am new to AutoCAD (but with vast experience from other CAD software), I am struggling creating a proper manifest (PackageContents.xml) All my combinations returned as timeouts from workitem output or no output. Question is: what is the minimum needed to "Hello World" from LISP script on APS Design API?
Many unsuccessful combinations
I made this trick. It looks like my uploaded bundle is nowhere.
[04/20/2024 13:57:21] Job information:
{
"CommandLine": [
"$(engine.path)\\\\accoreconsole.exe /al \"$(appbundles[Tiles].path)\" /i \"$(args[input_file].path)\" /s \"$(args[script].path)\""
],
"Settings": {
"dasOpenNetwork": {
"value": "true",
"isEnvironmentVariable": true
}
},
"Id": "ec72d663c37947b9891550f1764f2a14",
"ActivityId": "fossapp.tiles_function+current_run",
"EngineId": "Autodesk.AutoCAD_24_3!38",
"Apps": [
"fossapp.Tiles!2"
],
"BoundArguments": {
"input_file": {
"localName": "empty.dwg",
"url": "https://cdn.eu.oss.api.autodesk.com/Masked:9ICBgK73ybob2uTmNCesmQylGoU=",
"verb": "get"
},
"output_file": {
"localName": "empty.dwg",
"url": "https://cdn.eu.oss.api.autodesk.com/Masked:9ICBgK73ybob2uTmNCesmQylGoU=",
"verb": "get"
},
"script": {
"localName": "start.scr",
"url": "https://cdn.eu.oss.api.autodesk.com/Masked:cUgwHXBZyy4m2bs4EJWtVVnz58U=",
"verb": "get"
}
},
"Quotas": {
"limitProcessingTimeSec": 100,
"limitTotalUncompressedAppsSizeInMB": 500
}
}
[04/20/2024 13:57:21] Starting work item ec72d663c37947b9891550f1764f2a14
[04/20/2024 13:57:21] Start download phase.
[04/20/2024 13:57:21] Start downloading input: verb - 'Get', url - 'https://cdn.eu.oss.api.autodesk.com/oss/v2/signedresources/373c8dbe-c5c4-4099-b107-8fab051d603f?region=EMEA'
[04/20/2024 13:57:21] Start downloading input: verb - 'Get', url - 'https://cdn.eu.oss.api.autodesk.com/oss/v2/signedresources/373c8dbe-c5c4-4099-b107-8fab051d603f?region=EMEA'
[04/20/2024 13:57:21] Start downloading input: verb - 'Get', url - 'https://cdn.eu.oss.api.autodesk.com/oss/v2/signedresources/a86300ef-b384-4e6c-bb90-2dd096e0a637?region=EMEA'
[04/20/2024 13:57:22] End downloading file. Source=https://cdn.eu.oss.api.autodesk.com/oss/v2/signedresources/373c8dbe-c5c4-4099-b107-8fab051d603f?region=EMEA,LocalFile=T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14\empty.dwg,BytesDownloaded=16449,Duration=1101ms
[04/20/2024 13:57:22] End downloading file. Source=https://cdn.eu.oss.api.autodesk.com/oss/v2/signedresources/373c8dbe-c5c4-4099-b107-8fab051d603f?region=EMEA,LocalFile=T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14\empty.dwg,BytesDownloaded=16449,Duration=1167ms
[04/20/2024 13:57:23] End downloading file. Source=https://cdn.eu.oss.api.autodesk.com/oss/v2/signedresources/a86300ef-b384-4e6c-bb90-2dd096e0a637?region=EMEA,LocalFile=T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14\start.scr,BytesDownloaded=427,Duration=1689ms
[04/20/2024 13:57:23] End download phase successfully.
[04/20/2024 13:57:23] Start preparing script and command line parameters.
[04/20/2024 13:57:23] Command line: [ /al "T:\Aces\Applications\56ff0cbe334d8d66b36dadc387a1dfe5.fossapp.Tiles[2].package" /i "T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14\empty.dwg" /s "T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14\start.scr"]
[04/20/2024 13:57:23] End preparing script and command line parameters.
[04/20/2024 13:57:24] Start script phase.
[04/20/2024 13:57:24] Start AutoCAD Core Engine standard output dump.
[04/20/2024 13:57:24] Redirect stdout (file: T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14\tmp\accc34362).
[04/20/2024 13:57:24] AcCoreConsole: StdOutConsoleMode: processed-output: disabled,auto
[04/20/2024 13:57:24] AutoCAD Core Engine Console - Copyright 2023 Autodesk, Inc. All rights reserved. (U.61.Z.174)
[04/20/2024 13:57:24] Execution Path:
[04/20/2024 13:57:24] T:\Aces\AcesRoot\24.3\coreEngine\Exe\accoreconsole.exe
[04/20/2024 13:57:24] Current Directory: T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14
[04/20/2024 13:57:24] Isolating to regkey=HKEY_CURRENT_USER\SOFTWARE\AppDataLow\Software\Autodesk\CoreUser\WorkItem_ec72d663c37947b9891550f1764f2a14, userDataFolder=T:\Aces\Jobs\ec72d663c37947b9891550f1764f2a14\userdata.
[04/20/2024 13:57:24] Version Number: U.61.Z.174 (UNICODE)
[04/20/2024 13:57:24] LogFilePath has been set to the working folder.
[04/20/2024 13:57:25] Regenerating model.
[04/20/2024 13:57:25] AutoCAD menu utilities loaded.
[04/20/2024 13:57:25] Command:
[04/20/2024 13:57:25] Command:
[04/20/2024 13:57:25] Command:
[04/20/2024 13:57:25] Command: (defun c:listFiles ()
[04/20/2024 13:57:25] (_> (setq dir "./") ; Sets the directory to the current directory
[04/20/2024 13:57:25] (_> (setq files (vl-directory-files dir "*.*" 0)) ; Retrieve all files in the directory
[04/20/2024 13:57:25] (_> (if files
[04/20/2024 13:57:25] ((_> (foreach file files ; Loop through each file
[04/20/2024 13:57:25] (((_> (princ (strcat "\n" file)) ; Print each file name
[04/20/2024 13:57:25] (((_> )
[04/20/2024 13:57:25] ((_> (princ "\nNo files found in the directory.") ; If no files are found
[04/20/2024 13:57:25] ((_> )
[04/20/2024 13:57:25] (_> (princ) ; Clean exit
[04/20/2024 13:57:25] (_> )
[04/20/2024 13:57:25] C:LISTFILES
[04/20/2024 13:57:25] Command:
[04/20/2024 13:57:25] _HELP
[04/20/2024 13:57:25] Command: listFiles
[04/20/2024 13:57:25] .
[04/20/2024 13:57:25] ..
[04/20/2024 13:57:25] ec72d663c37947b9891550f1764f2a14.log
[04/20/2024 13:57:25] ec72d663c37947b9891550f1764f2a14_Job.das
[04/20/2024 13:57:25] empty.dwg
[04/20/2024 13:57:25] start.scr
[04/20/2024 13:57:25] tmp
[04/20/2024 13:57:25] userdata
[04/20/2024 13:57:25] Command:
[04/20/2024 13:57:26] End AutoCAD Core Engine standard output dump.
[04/20/2024 13:57:26] End script phase.
[04/20/2024 13:57:26] Start upload phase.
[04/20/2024 13:57:26] End upload phase successfully.
[04/20/2024 13:57:26] Job finished with result Succeeded
[04/20/2024 13:57:26] Job Status:
{
"status": "success",
"reportUrl": "https://dasprod-store.s3.amazonaws.com/workItem/fossapp/ec72d663c37947b9891550f1764f2a14/report.txt?X-Amz-Expires=4620&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEOb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCIG9FzTJFk5tVgUXpV1KFmivBGlO9KEW0RxoX3QMbTW4tAiBZlz43Jf2lyndyn5yo01OXeCwLWH6JxgoWEtk8hBTmuCqAAwgvEAQaDDIyMDQ3MzE1MjMxMCIM9h%2Fx3AvZcW%2Be95SmKt0C4A4CfCZF7dQu%2FyJLKTfrovrLbVRfOqEc1mx3O%2BRmvmFGxF6959YEZfng%2Bv70JGnz6PaUOvxfzf%2BbDgieEz7erloR2hz7xeedF63vMgGQVByuS7KTlBEgZPnf5FITEC89GmN6%2B%2Fn4f2P8CP1Ofq8w5gEx7iSBpmsuSA4tfu%2B9ipbm56gp8px3%2BCdHOA51NvHjPb%2FvVK2TPIfpeMINbAv836QuFKWiIMjWQDMP1fjYscEOCeJT6yBsViqzSpfsewUBCuV%2B%2BYMtwezJ7VL5%2FSlso87sHH1Sm%2F9DgVZtAjvobNl2TmyDG4iMreaH%2F8gyTxYqn4n9pL5UIOlvSqgs04KBYHlh2OCN4b7m5sR%2B%2FohHC0avnTN6c41wfLY1HsYV%2FZpgJCcEGJ%2B5IKA3Sm5t%2BPgyDmjuYVEWLTjBponJz7NsElY6LelOl4xh0FTBsotXAXyowtu8wJrQg%2Blu9S50zTCXh4%2BxBjqfAak7vazB5S5Hr8la%2BP%2BJHJyMd62vUhSfOhsqQwDbBn5R4tk%2FbcCAcMKAyuyzrSykHWvVYpbkSFFwzXmVA0Gdo%2FrWNjqwSaKDmCh8s5mt%2B7t82o7Qg1%2Bnjxj7Ze3B0wF3hWc2laMeb5m0xzdONcF46DQT%2BPiIrEWwbqRiAFBI2f3cE6ub6XJ5f8exeX%2FxLWzY3CUuwC2YsDKEqfR4lZFWzA%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIATGVJZKM3AQMZBIFL%2F20240420%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240420T135721Z&X-Amz-SignedHeaders=host&X-Amz-Signature=837818c967ae9c7dfaf063e8703b2d2acc6bcbabb4c02a7a3ef92bfa440fc4de",
"activityId": "fossapp.tiles_function+current_run",
"stats": {
"timeQueued": "2024-04-20T13:57:21.1790865Z",
"timeDownloadStarted": "2024-04-20T13:57:21.3155466Z",
"timeInstructionsStarted": "2024-04-20T13:57:23.1039712Z",
"timeInstructionsEnded": "2024-04-20T13:57:26.3474295Z",
"timeUploadEnded": "2024-04-20T13:57:26.3478875Z",
"bytesDownloaded": 33325
},
"id": "ec72d663c37947b9891550f1764f2a14"
}
Create a bundle with a Contents folder containing your Lisp files.
Within the Contents folder, add a file named PackageContents.xml
. This file will declare the Lisp module.
In your Activity
definition, use the load command within the Script parameter to load the desired Lisp file. The specific command to use will be defined within the Lisp file itself.
Here's an example of the bundle structure:
Let's say you have bundle of this structure.
AcTstLisp.bundle
│ PackageContents.xml
│
└───Contents
Hello.lsp
PackageContents.xml
<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0"
AutodeskProduct="AutoCAD"
ProductType="Application"
Name="Autolisp Testing"
Description="A sample app to test Autolisp scripts"
Author="Autodesk, Inc."
ProductCode="48535253-DE0F-45C2-8A1D-60D3F0E37EB4"
UpgradeCode="DCEE22CC-E4CD-4770-9A0D-3010C0C8BE9E"
AppVersion="1.0.0" >
<CompanyDetails Name="Autodesk, Inc."
Phone=""
Url="http://www.autodesk.com"
Email="">
</CompanyDetails>
<Components>
<RuntimeRequirements SupportPath="./Contents"
OS="Win64"
Platform="AutoCAD"
SeriesMin="R24.0"
SeriesMax="R24.3">
</RuntimeRequirements>
<ComponentEntry ModuleName="./Contents/Hello.lsp"
AppDescription="A sample lisp app for Design Automation for AutoCAD">
</ComponentEntry>
</Components>
</ApplicationPackage>
Hello.lsp
(defun c:hello ( / msg)
(setq msg (getstring T "\nEnter a message: "))
(alert msg)
)
(prompt "\nAutoLISP hello file loaded.")
(princ) ; Suppress the return value of the prompt function.
Activity:
{
"commandLine": [
"$(engine.path)\\accoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[AcTestLisp].path)\" /s \"$(settings[script].path)\""
],
"parameters": {
"inputFile": {
"verb": "get",
"required": true,
"localName": "$(HostDwg)"
},
"msg": {
"verb": "read",
"required": true
}
},
"id": "{{ _.activityId }}",
"engine": "Autodesk.AutoCAD+24_3",
"appbundles": [
"{{ _.client_id }}.AcTestLisp+prod"
],
"settings": {
"script": {
"value": "(load \"hello.lsp\")\n_HELLO\n$(args[msg].value)\n"
}
}
}
WorkItem
{
"activityId": "{{ client_id }}.{{ activityId }}+prod",
"arguments": {
"inputFile": {
"url": "http://download.autodesk.com/us/support/files/autocad_2015_templates/acad.dwt",
"verb": "get"
},
"msg": "Hello Autodesk!"
}
}
After uploading the bundle to DA server, running the above workitem for given activity should produce following output in the report.log
[04/29/2024 11:05:21] Command: (load "hello.lsp")
[04/29/2024 11:05:21] AutoLISP hello file loaded.
[04/29/2024 11:05:21] Command: _HELLO
[04/29/2024 11:05:21] Enter a message: Hello Autodesk!
[04/29/2024 11:05:21] ************************MessageBox****************************
[04/29/2024 11:05:21] AutoCAD Message
[04/29/2024 11:05:21] Hello Autodesk!
[04/29/2024 11:05:21] >>>Responding: OK.
[04/29/2024 11:05:21] **************************************************************
[04/29/2024 11:05:21] nil
[04/29/2024 11:05:21] Command:
[04/29/2024 11:05:22] End AutoCAD Core Engine standard output dump.