I'm trying to convert some rather complex Autodesk Inventor models to SVF2 using the APS Model Derivative API. Some models convert without issue but most are missing some or all components. In some cases when attempting to view the model I am just presented with the following dialog:
Given that some models convert just fine but others have problems, I think it's an issue with the data rather than problems in how I'm submitting the jobs, but I can't be sure. The jobs always return a result of success even when the models are completely empty.
I can take some files that are not visible in a given assembly and add them to another assembly, and they are visible in the SVF2 in the new assembly, so I don't think it's related to their geometry.
Is there some additional job output I can request to see where and why the failure is happening?
[EDIT]: I am using PowerShell for file upload and job submission
Here is the script I'm using for upload and SVF2 creation:
$clientID = "[REDACTED]"
$clientSecret = "[REDACTED]"
$bucketName = "[REDACTED]"
$zipFile = "C:\Work\FileName.zip"
$topAssemblyName = "FileName.iam"
#get access token
function Authenticate-Forge()
{
$form = @{
client_id = $clientID
client_secret = $clientSecret
grant_type = 'client_credentials'
scope = 'data:write data:read bucket:create bucket:delete'
}
$uri = 'https://developer.api.autodesk.com/authentication/v1/authenticate'
$result = Invoke-RestMethod -Uri $uri -Body $form -Method Post
return $result.access_token
}
$token = Authenticate-Forge
#create a bucket for storing files
$bucketsURI = 'https://developer.api.autodesk.com/oss/v2/buckets'
$bodyHash = @{
bucketKey = $bucketName
access = 'full'
policyKey = 'persistent'
}
$bucketHeaders = @{
'Authorization' = "Bearer $($token)"
'Content-Type' = "application/json"
}
$bodyJSON = ConvertTo-Json $bodyHash
$bucketResult = Invoke-RestMethod -Uri $bucketsURI -Headers $bucketHeaders -Method Post -Body $bodyJSON
#Get a signed URL for upload
$filekey = [IO.Path]::GetFileName($zipFile).Replace(" ", "_")
$signedUploadURI = "https://developer.api.autodesk.com/oss/v2/buckets/$($bucketName)/objects/$($filekey)/signeds3upload?minutesExpiration=20"
$signedUploadHeaders = @{
'Authorization' = "Bearer $($token)"
'Accept-Encoding' = "gzip, deflate"
}
#Get a signed URL for upload
$signedURLResponse = Invoke-RestMethod -Method Get -Uri $signedUploadURI -Headers $signedUploadHeaders
$uploadKey = $signedURLResponse.uploadKey
$contentUploadSignedURL = $signedURLResponse.urls[0]
#Upload the file
$uploadHeaders = @{
'Accept-Encoding' = "gzip, deflate"
}
$uploadResponse = Invoke-RestMethod -Method Put -Uri $contentUploadSignedURL -Headers $uploadHeaders -InFile $zipFile
#finalize the upload
$finalizeUploadURI = "https://developer.api.autodesk.com/oss/v2/buckets/$($bucketName)/objects/$($filekey)/signeds3upload"
$finalizeUploadHeaders = @{
'Authorization' = "Bearer $($token)"
'Accept-Encoding' = "gzip, deflate"
'Content-Type' = 'application/json'
}
$finalizebodyHash = @{
uploadKey = $uploadKey
}
$finalizebodyJSON = ConvertTo-Json $finalizebodyHash
$finalizeUploadResponse = Invoke-RestMethod -Method Post -Uri $finalizeUploadURI -Headers $finalizeUploadHeaders -Body $finalizebodyJSON
$sourceFileObjectKey = $finalizeUploadResponse.objectKey
$sourceFileURN = $finalizeUploadResponse.objectId
$bytes = [System.Text.Encoding]::UTF8.GetBytes($sourceFileURN)
$encodedURN = [Convert]::ToBase64String($bytes)
$encodedURNSafe = $encodedURN.TrimEnd("=").Replace("+","-").Replace("/","_")
#Convert to SVF
$convertHeaders = @{
'Authorization' = "Bearer $($token)"
'Content-Type' = "application/json"
'x-ads-force' = "true"
}
$convertURI = "https://developer.api.autodesk.com/modelderivative/v2/designdata/job"
$convSVFBodyHash = @{
'input' = @{
'urn' = $encodedURNSafe
'rootFilename' = $topAssemblyName
'compressedUrn' = $true
}
'output' = @{
'destination' = @{
'region' = 'us'
}
'formats' = @(
@{
'type' = 'svf2'
'views' = @('3d')
}
)
}
}
$convSVFBodyJSON = ConvertTo-Json $convSVFBodyHash -Depth 4
$convertResponse = Invoke-RestMethod -Method Post -Uri $convertURI -Headers $convertHeaders -Body $convSVFBodyJSON
$convertResponse
#check the status of the job
$statusURI = "https://developer.api.autodesk.com/modelderivative/v2/designdata/$($encodedURNSafe)/manifest"
$statusHeaders = @{'Authorization' = "Bearer $($token)"}
$statusResponse = Invoke-RestMethod -Method Get -Uri $statusURI -Headers $statusHeaders
$statusResponse
I have tried everything short of completely rebuilding the assemblies. I have made sure that all files are migrated to the same release of Inventor, eliminated modeling errors, etc. The assemblies open fine in Inventor with no issues, all files migrated, etc.