0

Problem

I'm trying to run LISP script on APS Automation API with AppBundle. I want to convert some fonts that is not supported by default API by including shx/ttf files and lisp file to activate it.

I've tried many times changing my PackageContents.xml and Activity / WorkItem. At first try, it successfully installed ttf files. (I'm not sure about shx because it didn't showed on WorkItem report log.) But, It didn't found my LISP.

[10/25/2025 20:40:47] INFO: Isolation create time: 144 ms.
[10/25/2025 20:40:47] Install user TrueType font "C:\DARoot\Applications\6b49a2ed52d98a56c9d3b23e6edf4e60.BCS_DWG_TO_PDF.PlotWithFonts[21].package\Contents\Fonts\gulim.ttc".
[10/25/2025 20:40:47] Install user TrueType font "C:\DARoot\Applications\6b49a2ed52d98a56c9d3b23e6edf4e60.BCS_DWG_TO_PDF.PlotWithFonts[21].package\Contents\Fonts\zebe_DDunG9.ttf".
[10/25/2025 20:40:47] Install user TrueType font "C:\DARoot\Applications\6b49a2ed52d98a56c9d3b23e6edf4e60.BCS_DWG_TO_PDF.PlotWithFonts[21].package\Contents\Fonts\zebe_Donguri9.ttf".
[10/25/2025 20:40:47] Version Number: V.101.Z.142 (UNICODE)
[10/25/2025 20:40:47] LogFilePath has been set to the working folder.
[10/25/2025 20:40:47] Missing font.  Text may not plotRegenerating model.
[10/25/2025 20:40:48] AutoCAD menu utilities loaded.
[10/25/2025 20:40:48] Command:
[10/25/2025 20:40:48] Command:
[10/25/2025 20:40:48] Command:
[10/25/2025 20:40:48] Command: (load "hello.lsp")
[10/25/2025 20:40:48] ; error: LOAD failed: "hello.lsp"
[10/25/2025 20:40:48] Command: HELLO
[10/25/2025 20:40:48] Unknown command "HELLO".  Press F1 for help.

So, I changed my PackageContents.xml and Bundle a few times and now it's failing on downloading jobs and it's where i'm stuck.

[10/27/2025 19:38:18] End download phase successfully.
[10/27/2025 19:38:18] Error: Failed to prepare app package(s). DasZip failed with exit code = 1
[10/27/2025 19:38:20] Error: An unexpected error happened during phase Downloading of job.
[10/27/2025 19:38:20] Job finished with result FailedEnvironmentSetup
[10/27/2025 19:38:20] Job Status:

Current Codes

PackageContents.xml

<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" 
                    AppVersion="1.0"
                    Name="MyPackageName"
                    Description="MyDescriptions"
                    Author="MyAuthorName">
  <Components>
    <RuntimeRequirements SupportPath="./Contents"
                         OS="Win64"
                         Platform="AutoCAD">
    </RuntimeRequirements>
    <ComponentEntry ModuleName="./Contents/total.lsp"
                    AppDescription="changing fonts and plot">
    </ComponentEntry>
    <SupportPaths>
      <SupportPath>Contents</SupportPath>
      <SupportPath>Contents/Fonts</SupportPath>
      <SupportPath>Contents/Support</SupportPath>
      <SupportPath>Contents/Scripts</SupportPath>
    </SupportPaths>
  </Components>
</ApplicationPackage>

Bundle File Structure

MyBundle
|
+--PackageContents.xml
|
+--Contents
   |
   +--total.lsp
   |
   +--Fonts
      |
      +--ghs.shx
      +--ghd.shx
      +--gulim.ttf

total.lsp

(defun c:START ( / ss i ent entData)

  (if (not (tblsearch "style" "KOREAN_STYLE"))
    (progn
      (entmake
        (list
          (cons 0 "STYLE")
          (cons 2 "KOREAN_STYLE")
          (cons 3 "simplex.shx")
          (cons 4 "ghs.shx")
          (cons 40 0.0)
          (cons 50 0.8)
          (cons 70 0)
        )
      )
    )
  )

  (setq ss (ssget "_X" '((0 . "TEXT,MTEXT,ATTRIB,ATTDEF"))))
  (if ss
    (progn
      (setq i 0)
      (while (< i (sslength ss))
        (setq ent (ssname ss i))
        (setq entData (entget ent))
        (entmod (subst (cons 7 "KOREAN_STYLE") (assoc 7 entData) entData))
        (setq i (1+ i))
      )
    )
  )

  (command "_ZOOM" "E")
  (command "-PLOT" "Y"
           "AutoCAD PDF (Web and Mobile).pc3"
           "ISO_full_bleed_A3_(420.00_x_297.00_MM)"
           "M" "L" "N"
           "Extents"
           "Fit" "Center" "Y"
           "monochrome.ctb"
           "Y" "A" "input.pdf"
           "N" "Y")

  (princ "\n[Complete: KOREAN_STYLE + PDF Plot]")
  (princ)
)

Activity

{
 "commandLine": [
  "$(engine.path)\\accoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[PlotWithFonts].path)\" /s \"$(settings[script].path)\""
    ],
  "parameters": {
    "inputFile": {
      "zip": false,
      "ondemand": false,
      "verb": "get",
      "description": "Input drawing file",
      "localName": "input.dwg"
    },
    "outputFile":{
        "zip":false,
        "ondemand":false,
        "verb":"put",
        "localName":"input.pdf"
    }
  },
  "engine": "Autodesk.AutoCAD+25_0",
  "appbundles": [
    "{{dasNickName}}.{{dasAppBundleName}}+{{dasAppBundleAlias}}"
  ],
    "settings": {
        "script": {
            "value": "(load \"total.lsp\")\n_START\n"
        }
    }
}

Also, if there is simpler way to change fonts to support HJK of drawings in automation API please let me know. (Some dwg files use custom fonts that's not converted well on plot)

1 Answer 1

0

I have answered here in detail

https://github.com/MadhukarMoogala/aps-automation-customfonts

You need to use following PackageContents.xml, please note GHS.shx and GHD.shx, will not work with Unicode Korean characters, they are suitable for DBCS or old single\double byte character.

For Unicode, please use `romans.shx` + `whtmtxt.shx`
or prefer TTF font like Arial MS Unicode.

<?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>
        <!--This is an example to show how you can concatenate multiple support paths-->
        <RuntimeRequirements SupportPath="./Contents;./Contents/Fonts" OS="Win64" Platform="AutoCAD" SeriesMin="R25.0" SeriesMax="R25.1"/>
        <!--This an example to show how you can add multiple LISP files-->
        <ComponentEntry ModuleName="./Contents/CallPlot.lsp" AppDescription="Lisp file to plot"/>
        <ComponentEntry ModuleName="./Contents/fontStyle.lsp" AppDescription="Lisp file to substitute font styles"/>
    </Components>
</ApplicationPackage>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.