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.
Configuration variables lead to the error: onshape_client.oas.exceptions.ApiException: (404)
tanja_matzerath
Member Posts: 9 EDU
Hello everyone,
I get the following error message when I try to export an stl-file with the onshape-client:
onshape_client.oas.exceptions.ApiException: (404)
Reason: Not found
This error only occurs if the configuration variables have values that differ from the defined default value. There are 5 different configuration variables in the PartStudio. If the first four deviate from the default value but are still in the definition range, the error occurs. The fifth configuration variable can also have a different value than the default value and the export works. However, not every value can be used for the fifth variable either.
If I change the variables in the browser and export the stl file itself, there is no problem at all. So this means that the values that the configuration variables should take do not cause an error in PartStudio.
I don't understand why I can't export the stl file via the onshape client as soon as the configuration variables differ from the default value.
Can anyone help me in this matter?
Many thanks in advance
I get the following error message when I try to export an stl-file with the onshape-client:
onshape_client.oas.exceptions.ApiException: (404)
Reason: Not found
This error only occurs if the configuration variables have values that differ from the defined default value. There are 5 different configuration variables in the PartStudio. If the first four deviate from the default value but are still in the definition range, the error occurs. The fifth configuration variable can also have a different value than the default value and the export works. However, not every value can be used for the fifth variable either.
If I change the variables in the browser and export the stl file itself, there is no problem at all. So this means that the values that the configuration variables should take do not cause an error in PartStudio.
I don't understand why I can't export the stl file via the onshape client as soon as the configuration variables differ from the default value.
Can anyone help me in this matter?
Many thanks in advance
0
Comments
-
I have not used onshape_client for a while but in general one issue I found with downloading configured items is beware the part id's may change based on the configuration so ensure always using the same configuration when getting the list of parts from the document as when you request an export.To rule out your own code it would be best to get the download working via manually repeating all the API calls steps using the Glassworks API explorer https://cad.onshape.com/glassworks/explorer
0 -
@tanja_matzerath I haven't used onshape_client in a long time and I'm not exactly sure how it formats configuration variables as query parameters, but based on your problem description, my guess is the units of the configuration variables are being interpreted differently than you intend. The API does not use the workspace units set by a user and defaults to all length units in meters and angle units in radians.
As @pmd said, it's always a good idea to understand exactly how the API call is formatted in https://cad.onshape.com/glassworks/explorer before trying it in your own code.
0 -
Thank you for your comments. Unfortunately, I still have the problem. As long as I change the default value in the browser to the values I currently need, I can use the API client and extract the geometries as long as the parameters have the same value as the default variables. However, this is not a permanent solution.
To extract the stl files, I created the function "exportSTL" as described here: https://colab.research.google.com/github/PTC-Education/PTC-API-Playground/blob/main/Onshape_API_Snippets.ipynb#scrollTo=Ql6qSU3pzWEC .
The different variables I use are listed in the params dictionary with an entry called:
configuration = {
'units': 'meter',
'scale': 1.0,
'configuration' :
'alpha=35+deg;''hight=0.8+mm;''length=1.0;'}I use exactly the same Python script for several PartStudios, which only differ in the configuration variables. I only have this problem with this particular PartStudio.
Could the problem be related to the PartStudio itself? Could it be that I have inadvertently checked a box somewhere?The geometry is a bit more complex than the others, and changing the variables in the browser takes some computing time (about 10 to 15 seconds), could this be a problem?Thank you again for helping.
0 -
It would be helpful if you could post the request URL you are trying, could be related to formatting of your input.
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications0 -
Caden_Armstrong_ said:It would be helpful if you could post the request URL you are trying, could be related to formatting of your input.
Thank you for your reply. This is the URL of the partStudio:
https://cad.onshape.com/documents/50287f5bd939f1fc9c56b045/w/250ef840f8e7c389efbfb934/e/950aab39e9373cac7e44712e?configuration=angleThreadMain=0.08726646259971647+radian;angleThreadSubdeg=0.7853981633974483+radian;length=1.0;numberThreadMain=1.0;numberThreadSub=8.0&renderMode=0&uiState=65f00acf73caa02e9a7ff55b
0 -
@tanja_matzerath
Not the URL of the part studio, the request URL that is sent to the Onshape api.
Your API call could be the issue, knowing what you are actually sending to the API will help in the debugging process.
Ie, the url sent in the format of:
cad.onshape.com/api/partstudios/..../stl
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications0 -
Caden_Armstrong_ said:@tanja_matzerath
Not the URL of the part studio, the request URL that is sent to the Onshape api.
Your API call could be the issue, knowing what you are actually sending to the API will help in the debugging process.
Ie, the url sent in the format of:
cad.onshape.com/api/partstudios/..../stlHey,sorry, I missed that. Here the request URL that I sent to onshape api: https://cad.onshape.com/documents/50287f5bd939f1fc9c56b045/w/250ef840f8e7c389efbfb934/e/950aab39e9373cac7e44712e
0 -
I could see why you are having an issue, that is not an api request, thats just the document URL.
Try clicking the link below (or sending it to the API)
https://cad.onshape.com/api/partstudios/d/50287f5bd939f1fc9c56b045/w/250ef840f8e7c389efbfb934/e/950aab39e9373cac7e44712e/stl
It should download the file.
www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
Experts in Onshape Automation - Custom Features and Integrated Applications0 -
Caden_Armstrong_ said:I could see why you are having an issue, that is not an api request, thats just the document URL.
Try clicking the link below (or sending it to the API)
https://cad.onshape.com/api/partstudios/d/50287f5bd939f1fc9c56b045/w/250ef840f8e7c389efbfb934/e/950aab39e9373cac7e44712e/stl
It should download the file.thank you for answer. But it still doesn't work.This is just the URL document, you are right. I create "fixed_url = 'https://cad.onshape.com/api/partstudios/d/{}/w/{}/e/{}/stl'.format( elementID.did, elementID.wvmid, elementID.eid) in my "stl_export-function", which I use to export the stl files.Before, I get the Id's by using "OnshapeElement(url)". And here is "url = document url".I also get the partsID with "request.get()" where I use "https://cad.onshape.com/api/parts/d/{}/w/{}/e/{}/".format(elementID.did, elementID.wvmid, elementID.eid)" as url. This works fine.With the partIds and the "fixed_url" I use "request client.api_client.request(...)" to export the parts I want. This works only for some configuration values. And this is my problem. I don't understand why only for a few set of values of the configuration variables....0


