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.

[API] Retrieving nested sub-assembly mate values in context of parent assembly?

cc_chen488cc_chen488 Member Posts: 4

Hi everyone,

I am working on a custom URDF exporter and I am trying to retrieve the current mate values for a full assembly hierarchy.

The ProblemI am currently testing the Assembly: getMateValues endpoint. While this successfully returns mates for the top-level assembly, it excludes mates located within sub-assemblies.

The ConstraintI cannot simply query the API for each sub-assembly explicitly. I need the mate values as they are resolved in the context of the main assembly, which often differ from the values inside the sub-assembly studio itself.

Use CaseTo minimize API calls, my goal is to export the entire assembly geometry (STEP) once and process the tree offline. However, this method relies on retrieving the correct mate values (joint states) for the entire hierarchy, not just the root level.

QuestionIs there a specific parameter or different workflow to retrieve these nested, context-specific mate values?

Thanks!

Answers

  • eca_elioaceca_elioac Member Posts: 17 ✭✭

    I'll use recursive for things like this…

    processAssembly(assembly):
    getMateValues(assembly)

    for each instance in assembly.instances:
    if instance is Assembly:
    processAssembly(instance)
    else:
    processPart(instance)


    something like this

  • cc_chen488cc_chen488 Member Posts: 4

    Unfortunately this does not work as expected 😥 because when you call the api on the subassembly, you get the mate values in that specific document but not the values in the main assembly document (they are different values).

Sign In or Register to comment.