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.
Working example on how to change custom property value in standard content and assembly item via API
gaphill
Member Posts: 5 PRO
My goal is to build very simple script based inventory management on top of Onshape Custom Properties. Hence, I need to change stock size and some other custom properties via API in all 3 types of items: normal parts, assembly items and standard content items.
I have created a test custom property named "unitprice", and a test assembly with one normal part, one assembly item and one standard content item.
There was no trouble in changing the value of "unitprice" via API with normal part.
The question is, how can I do the same with assembly item and with standard content item?
As you can see in picture of a BOM below, "unitprice" is visible in both.
API explorer (or Glassworks) have not been very helpful here. All combinations tried have ended up into 404.
Does anyone have a working example of these? What I need is basically understandable information how to construct api url and the request body
Or is it at all possible?
Tagged:
0
Answers
I'm also curious how you get the nice output format that you pasted here.
www.virtualmold.com
https://cad.onshape.com/api/metadata/d/f77a35101e278f65f22e1cf7/w/1f8b9ff1fa99327dde725ff5/e/87724ddfa5db6997ff541954/p/JJD
Sorry about the messy code blocks, I did not manage to find how to make them nicer. I did create code block first and the copypasted into it but it did not help much.
So within the assembly document, you need to get the part instance element, and invoke /api/elements/d/{document}/w/{workspace}/e/{element}/configuration
and to this you send your list of parameter values. (ClearanceHole, OutsideDiameter, Thickness).
www.virtualmold.com
This value is also visible in all other assemblies where the same part is present. Even in a different document. This makes one think that the property is stored somewhere in a companywide place.
www.virtualmold.com