-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
828 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
theme: jekyll-theme-hacker | ||
theme: jekyll-theme-minimal |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# FORGE_CLIENT_ID, FORGE_CLIENT_SECRET, and FORGE_BUCKET must be set before running this script. | ||
|
||
$forge_dm_bin = "node ..\..\src\forge-dm.js" | ||
$forge_da_bin = "node ..\..\src\forge-da.js" | ||
|
||
$activity_name = "MyTestActivity" | ||
$activity_alias = "dev" | ||
|
||
$input_file_path = ".\Clutch_Gear_20t.ipt" | ||
$input_object_key = "input.ipt" | ||
$thumbnail_object_key = "thumbnail.bmp" | ||
|
||
# If it does not exist, create a data bucket | ||
$result = Invoke-Expression "$forge_dm_bin list-buckets --short" | Select-String -Pattern $env:FORGE_BUCKET | Measure-Object -Line | ||
if ($result.Lines -eq 0) { | ||
Write-Host "Creating a bucket $env:FORGE_BUCKET" | ||
Invoke-Expression "$forge_dm_bin create-bucket $env:FORGE_BUCKET" | ||
} | ||
|
||
# Upload Inventor file and create a placeholder for the output thumbnail | ||
Write-Host "Preparing input/output files" | ||
Invoke-Expression "$forge_dm_bin upload-object $input_file_path application/octet-stream $env:FORGE_BUCKET $input_object_key" | ||
New-Item -Name "output" -Path "." -ItemType "directory" | ||
New-Item -Name "thumbnail.bmp" -Path ".\output" -ItemType "file" | ||
Invoke-Expression "$forge_dm_bin upload-object .\output\thumbnail.bmp image/bmp $env:FORGE_BUCKET $thumbnail_object_key" | ||
|
||
# Generate signed URLs for all input and output files | ||
Write-Host "Creating signed URLs" | ||
$input_file_signed_url = Invoke-Expression "$forge_dm_bin create-signed-url $env:FORGE_BUCKET $input_object_key --access read --short" | ||
$thumbnail_signed_url = Invoke-Expression "$forge_dm_bin create-signed-url $env:FORGE_BUCKET $thumbnail_object_key --access readwrite --short" | ||
|
||
# Create activity and poll the results | ||
Write-Host "Creating work item" | ||
$workitem_id = Invoke-Expression "$forge_da_bin create-workitem $activity_name $activity_alias --input PartFile:$input_file_signed_url --output Thumbnail:$thumbnail_signed_url --short" | ||
Write-Host "Waiting for work item $workitem_id to complete" | ||
$workitem_status = "inprogress" | ||
while ($workitem_status -eq "inprogress") { | ||
Start-Sleep -s 5 | ||
$workitem_status = Invoke-Expression "$forge_da_bin get-workitem $workitem_id --short" | ||
Write-Host $workitem_status | ||
} | ||
|
||
# Download the results | ||
Write-Host "Downloading results to output/thumbnail.bmp" | ||
Invoke-Expression "$forge_dm_bin download-object $env:FORGE_BUCKET $thumbnail_object_key output\thumbnail.bmp" | ||
Write-Host "Process complete. See the thumbnail in the output folder, or download it from $thumbnail_signed_url" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# FORGE_CLIENT_ID, FORGE_CLIENT_SECRET, and FORGE_BUCKET must be set before running this script. | ||
|
||
$forge_da_bin = "node ..\..\src\forge-da.js" | ||
|
||
$appbundle_name = "MyTestBundle" | ||
$appbundle_alias = "dev" | ||
$appbundle_file = ".\ThumbnailPlugin.bundle.zip" | ||
$appbundle_engine = "Autodesk.Inventor+24" | ||
|
||
$activity_name = "MyTestActivity" | ||
$activity_alias = "dev" | ||
|
||
# Create or update an appbundle | ||
Write-Host "Creating an appbundle $appbundle_name" | ||
$result = Invoke-Expression "$forge_da_bin list-appbundles --short" | Select-String -Pattern $appbundle_name | Measure-Object -Line | ||
if ($result.Lines -eq 0) { | ||
Write-Host "Creating new appbundle" | ||
Invoke-Expression "$forge_da_bin create-appbundle $appbundle_name $appbundle_file $appbundle_engine" | ||
} else { | ||
Write-Host "Updating existing appbundle" | ||
Invoke-Expression "$forge_da_bin update-appbundle $appbundle_name $appbundle_file $appbundle_engine" | ||
} | ||
|
||
# Create or update an appbundle alias | ||
Write-Host "Creating an appbundle alias $appbundle_alias" | ||
$appbundle_version = Invoke-Expression "$forge_da_bin list-appbundle-versions $appbundle_name --short" | Select-Object -Last 1 | ||
Write-Host "Last appbundle version: $appbundle_version" | ||
$result = Invoke-Expression "$forge_da_bin list-appbundle-aliases $appbundle_name --short" | Select-String -Pattern $appbundle_alias | Measure-Object -Line | ||
if ($result.Lines -eq 0) { | ||
Write-Host "Creating new appbundle alias" | ||
Invoke-Expression "$forge_da_bin create-appbundle-alias $appbundle_alias $appbundle_name $appbundle_version" | ||
} else { | ||
Write-Host "Updating existing appbundle alias" | ||
Invoke-Expression "$forge_da_bin update-appbundle-alias $appbundle_alias $appbundle_name $appbundle_version" | ||
} | ||
|
||
# Create or update an activity | ||
Write-Host "Creating an activity $activity_name" | ||
$result = Invoke-Expression "$forge_da_bin list-activities --short" | Select-String -Pattern $activity_name | Measure-Object -Line | ||
if ($result.Lines -eq 0) { | ||
Write-Host "Creating new activity" | ||
Invoke-Expression "$forge_da_bin create-activity $activity_name $appbundle_name $appbundle_alias $appbundle_engine --input PartFile --output Thumbnail:thumbnail.bmp" | ||
} else { | ||
Write-Host "Updating existing activity" | ||
Invoke-Expression "$forge_da_bin update-activity $activity_name $appbundle_name $appbundle_alias $appbundle_engine --input PartFile --output Thumbnail:thumbnail.bmp" | ||
} | ||
|
||
# Create or update an activity alias | ||
Write-Host "Creating an activity alias $activity_alias" | ||
$activity_version = Invoke-Expression "$forge_da_bin list-activity-versions $activity_name --short" | Select-Object -Last 1 | ||
Write-Host "Last activity version: $activity_version" | ||
$result = Invoke-Expression "$forge_da_bin list-activity-aliases $activity_name --short" | Select-String -Pattern $activity_alias | Measure-Object -Line | ||
if ($result.Lines -eq 0) { | ||
Write-Host "Creating new activity alias" | ||
Invoke-Expression "$forge_da_bin create-activity-alias $activity_alias $activity_name $activity_version" | ||
} else { | ||
Write-Host "Updating existing activity alias" | ||
Invoke-Expression "$forge_da_bin update-activity-alias $activity_alias $activity_name $activity_version" | ||
} |
File renamed without changes.
Oops, something went wrong.