Skip to content

Commit

Permalink
Sets the lock button at observer start - issue #64
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Mar 25, 2024
1 parent 5a85a4d commit 8b57578
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ifc_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def insert(
print("Aborted.")
return
stime = time.time()
document = FreeCAD.getDocument(docname)
try:
document = FreeCAD.getDocument(docname)
except:
document = FreeCAD.newDocument()
if singledoc is None:
singledoc = params.GetBool("SingleDoc", False)
if singledoc:
Expand Down
6 changes: 5 additions & 1 deletion ifc_observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def add_observer():
class ifc_observer:
"""A general document observer that handles IFC objects"""

# slots
def __init__(self):
# if there is a document open when the observer starts,
# check it
if FreeCAD.ActiveDocument:
self.slotActivateDocument(FreeCAD.ActiveDocument)

def slotStartSaveDocument(self, doc, value):
"""Save all IFC documents in this doc"""
Expand Down

0 comments on commit 8b57578

Please sign in to comment.