Added a safety feature to remove bad characters from the file name before trying to create or update the 3D document view.

This commit is contained in:
Jeremy Mack Wright 2016-07-31 23:36:22 -04:00
parent ef223c260c
commit c319b4f7f0

View File

@ -166,7 +166,12 @@ class CadQueryExecuteScript:
docname = os.path.splitext(os.path.basename(cqCodePane.file.path))[0]
#If the matching 3D view has been closed, we need to open a new one
# Make sure we replace any troublesome characters
for ch in ['&', '#', '.', '-', '$', '%', ',', ' ']:
if ch in docname:
docname = docname.replace(ch, "")
# If the matching 3D view has been closed, we need to open a new one
try:
FreeCAD.getDocument(docname)
except: