Skip to content

Commit

Permalink
push push push
Browse files Browse the repository at this point in the history
  • Loading branch information
apockill committed Mar 14, 2024
1 parent d54f323 commit 1451158
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
24 changes: 17 additions & 7 deletions onshape_urdf_exporter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,23 @@ def addPart(occurrence, matrix):
).hexdigest()
else:
shortend_configuration = part["configuration"]
stl = client.part_studio_stl_m(
part["documentId"],
part["documentMicroversion"],
part["elementId"],
part["partId"],
shortend_configuration,
)

try:
stl = client.part_studio_stl_m(
part["documentId"],
part["documentMicroversion"],
part["elementId"],
part["partId"],
shortend_configuration,
)
except ConnectionRefusedError as e:
print(
Fore.RED
+ f"Skipping part {part['name']}, because of connection error: {e}"
+ Style.RESET_ALL
)
return

stl_file.write_bytes(stl)
if config.simplify_stls:
simplify_stl(stl_file)
Expand Down
6 changes: 5 additions & 1 deletion onshape_urdf_exporter/onshape_api/onshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,13 @@ def request(self, method, path, query={}, headers={}, body={}, base_url=None):
print(
"HINT: Check that your access rights are correct, and that the clock on your computer is set correctly"
)
exit()
raise ConnectionRefusedError(
"HINT: Check that your access rights are correct, and that the clock on your computer is set correctly"
)
if self._logging:
utils.log("request failed, details: " + res.text, level=1)
exit()

else:
if self._logging:
utils.log("request succeeded, details: " + res.text)
Expand Down

0 comments on commit 1451158

Please sign in to comment.