I am doing the following steps to convert an .rvt file into .svf
Authenticate
upload .rvt file
translate it to .svf (with modelderivative/v2/designdata/job)
with the response check the job complete by checking the manifest (/modelderivative/v2/designdata/{urn}/manifest)
once the job is complete (from manifest status), the response I get does not contain derivatives urns
Link to the complete manifest response : https://drive.google.com/file/d/0ByrHSB-f7jP3TXhHYVQtOEUyM2c/view?usp=sharing
Sample response: the derivative urn is missing
class ManifestDerivative {
name: autodesk.rvt
hasThumbnail: true
outputType: svf
progress: complete
status: success
children: [class ManifestChildren {
type: geometry
role: 2d
name: 03.51 - Detail V.01
hasThumbnail: true
mime: null
urn: null
progress: complete
status: success
resolution: []
modelGUID: null
objectIds: []
messages: null
}, class ManifestChildren {
type: geometry
role: 2
....
I want to know whether the urn returned by this response manifest is enough for downloading the bubble or there is something that I am doing wrong
The manifest is enough to download svf, however it is not a straightforward workflow, take a look at my recent blog post: Forge SVF Extractor in Node.js and at this project that does the extraction for you: https://extract.autodesk.io. You can find the source there.
Related
I have filtered Revit Files with urn, from the jsTree
['urn:adsk.wipprod:dm.lineage:EBacD2IDQ5i2I7s9kAHoIQ',]
The other comprehensive data is as follows:
'
createTime: "2021-10-28T08:16:10.0000000Z"
createUserId: "TYBCQWSXD9C9"
createUserName: "Roshan Kerketta"
displayName: "00000000_SCAN_TO_BIM_POWER_SAMPLE.rvt"
extension:
data:
sourceFileName: "00000000_SCAN_TO_BIM_POWER_SAMPLE.rvt"
[[Prototype]]: Object
schema:
href:
"https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.bim360:File-1.0"
[[Prototype]]: Object
type: "items:autodesk.bim360:File"
version: "1.0"
[[Prototype]]: Object
hidden: false
id: "urn:adsk.wipprod:dm.lineage:EBacD2IDQ5i2I7s9kAHoIQ"
lastModifiedTime: "2021-10-28T08:16:12.0000000Z"
lastModifiedUserId: "TYBCQWSXD9C9"
lastModifiedUserName: "Roshan Kerketta"
reserved: false
type: "items"
[[Prototype]]: Object
'
Is there a way I could view the Revit files in Forge viewer using javascript/Nodejs using the above data
At this step, you have items and for each of them you can have multiple versions of the "same" file. So now you need to getVersions for each file you want to display in the viewer.
The endpoint to get item versions is GET projects/:project_id/items/:item_id/versions Get item version doc.
You can find the urn you need for the viewer in the response in data.relationships.derivatives.data.id
If you are using an example like Learn Forge ViewHubModels, this function is already included in the backend as it is the final step of the tree before displaying in the viewer.
Once a file is selected, we want to translate it to svf2 format, using the forge-apis package.
Here the code for the translate method:
const derivativesApi = new DerivativesApi()
this.urn = Buffer.from(this.itemToRender.id).toString('base64')
const job: JobPayload = {
input: {
urn: this.urn
},
output: {
formats: [
{
type: 'svf2',
views: ['2d', '3d']
}
]
}
}
const translation = await derivativesApi.translate(
job,
{},
autodeskClientTwo(),
await autodeskClientTwo().authenticate()
)
Obtaining error '406' debt to bad request.
406: "SVF2 is not supported for this design."
Any idea? Thanks in advance.
SVF2 translation is currently only supported for files in OSS buckets. So you would have to move the file into your own OSS bucket first and then kick off the translation for it.
I cannot tell you at the moment when SVF2 translation will be available for files on BIM 360 Docs
I'm trying to display a revit model stored in BIM 360 using the code example from this repository: https://github.com/Autodesk-Forge/forge-tutorial-postman/blob/master/docs/display_svf.html
In this html file I only need to give my access token and the URN (encoded). This works if my model is uploaded from a bucket I had created, but I'm getting an Failed fetching Forge manifest error when I try to do it from an URN that I got from a BIM 360 document.
These are the steps I'm taking:
Getting the document URN
I used this endpoint https://developer.api.autodesk.com/data/v1/projects/b.ef7b0d22-8480-40d6-9749-12e5d7192ac9/folders/urn:adsk.wipprod:fs.folder:co.nAdJ4fwLRRuGem-qpDIlTA/contents
And from the results I get my urn:
Encode the URN
After that I got to https://www.base64encode.org/ and encode the value
urn:adsk.objects:os.object:wip.dm.prod/ac9e8b48-4a51-4f6a-a7e4-a947c9d6a1e6.rvt
And the result is this:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6d2lwLmRtLnByb2QvYWM5ZThiNDgtNGE1MS00ZjZhLWE3ZTQtYTk0N2M5ZDZhMWU2LnJ2dA
Set my access token and encoded URN in display_sfv.html
After that I place my acces token and the encoded URN, like this:
Finally I got this errors from the console:
Again this example works if I use and urn from a bucket I had created, but when I use the urn I get from a BIM 360 folder I get that error message. Where could be my mistake?
To load models form BIM360, you have to use the urn under derivatives attribute like below:
"derivatives": {
"data": {
"type": "derivatives",
"id": "dXJuOmFkc2sud2lwcWE6ZnMuZmlsZTp2Zi50X3hodWwwYVFkbWhhN2FBaVBuXzlnP3ZlcnNpb249MQ"
},
"meta": {
"link": {
"href": "/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcWE6ZnMuZmlsZTp2Zi50X3hodWwwYVFkbWhhN2FBaVBuXzlnP3ZlcnNpb249MQ/manifest?scopes=b360project.6f8813fe-31a7-4440-bc63-d8ca97c856b4,global,O2tenant.tenantId"
}
}
},
Ref: https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-GET/
I've been following the Autodesk Model Derive API tutorial on
Extracting Data From a Source File and keep getting a Translation Failure when attempting to convert the uploaded source file to SVF.
I have tried .step, .sldprt, .stl and .igs files (supported file extensions here), but all seem to throw the same error message.
The request
def self.convert_to_svf(urn, key)
url = URI("https://developer.api.autodesk.com/modelderivative/v2/designdata/job")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
body = {"input": { "urn": "#{urn}", "compressedUrn": true, "rootFilename": "#{key}" }, "output": { "formats": [{ "type": "svf", "views": ["2d", "3d"] }] }}
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer ' + token
request.body = body.to_json
JSON.parse(http.request(request).read_body)
end
The response
{"type"=>"manifest", "hasThumbnail"=>"false", "status"=>"failed", "progress"=>"complete", "region"=>"US", "urn"=>"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aXNvcXVlLzE4Ynk4cG9pbnQ1X2dvb2R5ZWFyLmlncw", "derivatives"=>[{"name"=>"LMV Bubble", "hasThumbnail"=>"false", "status"=>"failed", "progress"=>"complete", "messages"=>[{"type"=>"error", "message"=>"Translation failure", "code"=>"TranslationWorker-InternalFailure"}], "outputType"=>"svf"}]}
I did not see an obvious issue in your code snippet, however may I know if you have uploaded the source file(s) in zip format or only the single file of the original format (say .step, .sldprt, .stl and .igs) ?
I had the practice on the relevant APIs. I tested with Inventor assembly (with sub-assemblies and parts) and AutoCAD drawing (with Xrefs). The endpoint can work well with compressedUrn = true, specifying root file, after I uploaded file package in a zip.
If compressedUrn = true, that means the source file is compressed (zip), but this applies to the composite files, i.e. a main file has some dependent files. If it is a single file which has no dependent files, upload the source file directly, then call/modelderivative/v2/designdata/job without specifying compressedUrn and
rootFilename.
If I misunderstood your question, could you provide a bit more information or a demo dataset? Note, do not post any data that is confidential to your company.
I have a RESTful API that I have created recently and I won't remember how to use it in a few months. I decided to document my API using Swagger, however I'm going crazy.
I used http://editor.swagger.io/ to create the YAML file that I then convert into a JSON file Swagger can use. When I put file into Swagger UI it just gets stuck at fetching resource list: localhost/swagger.json and the console says Uncaught TypeError: Cannot read property '$ref' of undefined .
I'm using version 2.1.0-alpha.5 of Swagger UI.
Here is my spec file:
swagger: '2.0'
info:
title: TITLE
description: BLAH, BLAH, BLAH, ETC
version: "1.0b"
host: api.example.com
schemes:
- http
basePath: /v1
produces:
- application/json
paths:
/match.json:
get:
#summary: Match Data
description: Used for getting data about a match
parameters:
- name: id
in: query
description: The match ID of from a game
required: true
type: integer
format: int32
- name: key
in: query
description: API key used for authentication.
required: true
type: string
responses:
200:
description: Returns match data
schema:
type: array
items:
$ref: '#/definitions/MatchData'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
MatchData:
properties:
info:
type: integer
format: int64
description: General information about the match
time:
type: integer
format: int64
description: Information about the start/end time
stats:
type: array
format: int64
description: Stats about the match
Error:
required:
- errorID
- message
properties:
errorID:
type: string
description: Error ID.
message:
type: string
description: Information about the error.
I've tested your spec, and while I'm not getting the same error you do, the spec is indeed invalid.
If you look at #/definitions/MatchData/properties/stats, you'll see that you define the type: array but you don't provide an 'items' property next to it to say which array it is (and that's mandatory). You may have intended to use type: integer like the properties above it, which goes along with the format: int64.
Since I don't know what you intended to provide, it's difficult to give an accurate solution, but if you add a comment with what you intended to do, I could provide a more detailed answer.
Upon some additional testing, I discovered that there's a bug in the UI. After you make that modification and the spec loads, the operation itself will not expand unless you click on the Expand Operations link. I've opened an issue about it, feel free to follow it there.
This problem can be due to some indentation errors in the yaml file which actually did not show up in the Swagger editor. Check all your definitions and whether they are getting displayed as expected in the preview that you can see in Swagger editor (especially check MatchData).
You can also try giving:
responses:
200:
description: Returns match data
schema:
type: array
items:
schema:
$ref: '#/definitions/MatchData'
For our case, we used Swagger-php and we have:
* #SWG\Response(
* response=200,
* description="app response"
* #SWG\Schema(
* type="array"
* )
* ),
but we missed " * #SWG\Items(ref="#/definitions/pet")". After removing "#SWG\Schema(", it works e.g.
* #SWG\Response(
* response=200,
* description="app response"
* ),