Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Some parts may require more complex scad shapes to accurately match their collision properties.
These can be easily assembled by adding multiple shapes to the editor together with translation functions.

Example:

Code Block
translate([-115, -145, -68]) {
    cube([230 , 170, 200], 
        center = false);
}

translate([115, -145, -68]) {
    cylinder(200, 200, center = false);
}

Using .scad-files with the onshape-to-robot export tool

1. Install onshape-to-robot

Run this command from a linux console to install the tool:

Code Block
pip install onshape-to-robot

2. Create a config.json file

For onshape-to-robot to run you need a file containing the export parameters. This is a json file simply named “config.json”. Put this file into the folder where the export data should be exported into.

You can use one of the config.json files from our digital-twin github repository.
The parameters should already be prepared for a correct pib export. All you need to add is your onshape_access_key and onshape_secret_key. Which you can find on the “API Keys”-section of the onshape dev portal (https://dev-portal.onshape.com/keys).

Info

The onshape-to-robot website contains a guide explaining all export parameters in detail

3. Install OpenSCAD and MeshLab

For Onshape-To-Robot to apply the scad models, OpenSCAD and MeshLab need to be installed on the Linux system where you want to run the export. It can be installed using this command:

Code Block
sudo apt-get install openscad meshlab
Info

If one of the programs is missing, the export will still produce an URDF-file, but it will use the .stl meshes instead instead of the .scad models. The only notification you will get is the this console error message right after starting the export:

Error-Message No OpenScadpng.pngImage Added

4. Move the scad files into the config.json folder

You need to move all your .scad-files into the same directory that also contains your config.json-file.

Onshape-to-robot will then replace all collision elements that would normally use the .stl meshes with the corresponding scad models. For this to work, the .scad and .stl files need to have the same name.

5. Run the export

If all prior steps were completed, you should now be able to successfully export an URDF-file containing the scad models as colliders with the following command:

Code Block
onshape-to-robot your_target_folder_name

The files should now be generated in the target folder.

...