Skip to content

Commit

Permalink
update Bim Sample/Test
Browse files Browse the repository at this point in the history
  • Loading branch information
CEXT-Dan committed Oct 14, 2024
1 parent da554af commit 307d8a2
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions PySamples/PyBrxBim/importTest.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
def createBoxSolid(length, depth, height, translation: Ge.Vector3d, clr):
try:
solid = Db.Solid3d()
solid.createBox(length,depth,height)
solid.createBox(length, depth, height)
mtx = Ge.Matrix3d()
if translation.isEqualTo(Ge.Vector3d.kIdentity) == False:
mtx.setToTranslation(translation)
@@ -23,49 +23,43 @@ def createBoxSolid(length, depth, height, translation: Ge.Vector3d, clr):
traceback.print_exception(err)
return Db.ObjectId()


class IfcImportReactor(Bim.IfcImportReactor):
def __init__(self, desc, guid):
try:
Bim.IfcImportReactor.__init__(self, desc, guid)
self.m_onStartCalled = False
self.m_onProductCalled = False
self.m_completionCalled = False
self.m_onIfcProductImportedCalled = False

except Exception:
traceback.print_exc()

def onStart(self, context, project, info):
try:
print("onStart")
self.m_onStartCalled = True
print(context, project, info)
except Exception:
traceback.print_exc()

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

mat = context.getLocalPlacement(entity)
createBoxSolid(100.0,100.0,100.0, mat.getTranslation(),1)

return True


# print(context.getLocalPlacement(entity))
# print("\nonIfcProduct {}".format( entity.IfcId()))
# print("\nonIfcProduct {}".format( entity.getAttribute()))
# print(context, entity, isParent, parentEntity)
self.m_onProductCalled = True
print("onIfcProduct")
if entity.isKindOf(Bim.IfcEntityDesc.IfcWindow()):
mat = context.getLocalPlacement(entity)
createBoxSolid(100.0, 100.0, 100.0, mat.getTranslation(), 1)
return True
except:
return True


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

finally:
return False

def beforeCompletion(self, context, success):
try:
self.m_completionCalled = True
print("beforeCompletion")
print(context, success)
except Exception:
@@ -75,6 +69,7 @@ def onIfcProductImported(
self, sourceEntity, isParent, sourceParentEntity, createdAcEntites, xfrom
):
try:
self.m_onIfcProductImportedCalled = True
print("onIfcProductImported")
print(sourceEntity, isParent, sourceParentEntity, createdAcEntites, xfrom)
except Exception:

0 comments on commit 307d8a2

Please sign in to comment.