Skip to content

Commit

Permalink
Remove special characters from part names
Browse files Browse the repository at this point in the history
Replace `"` with `in` in part names since it the quote breaks the
generated XML. Also replace `'` with `ft` for consistency.
  • Loading branch information
Ryan Sinnet committed Jul 4, 2022
1 parent 07d9fb3 commit 2717ff8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions onshape_to_robot/onshape_to_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ def partIsIgnore(name):
# Adds a part to the current robot link


def renamePart(name):
"""Remove special characters from part names."""
return name.replace('"', "in").replace("'", "ft")

def addPart(occurrence, matrix):
part = occurrence['instance']
part['name'] = renamePart(part['name'])
part['configuration'] = renamePart(part['configuration'])

if part['suppressed']:
return
Expand Down

0 comments on commit 2717ff8

Please sign in to comment.