-
Notifications
You must be signed in to change notification settings - Fork 18
Design Automation tutorial review #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9e1b0b9
b82db86
8a0a583
03e583f
a49fd0b
a7be09c
9a774f9
8aebbe1
9c99d34
727281f
1107d91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# Define an Activity | ||
|
||
Activity is the specification of an action that can be executed using a specified engine. It specifies the number of input and output files, and the AppBundle and entry-point to use. | ||
Activity is the specification of an action that can be executed using a specified engine. It specifies: the number of input and output files, the AppBundle and an entry-point to use. | ||
|
||
In this tutorial sample, the activity has 2 inputs (file & JSON data) and 1 output (file). | ||
|
||
> It's worth mentioning again the Design Automation documentation for [entities](https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/field-guide/), where you can see the relation between them in [Entity Relationships](https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/field-guide/#entity-relationships) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thinking if this image help or not... my perception is that is too complicated, considering this is a basic tutorial, but open to suggestions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree it can be confusing to show this at the beginning of the tutorial, but this comment is done in purpose in an advanced moment of the tutorial, when creating the Activity, to clarify possible doubts with the API entities (Activity vs Engine vs Workitem vs AppBundle) and the relation between them. At this point, introducing the concept of activity, the rest of the items have to be clear, because in terms of logic-relation is the one which unites them :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe move that as a "learn more" in the first paragraph? so we keep the 1st paragraph as general info, the 2nd as the call to action. |
||
|
||
Choose your language: [Node.js](designautomation/activity/nodejs) | [.NET Core](designautomation/activity/netcore) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,30 @@ To define the activity we'll need the executable and the default file extension. | |
/// </summary> | ||
private dynamic EngineAttributes(string engine) | ||
{ | ||
if (engine.Contains("3dsMax")) return new { commandLine = "$(engine.path)\\3dsmaxbatch.exe -sceneFile \"$(args[inputFile].path)\" $(settings[script].path)", extension = "max", script = "da = dotNetClass(\"Autodesk.Forge.Sample.DesignAutomation.Max.RuntimeExecute\")\nda.ModifyWindowWidthHeight()\n" }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was intentionally left in a single line, to keep it short, and considering this piece won't change much |
||
if (engine.Contains("AutoCAD")) return new { commandLine = "$(engine.path)\\accoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{0}].path)\" /s $(settings[script].path)", extension = "dwg", script = "UpdateParam\n" }; | ||
if (engine.Contains("Inventor")) return new { commandLine = "$(engine.path)\\inventorcoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{0}].path)\"", extension = "ipt", script = string.Empty }; | ||
if (engine.Contains("Revit")) return new { commandLine = "$(engine.path)\\revitcoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{0}].path)\"", extension = "rvt", script = string.Empty }; | ||
if (engine.Contains("3dsMax")) | ||
return new { | ||
commandLine = "$(engine.path)\\3dsmaxbatch.exe -sceneFile \"$(args[inputFile].path)\" $(settings[script].path)", | ||
extension = "max", | ||
script = "da = dotNetClass(\"Autodesk.Forge.Sample.DesignAutomation.Max.RuntimeExecute\")\nda.ModifyWindowWidthHeight()\n" | ||
}; | ||
if (engine.Contains("AutoCAD")) | ||
return new { | ||
commandLine = "$(engine.path)\\accoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{0}].path)\" /s $(settings[script].path)", | ||
extension = "dwg", | ||
script = "UpdateParam\n" | ||
}; | ||
if (engine.Contains("Inventor")) | ||
return new { | ||
commandLine = "$(engine.path)\\inventorcoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{0}].path)\"", | ||
extension = "ipt", | ||
script = string.Empty | ||
}; | ||
if (engine.Contains("Revit")) | ||
return new { | ||
commandLine = "$(engine.path)\\revitcoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{0}].path)\"", | ||
extension = "rvt", | ||
script = string.Empty | ||
}; | ||
throw new Exception("Invalid engine"); | ||
} | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
# Prepare a plugin | ||
# Prepare an AppBundle (plugin) | ||
|
||
Design Automation uses .bundle just like the Autodesk App Store, meaning you need to create a `PackageContents.xml` and a ZIP with the `DLL` (and other required files). For detailed information on how to create them, please visit [Autodesk App Store Developer Center](https://www.autodesk.com/developer-network/app-store). | ||
At this section we will create a basic plugin or AppBundle that searches for the Windows in the scene model tree and updates the `width` and `height` parameters of it, saving the resulting file as a new file. | ||
|
||
At this section we will create a basic plugin that update `width` and `height` parameter and save the resulting file. Also the supporting files (`PackageContents.xml`) and the folder structure to place them. Finally create a .ZIP file ready to upload to Design Automation. | ||
Design Automation uses .bundle just like the Autodesk App Store. For it, a `PackageContents.xml` descriptor file will be created and ZIP together with the `DLL` and other possible required files. For detailed information on how to create them, please visit [Autodesk App Store Developer Center](https://www.autodesk.com/developer-network/app-store). The created ZIP AppBundle file will be uploaded. | ||
|
||
### Prerequisites | ||
|
||
- **7zip**: use to create the .ZIP with bundle files, please install [from here](https://www.7-zip.org/). This tutorial assumes **7zip** is installed on the default folder: _C:\Program Files\7-Zip\7z.exe_. | ||
|
||
### Additional prerequisites | ||
#### Additional prerequisites | ||
|
||
For the next session you can use the pre-build plugin. Or if you decide to build it, you will need: | ||
|
||
- **Visual Studio**: Visual Studio 2017 or newer is required, please visit [this link](https://visualstudio.microsoft.com/vs/). | ||
|
||
- **AutoCAD, Inventor, Revit or 3ds Max**: In order to develop, test and debug your Design Automation plugin: [AutoCAD](https://www.autodesk.com/products/autocad/overview) | [Inventor](https://www.autodesk.com/products/inventor/overview) | [Revit](https://www.autodesk.com/products/revit/overview) | [3ds Max](https://www.autodesk.com/products/3ds-max/overview). | ||
- **AutoCAD, Inventor, Revit or 3ds Max**: In order to develop, compile, test and debug your Design Automation plugin, you will need the respective application installed: [AutoCAD](https://www.autodesk.com/products/autocad/overview) | [Inventor](https://www.autodesk.com/products/inventor/overview) | [Revit](https://www.autodesk.com/products/revit/overview) | [3ds Max](https://www.autodesk.com/products/3ds-max/overview). | ||
|
||
*** | ||
|
||
For the next step, choose the **Engine**, which is the Autodesk application where you plugin will run. You'll need the respective application installed in order to compile, debug and test locally. | ||
|
||
Choose the engine: [AutoCAD](/designautomation/appbundle/engines/autocad) | [Inventor](/designautomation/appbundle/engines/inventor) | [Revit](/designautomation/appbundle/engines/revit) | [3ds Max](/designautomation/appbundle/engines/max) | ||
The **Engine** is the Autodesk application where your plugin or App will run. Choose the engine you will use: | ||
[AutoCAD](/designautomation/appbundle/engines/autocad) | [Inventor](/designautomation/appbundle/engines/inventor) | [Revit](/designautomation/appbundle/engines/revit) | [3ds Max](/designautomation/appbundle/engines/max) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Upload app bundle | ||
# Create and upload AppBundle | ||
|
||
Now the ZIP bundle is ready, let's upload to Design Automation. | ||
Now that the ZIP AppBundle is ready, let's upload it to Design Automation. | ||
|
||
Choose your language: [Node.js](designautomation/appbundle/nodejs) | [.NET Core](designautomation/appbundle/netcore) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, maybe we should keep it consistent, upper case (AppBundle, Activity, Workitem)