Fixed a bug where Helpers.show could not be called more than once, and one that kept macros from being used instead of script editor tabs.
This commit is contained in:
parent
b72b9f4580
commit
36726d5344
|
@ -119,6 +119,9 @@ class CadQueryExecuteScript:
|
||||||
# Grab our code editor so we can interact with it
|
# Grab our code editor so we can interact with it
|
||||||
cqCodePane = Shared.getActiveCodePane()
|
cqCodePane = Shared.getActiveCodePane()
|
||||||
|
|
||||||
|
# Clear the old render before re-rendering
|
||||||
|
Shared.clearActiveDocument()
|
||||||
|
|
||||||
# Save our code to a tempfile and render it
|
# Save our code to a tempfile and render it
|
||||||
tempFile = tempfile.NamedTemporaryFile(delete=False)
|
tempFile = tempfile.NamedTemporaryFile(delete=False)
|
||||||
tempFile.write(cqCodePane.toPlainText().encode('utf-8'))
|
tempFile.write(cqCodePane.toPlainText().encode('utf-8'))
|
||||||
|
|
|
@ -15,26 +15,24 @@ def show(cqObject, rgba=(204, 204, 204, 0.0)):
|
||||||
# Grab our code editor so we can interact with it
|
# Grab our code editor so we can interact with it
|
||||||
cqCodePane = Shared.getActiveCodePane()
|
cqCodePane = Shared.getActiveCodePane()
|
||||||
|
|
||||||
# Clear the old render before re-rendering
|
if cqCodePane != None:
|
||||||
Shared.clearActiveDocument()
|
# Save our code to a tempfile and render it
|
||||||
|
tempFile = tempfile.NamedTemporaryFile(delete=False)
|
||||||
|
tempFile.write(cqCodePane.toPlainText().encode('utf-8'))
|
||||||
|
tempFile.close()
|
||||||
|
|
||||||
# Save our code to a tempfile and render it
|
docname = os.path.splitext(os.path.basename(cqCodePane.file.path))[0]
|
||||||
tempFile = tempfile.NamedTemporaryFile(delete=False)
|
|
||||||
tempFile.write(cqCodePane.toPlainText().encode('utf-8'))
|
|
||||||
tempFile.close()
|
|
||||||
|
|
||||||
docname = os.path.splitext(os.path.basename(cqCodePane.file.path))[0]
|
# Make sure we replace any troublesome characters
|
||||||
|
for ch in ['&', '#', '.', '-', '$', '%', ',', ' ']:
|
||||||
|
if ch in docname:
|
||||||
|
docname = docname.replace(ch, "")
|
||||||
|
|
||||||
# Make sure we replace any troublesome characters
|
# If the matching 3D view has been closed, we need to open a new one
|
||||||
for ch in ['&', '#', '.', '-', '$', '%', ',', ' ']:
|
try:
|
||||||
if ch in docname:
|
FreeCAD.getDocument(docname)
|
||||||
docname = docname.replace(ch, "")
|
except:
|
||||||
|
FreeCAD.newDocument(docname)
|
||||||
# If the matching 3D view has been closed, we need to open a new one
|
|
||||||
try:
|
|
||||||
FreeCAD.getDocument(docname)
|
|
||||||
except:
|
|
||||||
FreeCAD.newDocument(docname)
|
|
||||||
|
|
||||||
ad = FreeCAD.activeDocument()
|
ad = FreeCAD.activeDocument()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user