Skip to content

Commit 5369eba

Browse files
committed
Initial commit.
0 parents  commit 5369eba

35 files changed

+2364
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Docs/Details.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# AppBundle, Activity, WorkItem description and examples
2+
3+
## App bundle definition
4+
```json
5+
{
6+
"alias": "prod",
7+
"receiver": "everyone",
8+
"body": {
9+
"id": "ChangeParams",
10+
"engine": "Autodesk.Inventor+22",
11+
"description": "Change parameters"
12+
}
13+
}
14+
```
15+
## Activity definition
16+
17+
Activity has two optional outputs. One gets generated for IPT files (`OutputIpt` parameter), another for ZIP with assemblies and drawing document (`OutputIam` parameter).\
18+
Say - if activity used for IPT generation then work item should use `OutputIpt` argument, see sample workitems below.
19+
20+
```json
21+
{
22+
"alias": "prod",
23+
"receiver": "everyone",
24+
"body": {
25+
"id": "ChangeParams",
26+
"commandLine": "$(engine.path)\\InventorCoreConsole.exe /i $(args[InventorDoc].path) /al $(apps[ChangeParams].path) $(args[InventorParams].path)",
27+
"parameters": {
28+
"InventorDoc": {
29+
"verb": "get",
30+
"description": "IPT file or ZIP with assembly to process"
31+
},
32+
"InventorParams": {
33+
"verb": "get",
34+
"description": "JSON with changed Inventor parameters",
35+
"localName": "params.json"
36+
},
37+
"OutputIpt": {
38+
"zip": false,
39+
"ondemand": false,
40+
"optional": true,
41+
"verb": "put",
42+
"description": "IPT with the changed parameters",
43+
"localName": "ResultDoc.ipt"
44+
},
45+
"OutputIam": {
46+
"zip": false,
47+
"ondemand": false,
48+
"optional": true,
49+
"verb": "put",
50+
"description": "ZIP with assembly with the changed parameters",
51+
"localName": "Result.zip"
52+
}
53+
},
54+
"engine": "Autodesk.Inventor+22",
55+
"apps": [ "Inventor.ChangeParams+prod" ],
56+
"description": "Change parameters of a part or an assembly."
57+
}
58+
}
59+
```
60+
## Work items
61+
The activity can process both Inventor parts and Inventor assemblies. In case of assembly the input file is ZIP archive with the assembly and its dependents.\
62+
In both samples the input parameters are passed as inlined JSON:
63+
```json
64+
"InventorParams": {
65+
"url": "data:application/json,{\"SquarePegSize\":\"0.24 in\"}"
66+
},
67+
```
68+
### IPT processing
69+
```json
70+
{
71+
"activityId": "Inventor.ChangeParams+prod",
72+
"arguments": {
73+
"InventorDoc": {
74+
"url": "http://testipt.s3-us-west-2.amazonaws.com/PictureInFormTest.ipt"
75+
},
76+
"InventorParams": {
77+
"url": "data:application/json,{\"SquarePegSize\":\"0.24 in\"}"
78+
},
79+
"OutputIpt": {
80+
"url": "http://testipt.s3-us-west-2.amazonaws.com/Foo.ipt",
81+
"verb": "put"
82+
}
83+
}
84+
}
85+
```
86+
### IAM processing
87+
Note `pathInZip` field, which points to the assembly in the archive.
88+
```json
89+
{
90+
"activityId": "Inventor.ChangeParams+prod",
91+
"arguments": {
92+
"InventorDoc": {
93+
"url": "http://testipt.s3-us-west-2.amazonaws.com/Basic.zip",
94+
"zip": true,
95+
"pathInZip": "iLogicBasic1.iam",
96+
"localName": "Assy"
97+
},
98+
"InventorParams": {
99+
"url": "data:application/json,{\"Length\":\"5 in\"}"
100+
},
101+
"OutputIam": {
102+
"url": "http://testipt.s3-us-west-2.amazonaws.com/Results.zip",
103+
"verb": "put"
104+
}
105+
}
106+
}
107+
```

Docs/PluginPostBuildStepPackaging.png

27.2 KB
Loading

Docs/PluginProject.png

7.32 KB
Loading

Docs/QuotasAndRestrictions.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Design Automation API for Inventor - Quotas and Restrictions
2+
3+
4+
Design Automation API for Inventor imposes quotas and restrictions on your Apps, Activities and Workitems.
5+
6+
7+
## App Limits
8+
9+
Limit | Value | Description
10+
------| ------ | -----------
11+
App upload size | 100 MB | Max permitted size of an App upload in megabytes.
12+
Payload size | 8 KB | Max permitted size for App/Activity json payload in kilobytes.
13+
Versions | 100 | Max permitted number of App/Activity versions a client can have at any one time.
14+
15+
#### Additional App Restrictions
16+
17+
There are additional restrictions placed on Apps that run on Design Automation API for Inventor. These include:
18+
* No access to Inventor's UI interfaces. Your application must only interact with the InventorServer object only.
19+
* Applications must be able to process jobs to completion without waiting for user input or interaction.
20+
* No network access is allowed.
21+
* Writing to the disk is restricted to Inventor's current working directory.
22+
* Your application is run with low privileges, and will not be able to freely interact with Windows OS.
23+
24+
## Alias Limits
25+
26+
Limit | Value | Description
27+
------| ------ | -----------
28+
Aliases | 100 | Max permitted number of aliases that a client can have at any one time.
29+
30+
## Activity Limits
31+
32+
Limit | Value | Description
33+
------| ------ | -----------
34+
Payload size | 8 KB | Max permitted size for App/Activity json payload in kilobytes.
35+
Total uncompressed Apps size | 500 MB | Max permitted size of all Apps referenced by an activity. It is enforced when you post a workitem.
36+
Versions | 100 | Max permitted number of App/Activity versions a client can have at any one time.
37+
38+
## Workitem Limits
39+
40+
Limit | Value | Description
41+
------| ------ | -----------
42+
Downloads | 10 | Max number of downloads per workitem.
43+
Download size | 50 MB | Max total size of all downloads in MB per workitem.
44+
Processing time| 300 seconds | Max duration of processing in seconds per workitem (includes download and upload time).
45+
Uploads | 10 | Max number of uploads per workitem.
46+
Upload size | 200 MB | Max total size of all uploads in MB per workitem.
47+
Workitems per minute | 20 per/min | Max number of workitems a client can submit in one minute.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Autodesk, Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Design Automation for Inventor sample
2+
3+
![Platforms](https://img.shields.io/badge/platform-Windows-lightgrey.svg)
4+
![.NET](https://img.shields.io/badge/.net-4.7-blue.svg)
5+
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
6+
7+
[![oAuth2](https://img.shields.io/badge/oAuth2-v1-green.svg)](http://developer.autodesk.com/)
8+
[![Data-Management](https://img.shields.io/badge/data%20management-v2-blue.svg)](http://developer.autodesk.com/)
9+
[![Design Automation](https://img.shields.io/badge/design%20automation-v3-blue.svg)](https://forge.autodesk.com/api/design-automation-cover-page/)
10+
11+
![Intermediate](https://img.shields.io/badge/Level-Intermediate-blue.svg)
12+
13+
This sample is a .NET console app and demonstrates how one can process Inventor **Assemblies** or **Parts** on Design Automation. In particular it takes a design (Assembly or Part) and changes parameters inside of it (height and width). Input designs can be found in **Solution/clientApp/inputFiles/**. Values for changing params are in Program.cs
14+
15+
## Sample Output
16+
17+
![](thumbnail.png)
18+
19+
# Setup
20+
21+
## Prerequisites
22+
* Visual Studio 2015 or later
23+
* Windows 7 or later
24+
* knowledge of C#
25+
26+
## Running locally
27+
28+
1. Register for a Forge application at https://forge.autodesk.com/myapps/create#. You'll need the key and secret for building and running any sample apps
29+
* Choose *Design Automation API* and *Data Mangement API* for the APIs you want to use in your app.
30+
2. Add to your env. variables
31+
* FORGE_CLIENT_ID
32+
* FORGE_CLIENT_SECRET
33+
3. Build solution and run clientApp project
34+
6. Outputs and Report file will be copied into My Documents folder
35+
36+
# Understanding the sample
37+
38+
## Steps to take as a developer
39+
40+
### 1. Author Inventor plugin
41+
42+
A design is processed by an Inventor plugin so one has to author plugin code. The resulting plugin is then packaged into an Inventor bundle and zipped. This is done by the **samplePlugin** project in the solution. Packaging is done using a post-build step of the project. When you build the project you can find the resulting bundle zip *samplePlugin.bundle.zip* in the **Solution/Output/** directory.
43+
44+
![](Docs/PluginPostBuildStepPackaging.png)
45+
46+
### 2. Deliver your Inventor plugin to the Design Automation service
47+
48+
In order to instruct the *Design Automation* service to run your plugin code, it must be delivered. This is done by:
49+
50+
- Creating an **AppBundle** object on Design Automation using the REST API. You can think of an **AppBundle** object as metadata describing your plugin for Design Automation usage.
51+
- When you create an **AppBundle** object, Design Automation instructs you where and how to upload your zipped and bundled plugin binaries.
52+
53+
This workflow is done in this sample in the **clientApp** project.
54+
55+
[Create AppBundle documentation](https://forge.autodesk.com/en/docs/design-automation/v3/reference/http/appbundles-POST/)
56+
57+
### 3. Describe your Activity
58+
59+
In order to use your **AppBundle** you have to create an **Activity**. In an **Activity** you can describe how to handle inputs and outputs for the AppBundle. This is also done using the Design Automation REST API.
60+
61+
This is done in this sample in the **clientApp** project.
62+
63+
[Create Activity documentation](https://forge.autodesk.com/en/docs/design-automation/v3/reference/http/activities-POST/)
64+
65+
### 4. Prepare your inputs
66+
67+
To deliver your inputs to Design Automation to process, you have to upload them on the internet so that Design Automation can download them when the **Activity** is executed.
68+
69+
This workflow is done in this sample in the **clientApp** project. You can find sample inputs in **Solution/clientApp/inputFiles/** folder.
70+
71+
### 5. Execute your Activity
72+
73+
To execute the activity you have to create a **WorkItem**. A **WorkItem** is a representation of an executed task. You can monitor its state, so you know if it is still in progress or done. You have to specify where **Design Automation** can download inputs and where it should upload outputs (results) according to what is written in the **Activity**.
74+
75+
This is done in this sample in the **clientApp** project.
76+
77+
[Create WorkItem documentation](https://forge.autodesk.com/en/docs/design-automation/v3/reference/http/workitems-POST/)
78+
79+
### 6. Download outputs (results) and report
80+
81+
As mentioned earlier, your outputs are uploaded to the place you specified when creating your **WorkItem** and to get them onto your local machine you should download them. There is also a report file where you can see what was happening.
82+
83+
This is done in this sample in the **clientApp** project. Results are downloaded into your **Documents** folder
84+
85+
## Quotas and Limits
86+
Apps, Activies and WorkItems have quotoas and limits. To find out more information on this can be found in [Docs/QuotasAndRestrictions.md](Docs/QuotasAndRestrictions.md).
87+
88+
## License
89+
90+
This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details.
91+
92+
## Written by
93+
94+
Michal Vasicek, [Forge Partner Development](http://forge.autodesk.com)

Solution/.gitignore

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.sln.docstates
8+
9+
# Build results
10+
11+
[Dd]ebug/
12+
[Rr]elease/
13+
x64/
14+
build/
15+
[Bb]in/
16+
[Oo]bj/
17+
18+
# MSTest test Results
19+
[Tt]est[Rr]esult*/
20+
[Bb]uild[Ll]og.*
21+
22+
*_i.c
23+
*_p.c
24+
*.ilk
25+
*.meta
26+
*.obj
27+
*.pch
28+
*.pdb
29+
*.pgc
30+
*.pgd
31+
*.rsp
32+
*.sbr
33+
*.tlb
34+
*.tli
35+
*.tlh
36+
*.tmp
37+
*.tmp_proj
38+
*.log
39+
*.vspscc
40+
*.vssscc
41+
.builds
42+
*.pidb
43+
*.log
44+
*.scc
45+
46+
# Visual C++ cache files
47+
ipch/
48+
*.aps
49+
*.ncb
50+
*.opensdf
51+
*.sdf
52+
*.cachefile
53+
54+
# Visual Studio profiler
55+
*.psess
56+
*.vsp
57+
*.vspx
58+
59+
# Guidance Automation Toolkit
60+
*.gpState
61+
62+
# ReSharper is a .NET coding add-in
63+
_ReSharper*/
64+
*.[Rr]e[Ss]harper
65+
66+
# TeamCity is a build add-in
67+
_TeamCity*
68+
69+
# DotCover is a Code Coverage Tool
70+
*.dotCover
71+
72+
# NCrunch
73+
*.ncrunch*
74+
.*crunch*.local.xml
75+
76+
# Installshield output folder
77+
[Ee]xpress/
78+
79+
# DocProject is a documentation generator add-in
80+
DocProject/buildhelp/
81+
DocProject/Help/*.HxT
82+
DocProject/Help/*.HxC
83+
DocProject/Help/*.hhc
84+
DocProject/Help/*.hhk
85+
DocProject/Help/*.hhp
86+
DocProject/Help/Html2
87+
DocProject/Help/html
88+
89+
# Click-Once directory
90+
publish/
91+
92+
# Publish Web Output
93+
*.Publish.xml
94+
95+
# NuGet Packages Directory
96+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
97+
98+
packages/*
99+
!packages/autodesk
100+
101+
# Windows Azure Build Output
102+
csx
103+
*.build.csdef
104+
105+
/Output
106+
.vs

Solution/ZipAppPackage/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
5+
</startup>
6+
</configuration>

0 commit comments

Comments
 (0)