Design Automation API for AutoCAD:AppBundle 内のコンテンツ利用

Design Automation API for AutoCAD を利用する場合、パラメータによって、AppBundle に同梱したファイルを変化させて異なる内容の成果ファイルを作成したいことがあります。

3Dモデルの卓上扇風機の構成ツール。色の選択オプションと価格表示が含まれています。

例えば、パターン別に複数のレンダリング画像を Rendering フォルダに用意、AppBundle に同梱して、パラメータによってレンダリング画像を使い分けるような場面を想定してみます。

A folder structure showing rendering images for AutoCAD, including various color options and a list of PNG files.
PackageContents.xml file structure showing the Rendering folder with a font file and various DLLs related to the CreateQuotation add-in for AutoCAD.

WorkItem 実行時、Design Automation API は AppBundle 内のファイルをフラットに実行環境のルートフォルダに転換するわけではありません。サブフォルダで同梱したファイルは、展開されたアドインのパスを使って絶対パスとして解決するのが現実的です。

Rendering フォルダに同梱したレンダリング画像をアドインからパス解決して図面に貼り付けるには、次のようなアドインコードが必要です。

Code snippet demonstrating how to attach a rendered image from a specified path in the Rendering folder within an AppBundle for use in an AutoCAD add-in.

これにより、適切にレンダリング画像を使い分けることが出来ます。AppBundle に同梱したブロック図面を挿入するような場面でも、この方法を利用することが出来ます。

By Toshiaki Isezaki


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading