Rhoban / onshape-to-robot

Converting OnShape assembly to robot definition (SDF or URDF) through OnShape API
MIT License
237 stars 55 forks source link

Ignoring configuration option in config.json #59

Open agillies8 opened 2 years ago

agillies8 commented 2 years ago

When I use the export tool, it seems to ignore the configuration specification in the config.json file:

Eg:

"documentId": "abcdefghi123456789", "outputFormat": "urdf", "assemblyName": "myrobot", "versionId": "abcdefghi123456789", "configuration: "extra long legs",

no matter what I put, the default configuration is always exported. Is there something I am missing?

Additionally - some of my links in the top level assembly are sub-assemblies. Is there any way to specify configurations for these sub-assemblies?

Gregwar commented 2 years ago

Hello,

Setting the "configuration name"

I guess you are using a configuration "list" to set your global configuration. When you do that, OnShape generates a random name for the configuration variable you can't see. Here are the steps if you want to use it from the API:

Go to your assembly, your URL should looks like:

https://cad.onshape.com/documents/XXX/w/YYY/e/ZZZ

Replace documents with api/assemblies/d/, it should look like:

https://cad.onshape.com/api/assemblies/d/XXX/w/YYY/e/ZZZ

You will see something similar to:

...
"fullConfiguration" : "List_I4JxJYIGTR44Gf=Default"
...

Here, List_I4JxJYIGTR44Gf is what you are searching for. You can now set something like:

"configuration": "List_I4JxJYIGTR44Gf=extra long legs"

This should be fixed in the future to use the /api/elements/d/.../configuration API to retrieve the actual names of the parameters, so that we could write "configuration": "Configuration=Something" instead.

Forwarding configuration to sub-assemblies

You can use the configuration of your top-level assemblies to define which configuration will be used for a sub-assembly. This can be done by clicking on "Configure assembly features" on the top on your list, then click on the part on your tree, it will add the possibility to configure which instance will be used depending on the top-level assembly configuration.

Hope it helps

agillies8 commented 2 years ago

Thanks for this @Gregwar for the rapid and thorough response. I was actually using configuration tables, not list input - but I went back and changed to a list input and was able to find the List ID you mentioned. Unfortunately it still seems to ignore the top level configuration settings.

Additionally, one of my sub assemblies is still being included in the urdf export despite seemingly any combination of configuration and suppression settings I am applying. This may be a separate issue, but including here in case they happen to be related?