Rhoban / onshape-to-robot

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

KeyError: 'suppressed' #100

Open JHPHELAN opened 1 year ago

JHPHELAN commented 1 year ago

Recently installed OnShape-to-robot plus accessories on a Dell laptop / Ubuntu 22.04 successfully. my config.json points with appropriate access and secret keys to MY COPY the JPL Open Source Rover: https://cad.onshape.com/documents/5c358484057fc4c01d5e5803/w/bdf583acdf29d75695be5fbc/e/e3eb7193ecdec5b0a710978b ubuntu@LinuxBox:~$ onshape-to-robot OnShape-OSR

* Checking OpenSCAD presence...
* Checking MeshLab presence...

* Retrieving workspace ID ...
+ Using workspace id: ec57fc1702d5177d685a86c9

* Retrieving elements in the document, searching for the assembly...
+ Found assembly, id: ccf42f743a831a145aea7c8a, name: "Rover"

* Retrieving assembly "Rover" with id ccf42f743a831a145aea7c8a

* Getting assembly features, scanning for DOFs...
* Found total 0 DOFs

* Building robot tree
* Trunk is Mechanical Integration <1>
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/onshape-to-robot", line 8, in <module>
    sys.exit(onshape_to_robot.main())
  File "/home/ubuntu/.local/lib/python3.10/site-packages/onshape_to_robot/onshape_to_robot.py", line 17, in main
    from .load_robot import \
  File "/home/ubuntu/.local/lib/python3.10/site-packages/onshape_to_robot/load_robot.py", line 336, in <module>
    if not occurrence['instance']['suppressed']:
**KeyError: 'suppressed'`**

The 'KeyError: 'suppressed' error apparently refers to 'suppressed' not being in the 'defaultdict' referred to in 'load_robot.py'. I can't find the actual dictionary despite considerable digging. I'll see what happens if I 'comment out' that block of code....

When I do, it gets farther until it complains about a screw with no mass, then a missing resource:

WARNING: part Socket button head cap screw #6-32 x 0.75 <3> has no mass, maybe you should assign a material to it ?
+ Adding part Pad 2 <1>
https://cad.onshape.com/api/parts/d/4e80c35d6ce2977369966f00/m/7ac9aca0c476e9242713b6a1/e/13c617a504fd8cb4616fc014/partid/JjH/stl?mode=binary&units=meter&configuration=default
! ERROR (403) while using OnShape API
! {
  "message" : "Resource does not exist, or you do not have permission to access it.",
  "moreInfoUrl" : "",
  "status" : 403,
  "code" : 0
}
Gregwar commented 1 year ago

Hello,

Maybe we can consider something like:

if 'suppressed' not in occurrence['instance'] or not occurrence['instance']['suppressed']:

About the access problem, unfortunately there is little I can do about that, permissions in onshape are sometime hard to understand. Did you make a copy of the document you are importing to be sure you have all the permissions?

JHPHELAN commented 1 year ago

@Gregwar It seems from what I gather it's not that we're not testing correctly for ['suppressed'], but rather that 'suppressed' needs to be added to some dictionary.

I did make a cc of the document. I suspect it's more that the part isn't there than I'm lacking permission. I can find a reference to it, but it lacks detail. Seems to be a solder pad on an Arduino.