Skip to content

Commit

Permalink
update sample
Browse files Browse the repository at this point in the history
  • Loading branch information
CEXT-Dan committed Oct 14, 2024
1 parent 69ac003 commit 49a7e07
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions PySamples/PyBrxBim/importTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,41 @@ def __init__(self, desc, guid):
def onStart(self, context, project, info):
try:
self.m_onStartCalled = True
print(context, project, info)
# print(context, project, info)
except Exception:
traceback.print_exc()

def onIfcProduct(self, context, entity, isParent, parentEntity):
try:
self.m_onProductCalled = True
print("onIfcProduct")
if entity.isKindOf(Bim.IfcEntityDesc.IfcWindow()):

# print(entity.IfcId())

# w = entity.getAttribute("OverallWidth")
# print("Width", w.type(), w.getReal())

# h = entity.getAttribute("OverallHeight")
# print("Height", h.type(), h.getReal())

#mat = context.getLocalPlacement(entity)
#createBoxSolid(100.0, 100.0, 100.0, mat.getTranslation(), 1)
return False
return True
# if entity.isKindOf(Bim.IfcEntityDesc.IfcWindow()):
# # w = entity.getAttribute("OverallWidth")
# # print("Width", w.type(), w.getReal())

# # h = entity.getAttribute("OverallHeight")
# # print("Height", h.type(), h.getReal())

# #mat = context.getLocalPlacement(entity)
# #createBoxSolid(100.0, 100.0, 100.0, mat.getTranslation(), 1)
# return True
return False

except Exception as err:
traceback.print_exception(err)
return False

def beforeCompletion(self, context, success):
try:
self.m_completionCalled = True
print("beforeCompletion")
print(context, success)
return True
except Exception:
traceback.print_exc()

def onIfcProductImported(
self, sourceEntity, isParent, sourceParentEntity, createdAcEntites, xfrom
self, sourceEntity, isParent, sourceParentEntity, createdAcEntites, xform
):
try:
self.m_onIfcProductImportedCalled = True
print("onIfcProductImported")
print(sourceEntity, isParent, sourceParentEntity, createdAcEntites, xfrom)
except Exception:
traceback.print_exc()

Expand All @@ -94,6 +88,11 @@ def PyRxCmd_doit1():

Bim.IfcImportOptions.importIfcFile(db, path, opts)

print("onStartCalled", reactor.m_onStartCalled)
print("onProductCalled", reactor.m_onProductCalled)
print("completionCalled", reactor.m_completionCalled)
print("onIfcProductImportedCalled", reactor.m_onIfcProductImportedCalled)

except Exception:
traceback.print_exc()
finally:
Expand Down

0 comments on commit 49a7e07

Please sign in to comment.