Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
trouble with api not exporting GLTF model
ben_kepner
Posts: 5 ✭
I am trying to make a tool for displaying and configuring a model on a web page. I got it working with exporting STL models, but the good javascript libraries for viewing models want GLTF. When I try to use the api endpoint for exporting it a GLTF, it appears to just return not enough data. The response code is '200 OK'
request URL:
https://cad.onshape.com/api/partstudios/d/6844173a888ae9c148ad6b67/v/57d8fe202591e452ce7fdae4/e/332466e1b8aefa108b60a691/gltf?configuration=add_dividing_walls%3Dtrue%3Badd_living_hinge%3Dfalse%3Badd_tape_slot%3Dfalse%3Badd_window%3Dtrue%3Bbox_depth%3D0.81%3Bbox_height%3D5%3Bbox_width%3D8%3Bdivider_count%3D2&outputSeparateFaceNodes=False&outputFaceAppearances=False
request headers:
{<br>'User-Agent': 'Onshape Python Sample App', <br>'Accept-Encoding': 'gzip, deflate', <br>'accept': 'model/gltf+json;charset=UTF-8;qs=0.08', <br>'Connection': 'keep-alive', <br>'Content-Type': 'application/json', <br>'Date': 'Wed, 26 Jun 2024 21:39:58 GMT', 'On-Nonce': '5UzGLnLZE6SoHJb1AIuXt6fjU', <br>'Authorization': 'On redacted'<br>}The entire body of the response:
{<br> "extensions": {<br> "PTC_onshape_metadata": {<br> "documentId": "6844173a888ae9c148ad6b67",<br> "elementId": "332466e1b8aefa108b60a691"<br> }<br> },<br> "extensionsUsed": [<br> "PTC_onshape_metadata"<br> ],<br> "asset": {<br> "version": "2.0"<br> },<br> "scene": 0,<br> "scenes": [<br> {}<br> ]<br>} 0
Best Answers
-
I am getting the same result from glassworks.
cloudflare threw a fit when I tried to past the results of the glassworks request into the post, so I made a pastebin. https://pastebin.com/xQWwxDeJ
0 -
Hi Ben, Can you include the units in the configuration string i.e.
box_depth%3D2+cm
for example, this works for mehttps://cad.onshape.com/api/v6/partstudios/d/6844173a888ae9c148ad6b67/v/57d8fe202591e452ce7fdae4/e/332466e1b8aefa108b60a691/gltf?configuration=add_dividing_walls%3Dfalse%3Badd_living_hinge%3Dtrue%3Badd_tape_slot%3Dfalse%3Badd_window%3Dtrue%3Bbox_depth%3D2+cm%3Bbox_height%3D7+cm%3Bbox_width%3D8+cm%3Bdivider_count%3D1&outputSeparateFaceNodes=False&outputFaceAppearances=False
I suspect the configurations without the units is resulting in invalid geometry and hence you are getting no output.
1
Answers
-
I was able to download the content using glassworks. As a test can you try downloading this with glassworks ? https://cad.onshape.com/glassworks/explorer#/PartStudio/exportPartStudioGltf . If that works, you may need to check the calls being made via the app.0
-
I am getting the same result from glassworks.
cloudflare threw a fit when I tried to past the results of the glassworks request into the post, so I made a pastebin. https://pastebin.com/xQWwxDeJ
0 -
Hi Ben, Can you include the units in the configuration string i.e.
box_depth%3D2+cm
for example, this works for mehttps://cad.onshape.com/api/v6/partstudios/d/6844173a888ae9c148ad6b67/v/57d8fe202591e452ce7fdae4/e/332466e1b8aefa108b60a691/gltf?configuration=add_dividing_walls%3Dfalse%3Badd_living_hinge%3Dtrue%3Badd_tape_slot%3Dfalse%3Badd_window%3Dtrue%3Bbox_depth%3D2+cm%3Bbox_height%3D7+cm%3Bbox_width%3D8+cm%3Bdivider_count%3D1&outputSeparateFaceNodes=False&outputFaceAppearances=False
I suspect the configurations without the units is resulting in invalid geometry and hence you are getting no output.
1 -
adding units to the request worked. I wonder why it worked without for the stl endpoint?
0

