cyrillef / forge.commandline-curl Goto Github PK
View Code? Open in Web Editor NEWAuthorization and file translation demo: Demonstrates Autodesk Forge API authorization and translation process using cURL
License: MIT License
Authorization and file translation demo: Demonstrates Autodesk Forge API authorization and translation process using cURL
License: MIT License
Hi all,
I'm trying to run the "workflow curl" example and everything works fine except the visualisation of the model. When I open the html file, it raises the following errors:
viewer3D.min.js:847 Uncaught ReferenceError: THREE is not defined
viewer3D.min.js:1193 Uncaught TypeError: Cannot read property 'resize' of undefined
I added the three.js library to /temp/Au.obj.html from http://threejs.org/build/three.min.js. I ran the html again and it raised the following error:
Uncaught TypeError: THREE.DDSLoader is not a function
I added the THREE.DDSLoader library and it loads the model but it raises all these errors in the console:
HREE.WebGLRenderer 71
viewer3D.min.js:1871 Host name : localhost
viewer3D.min.js:1871 Environment initialized as : AutodeskProduction
viewer3D.min.js:1872 No viewer version specified, will implicitly use 1.2.16
three.min.js:263 GET http://localhost:8888/workflow-curl-view-and-data-api/temp/res/environments/riverbank_irr.logluv.dds 404 (Not Found)THREE.XHRLoader.load @ three.min.js:263THREE.CompressedTextureLoader.load @ three.min.js:296setIrradianceMap @ viewer3D.min.js:770setLightPreset @ viewer3D.min.js:882a.Viewer3D.initSettings @ viewer3D.min.js:1218a.Viewer3D.initialize @ viewer3D.min.js:1183initialize @ Au.obj.html?accessToken=TOXd9AQnlm8cIKjfHrFGoUe8DM87:17onload @ Au.obj.html?accessToken=TOXd9AQnlm8cIKjfHrFGoUe8DM87:10
three.min.js:263 GET http://localhost:8888/workflow-curl-view-and-data-api/temp/res/environments/riverbank_mipdrop.logluv.dds 404 (Not Found)THREE.XHRLoader.load @ three.min.js:263THREE.CompressedTextureLoader.load @ three.min.js:296setCubeMap @ viewer3D.min.js:768setLightPreset @ viewer3D.min.js:882a.Viewer3D.initSettings @ viewer3D.min.js:1218a.Viewer3D.initialize @ viewer3D.min.js:1183initialize @ Au.obj.html?accessToken=TOXd9AQnlm8cIKjfHrFGoUe8DM87:17onload @ Au.obj.html?accessToken=TOXd9AQnlm8cIKjfHrFGoUe8DM87:10
2DSLoader.js:129 THREE.DDSLoader.parse: Invalid magic number in DDS header.THREE.DDSLoader.parse @ DSLoader.js:129(anonymous function) @ three.min.js:296(anonymous function) @ three.min.js:262
viewer3D.min.js:1238 Autodesk.Viewing.Document.load called with deprecated (auth) parameter
developer.api.autodesk.com/oss-ext/v1/acmsessions:1 POST https://developer.api.autodesk.com/oss-ext/v1/acmsessions 401 (Unauthorized)
Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
Is this the normal behaviour of the viewer?
Thanks
something along these lines:
./viewerAPI auth
returns bearer.
a suitable CURL command to return file formats is shown in 'step 4 โ upload a file':
https://developer.autodesk.com/api/view-and-data-api/#step-4-upload-a-file
curl -k --header "Authorization: Bearer tMpDT9fGcWsQVd5BG5XUqpYUBbpR" https://developer.api.autodesk.com/viewingservice/v1/supported
massage the result returned, e.g. like this in Python:
a = {"extensions":["ipt","neu","stla","stl","xlsx","jt","jpg","skp","prt","dwf","xls","png","sldasm","step","dwg","zip","nwc","model","sim","stp","ste","f3d","pdf","iges","idw","dwt","dxf","catproduct","csv","igs","sldprt","cgr","3dm","sab","obj","pptx","cam360","jpeg","bmp","gbxml","exp","ppt","doc","wire","ige","rcp","txt","dae","x_b","3ds","rtf","rvt","g","sim360","iam","asm","dlv3","x_t","pps","session","xas","xpr","docx","catpart","stlb","tiff","nwd","sat","fbx","smb","smt","ifc","dwfx","tif"], ... }
a['extensions'].sort()
for e in a['extensions']: print e,
result:
oops, those are too many, both for viewing and extraction only.
to get the viewing ones, filter them like this:
channel_mappings = a['channelMapping']
keys = channel_mappings.keys()
keys.sort()
for x in keys:
if channel_mappings[x].startswith('view'):
print x,
result:
i uploaded the following file from my windows file system:
/a/src/web/viewer/git/workflow-curl-view.and.data.api/ $ ./viewerAPI upload "/v/C/Program Files/Autodesk/Revit 2016/Samples/rst_advanced_sample_project.rvt"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11.2M 100 499 100 11.2M 3 82150 0:02:46 0:02:23 0:00:23 21352
{
"bucket-key": "comphound-bucket",
"objects": [
{
"content-type": "application/octet-stream",
"id": "urn:adsk.objects:os.object:comphound-bucket/Program+Revit+rst_advanced_sample_project.rvt",
"key": "Program+Revit+rst_advanced_sample_project.rvt",
"location": "https://developer.api.autodesk.com/oss/v1/buckets/comphound-bucket/objects/Program+Revit+rst_advanced_sample_project.rvt",
"sha-1": "8b7e00fbed8f80467b6a54b37f7fdcace2044236",
"size": 11792384
}
]
}
ID: urn:adsk.objects:os.object:comphound-bucket/Program+Revit+rst_advanced_sample_project.rvt
Location: https://developer.api.autodesk.com/oss/v1/buckets/comphound-bucket/objects/Program+Revit+rst_advanced_sample_project.rvt
look at the resulting location: it includes the first word of some intermediate folder names!
when i try to register, it is not obviously found:
/a/src/web/viewer/git/workflow-curl-view.and.data.api/ $ ./viewerAPI register rst_advanced_sample_project.rvt
cat: /Users/jta/a/src/web/viewer/git/workflow-curl-view.and.data.api/data/comphound-bucket.rst_advanced_sample_project.rvt.json: No such file or directory
Traceback (most recent call last):
File "", line 1, in
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 290, in load
**kw)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 53 100 43 100 10 45 10 0:00:01 --:--:-- 0:00:01 102
Registration submission failed!
HTTP/1.1 400 Bad Request Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Content-Type: application/json; charset=utf-8 Date: Thu, 01 Oct 2015 15:19:56 GMT Server: Apigee Router x-ads-app-identifier: platform-viewing-2015.06.6.1053.c60682a-production x-ads-duration: 0 ms x-ads-error-id: x-ads-exception-id: 19fed11e-50dd-454d-a1f9-309e62e700e4 x-ads-startup-time: Thu Oct 01 03:07:15 UTC 2015 x-ads-troubleshooting: The request is invalid. Content-Length: 43 Connection: keep-alive {"diagnostic":"'urn' parameter is invalid"}
i tried the following command:
$ ./viewerAPI upload "/a/rvt/Urban House - 2015.rvt"
that returns the following:
curl: option -: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
No JSON object could be decoded
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 290, in load
**kw)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
ID:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 290, in load
**kw)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Location:
/Users/jta/a/src/web/viewer/git/workflow-curl-view.and.data.api/scripts/upload: line 59: $ROOT/data/${bucket}.${filename}.json: ambiguous redirect
shall we create a new release now? e.g., 1.0.0.1 or something? i see that npm uses a release numbering system using 3 numbers, not 4? shall we switch from 1.0.0.0 to 2.0.0? or 1.0.1?
Running 2legged I get the error "date: invalid option -- 'v'" on Ubuntu. Not sure if this works on other Linux flavors
I'm getting an error when using resumable script on file which contains spaces. Using quotes around filename works fine on simple upload.
The error message is:
tail: cannot open 'nnn' for reading: No such file or directory - where 'nnn' is first part of filename
I'm using script on Windows 10 (together with Git Bash)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.