Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

exporting single parts and surface within a part studio as seperate stl files

tanja_matzerathtanja_matzerath Member Posts: 9 EDU
Hey everyone,

I am using a python script to export a PartStudio as stl.  For this I have created a function as described here (https://colab.research.google.com/github/PTC-Education/PTC-API-Playground/blob/main/Onshape_API_Snippets.ipynb#scrollTo=Ql6qSU3pzWEC ; 01.5 PartStudios -Export STL).

However, my PartStudio consists of individual parts and surfaces.
So my question is: How can I pass the information to the client which part or surface I want exported as stl?

An alternative would of course be to store the individual parts in one sheet each, so that the element ID changes, but I don't like this solution very much.

Does anyone have an idea?

Thanks in advance




Comments

  • Matt_ShieldsMatt_Shields Member, Onshape Employees Posts: 415
    edited October 2023
    Yes, it's possible.  When you make the POST request to https://cad.onshape.com/api/partstudios/d/{}/w/{}/e/{}/translations, you can send along parameters such as individual part IDs you want. You could use the parts endpoint to retrieve the part IDs and then grab the one you want.  Then, for example, you could add
    json={
      "configuration": "",  # Add configurations if needed
      "formatName": "STL",  # Use a valid translation name
      "storeInDocument": False,
      "partIds": "JOD".     # Part ID grabbed from an earlier call
    }
    to your POST request.

    Example:
    https://colab.research.google.com/drive/100W3o_Fw_cXdPbWplirfsUOLfKms92bH?usp=sharing
  • tanja_matzerathtanja_matzerath Member Posts: 9 EDU
    Thank you very much. This is exactly what I was looking for.


Sign In or Register to comment.