Compare commits

...

6 Commits

Author SHA1 Message Date
Dion Moult b480b43435 BIM workspace tool is now no longer wall specific, and adapts to different element types 2021-07-12 17:34:35 +10:00
Dion Moult 3614587556 Fix #1558. New loading bar when importing an IFC. 2021-07-11 10:29:19 +10:00
Dion Moult 86ce367ba8 Fix #1561. 2021-07-11 09:28:22 +10:00
Thomas Krijnen d320c1dac1 Some quick and dirty #1560 2021-07-10 21:43:27 +02:00
Thomas Krijnen cf48661a35 limit schema versions on Travis 2021-07-10 21:10:03 +02:00
Thomas Krijnen 5e03846783 Update .travis.yml 2021-07-10 17:17:47 +02:00
8 changed files with 69 additions and 35 deletions
+6
View File
@@ -22,10 +22,15 @@ addons:
- nlohmann-json3-dev
- opencollada-dev
- python3-all-dev
- python3-pip
- swig
before_script:
- if [ $TRAVIS_OS_NAME == "linux" ]; then ccache -z; fi
install:
# for IDS
- python3 -m pip install xmlschema
script:
- pwd
@@ -39,6 +44,7 @@ script:
-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 \
-DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.8 \
-DPYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython3.8.so \
"-DSCHEMA_VERSIONS=2x3;4" \
-DGLTF_SUPPORT=On \
-DJSON_INCLUDE_DIR=/usr/include \
../cmake
+3 -1
View File
@@ -494,7 +494,9 @@ function(files_for_ifc_version IFC_VERSION RESULT_NAME)
)
endfunction()
set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_rc1" "4x3_rc2" "4x3_rc3" "4x3_rc4")
if(NOT SCHEMA_VERSIONS)
set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_rc1" "4x3_rc2" "4x3_rc3" "4x3_rc4")
endif()
foreach(s ${SCHEMA_VERSIONS})
add_definitions(-DHAS_SCHEMA_${s})
@@ -68,6 +68,8 @@ class IfcExporter:
for ifc_definition_id, obj in IfcStore.id_map.items():
try:
if isinstance(obj, bpy.types.Material):
continue
self.sync_object_placement(obj)
self.sync_object_container(ifc_definition_id, obj)
except ReferenceError:
+24 -4
View File
@@ -159,8 +159,16 @@ class IfcImporter:
self.time = time.time()
print("{} :: {:.2f}".format(message, time.time() - self.time))
self.time = time.time()
self.update_progress(self.progress + 1)
def update_progress(self, progress):
if progress <= 100:
self.progress = progress
bpy.context.window_manager.progress_update(self.progress)
def execute(self):
bpy.context.window_manager.progress_begin(0, 100)
self.progress = 0
self.profile_code("Starting import process")
self.load_diff()
self.profile_code("Load diff")
@@ -228,6 +236,8 @@ class IfcImporter:
self.profile_code("Mesh cleaning")
self.set_default_context()
self.profile_code("Setting default context")
self.update_progress(100)
bpy.context.window_manager.progress_end()
def is_element_far_away(self, element, is_meters=True):
try:
@@ -546,12 +556,21 @@ class IfcImporter:
if not valid_file:
return False
checkpoint = time.time()
total = 0
total_created = 0
approx_total_products = len(self.include_elements) or len(self.file.by_type("IfcElement"))
start_progress = self.progress
progress_range = 85 - start_progress
while True:
total += 1
if total % 250 == 0:
print("{} elements processed in {:.2f}s ...".format(total, time.time() - checkpoint))
if total_created % 250 == 0:
print(
"{} / ~{} elements processed in {:.2f}s ...".format(
total_created, approx_total_products, time.time() - checkpoint
)
)
checkpoint = time.time()
self.update_progress(
((total_created / approx_total_products) * progress_range) + start_progress
)
shape = iterator.get()
if shape:
product = self.file.by_id(shape.guid)
@@ -565,6 +584,7 @@ class IfcImporter:
pass
else:
self.create_product(product, shape)
total_created += 1
if not iterator.next():
break
print("Done creating geometry")
@@ -3,7 +3,7 @@ from . import handler, prop, ui, grid, product, wall, slab, stair, door, window,
classes = (
product.AddTypeInstance,
wall.AddWall,
workspace.HotkeyE,
wall.JoinWall,
wall.AlignWall,
wall.FlipWall,
@@ -36,21 +36,6 @@ def mode_callback(obj, data):
IfcStore.edited_objs.add(obj)
class AddWall(bpy.types.Operator):
bl_idname = "bim.add_wall"
bl_label = "Add Wall"
bl_options = {"REGISTER", "UNDO"}
join_type: bpy.props.StringProperty()
def execute(self, context):
return IfcStore.execute_ifc_operator(self, context)
def _execute(self, context):
props = context.scene.BIMModelProperties
bpy.ops.bim.add_type_instance(ifc_class="IfcWallType", relating_type=int(props.relating_type))
return {"FINISHED"}
class JoinWall(bpy.types.Operator):
bl_idname = "bim.join_wall"
bl_label = "Join Wall"
@@ -1,6 +1,7 @@
import os
import bpy
from bpy.types import WorkSpaceTool
from blenderbim.bim.ifc import IfcStore
class BimTool(WorkSpaceTool):
@@ -16,8 +17,8 @@ class BimTool(WorkSpaceTool):
bl_keymap = (
# ("bim.wall_tool_op", {"type": 'MOUSEMOVE', "value": 'ANY'}, {"properties": []}),
# ("mesh.add_wall", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}),
("bim.add_wall", {"type": "A", "value": "PRESS", "shift": True}, {"properties": []}),
("bim.join_wall", {"type": "E", "value": "PRESS", "shift": True}, {"properties": [("join_type", "T")]}),
("bim.add_type_instance", {"type": "A", "value": "PRESS", "shift": True}, {"properties": []}),
("bim.hotkey_e", {"type": "E", "value": "PRESS", "shift": True}, {"properties": []}),
("bim.join_wall", {"type": "T", "value": "PRESS", "shift": True}, {"properties": [("join_type", "L")]}),
("bim.join_wall", {"type": "Y", "value": "PRESS", "shift": True}, {"properties": [("join_type", "V")]}),
("bim.flip_wall", {"type": "F", "value": "PRESS", "shift": True}, {"properties": []}),
@@ -40,20 +41,38 @@ class BimTool(WorkSpaceTool):
)
def draw_settings(context, layout, tool):
props = context.scene.BIMModelProperties
row = layout.row(align=True)
props = context.scene.BIMTypeProperties
row.prop(props, "ifc_class", text="")
row.prop(props, "relating_type", text="")
row.label(text="", icon="BLANK1")
row.label(text="", icon="EVENT_SHIFT")
row.label(text="Add", icon="EVENT_A")
row.label(text="Extend", icon="EVENT_E")
row.label(text="Butt", icon="EVENT_T")
row.label(text="Mitre", icon="EVENT_Y")
row.label(text="Flip", icon="EVENT_F")
row.label(text="Split", icon="EVENT_S")
row.label(text="", icon="EVENT_X")
row.label(text="", icon="EVENT_C")
row.label(text="", icon="EVENT_V")
row.label(text="Align")
if props.ifc_class == "IfcWallType":
row.label(text="Extend", icon="EVENT_E")
row.label(text="Butt", icon="EVENT_T")
row.label(text="Mitre", icon="EVENT_Y")
row.label(text="Flip", icon="EVENT_F")
row.label(text="Split", icon="EVENT_S")
row.label(text="", icon="EVENT_X")
row.label(text="", icon="EVENT_C")
row.label(text="", icon="EVENT_V")
row.label(text="Align")
class HotkeyE(bpy.types.Operator):
bl_idname = "bim.hotkey_e"
bl_label = "Hotkey E"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
return IfcStore.execute_ifc_operator(self, context)
def _execute(self, context):
props = context.scene.BIMTypeProperties
if props.ifc_class == "IfcWallType":
bpy.ops.bim.join_wall(join_type="T")
return {"FINISHED"}
@@ -48,7 +48,7 @@ class entity_instance(object):
>>> #423=IfcProductDefinitionShape($,$,(#409,#421))
"""
def __init__(self, e, file):
def __init__(self, e, file=None):
if isinstance(e, tuple):
e = ifcopenshell_wrapper.new_IfcBaseClass(*e)
super(entity_instance, self).__setattr__("wrapped_data", e)
@@ -126,7 +126,7 @@ class entity_instance(object):
return entity_instance.wrap_value(self.wrapped_data.get_argument(key), self.wrapped_data.file)
def __setitem__(self, idx, value):
if self.wrapped_data.file.transaction:
if self.wrapped_data.file and self.wrapped_data.file.transaction:
self.wrapped_data.file.transaction.store_edit(self, idx, value)
attr_type = real_attr_type = self.attribute_type(idx).title().replace(" ", "")