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.
Drawings/create API
shawn_crocker
Member, OS Professional Posts: 861 PRO
in General
I have been adding some functionality to an app that allows a user to initiate the creation of a new drawing of a selected item from within the app. Seems to be working really good. Only thing is I cannot seem to get the new drawing to get created using a selected template. See image.
I have templates and I have supplied the appropriate details to the highlight keys in the image. But still, the drawing is created with a default onshape template. When I use the "templateName" key, the query reruns a 400. When I omit that key it works. I'm thinking I am not understanding exactly what should go into the key. Does anyone have any ideas? I know drawings endpoint are supposedly not fully stable and it is not completely suggested to use them but I am hoping someone out there figured out how to make the template part work. It would be so perfect to be able to stop manually changing the template every time.
I have templates and I have supplied the appropriate details to the highlight keys in the image. But still, the drawing is created with a default onshape template. When I use the "templateName" key, the query reruns a 400. When I omit that key it works. I'm thinking I am not understanding exactly what should go into the key. Does anyone have any ideas? I know drawings endpoint are supposedly not fully stable and it is not completely suggested to use them but I am hoping someone out there figured out how to make the template part work. It would be so perfect to be able to stop manually changing the template every time.
0
Best Answer
-
shawn_crocker Member, OS Professional Posts: 861 PROJust figured it out. I tried using "templateWorkspaceId". Now the drawing gets created with the right template. It is strange the versionId doesn't work. Based on how the system works as a whole, I am surprise we are even able to reference the workspace like this.0
Answers
I have been doing that. I am currently using it without the "templateName" key. Everything runs as expected except the newly created drawing is set with a default template. This is the issue. That the template I am choosing does not seem to be getting read by the server or something.
Still on the topic of creating drawings using this endpoint… How do I add just a single view? I'm trying to create a drawing for a flat sheet metal, so I need to show just the top view, but it's giving me 4 standard views when I use it.
I haven't tried but, possibly only having a single top view in your template that you use for the call will work?
Try the steps here for creating a custom view template: https://onshape-public.github.io/docs/api-adv/drawings/#create-a-drawing-in-a-custom-graphics-area