mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
black format, cleanup, notes
bim.generate_global_id - forgot to remove it previously, this operator isn't intended for debug section
This commit is contained in:
@@ -102,6 +102,8 @@ class IfcExporter:
|
||||
if result:
|
||||
results.append(result)
|
||||
result = self.sync_object_material(obj)
|
||||
# TODO: sync_object_material always returns None
|
||||
# so it's never really appended
|
||||
if result:
|
||||
results.append(result)
|
||||
except ReferenceError:
|
||||
@@ -142,7 +144,6 @@ class IfcExporter:
|
||||
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
if not tool.Ifc.is_moved(obj):
|
||||
return
|
||||
blender_matrix = np.array(obj.matrix_world)
|
||||
if (obj.scale - Vector((1.0, 1.0, 1.0))).length > 1e-4:
|
||||
bpy.ops.bim.update_representation(obj=obj.name)
|
||||
return element
|
||||
|
||||
@@ -75,9 +75,6 @@ class BIM_PT_debug(Panel):
|
||||
row = layout.row()
|
||||
row.operator("bim.profile_import_ifc")
|
||||
|
||||
row = layout.row()
|
||||
row.operator("bim.generate_global_id")
|
||||
|
||||
row = layout.split(factor=0.5, align=True)
|
||||
row.operator("bim.create_shape_from_step_id").should_include_curves = False
|
||||
row.operator("bim.create_shape_from_step_id", text="", icon="IPO_ELASTIC").should_include_curves = True
|
||||
|
||||
@@ -512,6 +512,7 @@ class CreateDrawing(bpy.types.Operator):
|
||||
|
||||
for ifc_path, ifc in files.items():
|
||||
# Don't use draw.main() just whilst we're prototyping and experimenting
|
||||
# TODO: hash paths are never used
|
||||
ifc_hash = hashlib.md5(ifc_path.encode("utf-8")).hexdigest()
|
||||
ifc_cache_path = os.path.join(context.scene.BIMProperties.data_dir, "cache", f"{ifc_hash}.h5")
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import annotations
|
||||
import blenderbim.core.style
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
import blenderbim.core.tool as tool
|
||||
|
||||
@@ -200,23 +199,25 @@ def select_connection(geometry, connection=None):
|
||||
def remove_connection(geometry, connection=None):
|
||||
geometry.remove_connection(connection)
|
||||
|
||||
|
||||
def get_similar_openings(ifc, opening):
|
||||
model = ifc.get()
|
||||
all_openings = model.by_type("IfcOpeningElement")
|
||||
similar_openings = [o for o in all_openings if o.ObjectPlacement == opening.ObjectPlacement and o != opening]
|
||||
return similar_openings
|
||||
|
||||
|
||||
def get_similar_openings_building_objs(ifc, similar_openings):
|
||||
building_objs = []
|
||||
for similar_opening in similar_openings:
|
||||
building_objs.append(ifc.get_object(similar_opening.VoidsElements[0].RelatingBuildingElement))
|
||||
return building_objs
|
||||
|
||||
def edit_similar_opening_placement(geometry, opening = None, similar_openings = None):
|
||||
|
||||
def edit_similar_opening_placement(geometry, opening=None, similar_openings=None):
|
||||
if not opening or not similar_openings:
|
||||
return
|
||||
for similar_opening in similar_openings:
|
||||
old_placement = similar_opening.ObjectPlacement
|
||||
similar_opening.ObjectPlacement = opening.ObjectPlacement
|
||||
geometry.delete_opening_object_placement(old_placement)
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ def select_decomposed_elements(spatial):
|
||||
if container:
|
||||
spatial.select_products(spatial.get_decomposed_elements(container))
|
||||
|
||||
|
||||
#HERE STARTS SPATIAL TOOL
|
||||
def generate_space(ifc, spatial, model, Type):
|
||||
active_obj = spatial.get_active_obj()
|
||||
@@ -163,7 +164,7 @@ def generate_space(ifc, spatial, model, Type):
|
||||
relating_type = None
|
||||
|
||||
if selected_objects and active_obj:
|
||||
x, y, z, h, mat = spatial.get_x_y_z_h_mat_from_active_obj(active_obj) ##mat
|
||||
x, y, z, h, mat = spatial.get_x_y_z_h_mat_from_active_obj(active_obj) ##mat
|
||||
element = ifc.get_entity(active_obj)
|
||||
|
||||
else:
|
||||
@@ -174,9 +175,9 @@ def generate_space(ifc, spatial, model, Type):
|
||||
if not space_polygon:
|
||||
return
|
||||
|
||||
bm = spatial.get_bmesh_from_polygon(space_polygon, h=h) ##mat
|
||||
bm = spatial.get_bmesh_from_polygon(space_polygon, h=h) ##mat
|
||||
|
||||
mesh = spatial.get_named_mesh_from_bmesh(name = "Space", bmesh = bm)
|
||||
mesh = spatial.get_named_mesh_from_bmesh(name="Space", bmesh=bm)
|
||||
|
||||
if element and element.is_a("IfcSpace"):
|
||||
mesh = spatial.get_transformed_mesh_from_local_to_global(mesh)
|
||||
@@ -197,6 +198,7 @@ def generate_space(ifc, spatial, model, Type):
|
||||
if relating_type:
|
||||
spatial.assign_relating_type_to_element(ifc, Type, element, relating_type)
|
||||
|
||||
|
||||
def generate_spaces_from_walls(ifc, spatial, collector):
|
||||
z = spatial.get_active_obj_z()
|
||||
h = spatial.get_active_obj_height()
|
||||
@@ -210,7 +212,7 @@ def generate_spaces_from_walls(ifc, spatial, collector):
|
||||
|
||||
name = "Space" + str(i)
|
||||
|
||||
obj = spatial.get_named_obj_from_bmesh(name, bmesh = bm)
|
||||
obj = spatial.get_named_obj_from_bmesh(name, bmesh=bm)
|
||||
|
||||
spatial.set_obj_origin_to_bboxcenter(obj)
|
||||
spatial.traslate_obj_to_z_location(obj, z)
|
||||
@@ -227,6 +229,7 @@ def toggle_space_visibility(ifc, spatial):
|
||||
return
|
||||
spatial.toggle_spaces_visibility_wired_and_textured(spaces)
|
||||
|
||||
|
||||
def toggle_hide_spaces(ifc, spatial):
|
||||
model = ifc.get()
|
||||
spaces = model.by_type("IfcSpace")
|
||||
|
||||
Reference in New Issue
Block a user