Skip to content

Commit cdce612

Browse files
committed
Update all geom settings to new v0.8 syntax
1 parent 52f9db4 commit cdce612

17 files changed

Lines changed: 37 additions & 40 deletions

File tree

src/blenderbim/blenderbim/bim/import_ifc.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,18 +398,18 @@ def sort_subcontext(context):
398398

399399
for context in self.contexts:
400400
settings = ifcopenshell.geom.settings()
401-
settings.set('mesher-linear-deflection', self.ifc_import_settings.deflection_tolerance)
402-
settings.set('mesher-angular-deflection', self.ifc_import_settings.angular_tolerance)
403-
settings.set('dimensionality', ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
404-
settings.set('context-ids', [context.id()])
401+
settings.set("mesher-linear-deflection", self.ifc_import_settings.deflection_tolerance)
402+
settings.set("mesher-angular-deflection", self.ifc_import_settings.angular_tolerance)
403+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
404+
settings.set("context-ids", [context.id()])
405405
self.context_settings.append(settings)
406406

407407
settings = ifcopenshell.geom.settings()
408-
settings.set('mesher-linear-deflection', self.ifc_import_settings.deflection_tolerance)
409-
settings.set('mesher-angular-deflection', self.ifc_import_settings.angular_tolerance)
410-
settings.set('dimensionality', ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
411-
settings.set('disable-opening-subtractions', True)
412-
settings.set('context-ids', [context.id()])
408+
settings.set("mesher-linear-deflection", self.ifc_import_settings.deflection_tolerance)
409+
settings.set("mesher-angular-deflection", self.ifc_import_settings.angular_tolerance)
410+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
411+
settings.set("disable-opening-subtractions", True)
412+
settings.set("context-ids", [context.id()])
413413
self.gross_context_settings.append(settings)
414414

415415
def process_element_filter(self) -> None:

src/blenderbim/blenderbim/bim/module/boundary/operator.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,11 @@ def create_mesh(self, boundary):
133133
return mesh
134134

135135
def load_settings(self):
136-
settings = ifcopenshell.geom.settings()
137-
settings.set(settings.EXCLUDE_SOLIDS_AND_SURFACES, False)
138-
settings.set(settings.USE_BREP_DATA, False)
139-
return settings
136+
return ifcopenshell.geom.settings()
140137

141138
def load_fallback_settings(self):
142139
settings = ifcopenshell.geom.settings()
143-
settings.set(settings.INCLUDE_CURVES, True)
140+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
144141
return settings
145142

146143
def load_importer(self):
@@ -692,7 +689,7 @@ def auto_generate_boundaries(self, space, space_obj):
692689
tree = ifcopenshell.geom.tree()
693690
shapes = {}
694691
settings = ifcopenshell.geom.settings()
695-
settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True)
692+
settings.set("disable-opening-subtractions", True)
696693
iterator = ifcopenshell.geom.iterator(settings, tool.Ifc.get(), multiprocessing.cpu_count(), include=include)
697694
if iterator.initialize():
698695
while True:
@@ -1030,7 +1027,7 @@ def get_flattened_polygon(self, element, relating_space_obj, target_face_matrix_
10301027

10311028
settings = ifcopenshell.geom.settings()
10321029
if not element.is_a("IfcOpeningElement"):
1033-
settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True)
1030+
settings.set("disable-opening-subtractions", True)
10341031
# geometry = ifcopenshell.geom.create_shape(settings, body)
10351032
shape = ifcopenshell.geom.create_shape(settings, element)
10361033
m = shape.transformation.matrix

src/blenderbim/blenderbim/bim/module/debug/operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def execute(self, context):
172172
total = len(elements)
173173
settings = ifcopenshell.geom.settings()
174174
settings_2d = ifcopenshell.geom.settings()
175-
settings_2d.set(settings_2d.INCLUDE_CURVES, True)
175+
settings_2d.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
176176
failures = []
177177
excludes = () # For the developer to debug with
178178
for i, element in enumerate(elements, 1):
@@ -225,7 +225,7 @@ def _execute(self, context):
225225
element = self.file.by_id(self.step_id or int(context.scene.BIMDebugProperties.step_id))
226226
settings = ifcopenshell.geom.settings()
227227
if self.should_include_curves:
228-
settings.set(settings.INCLUDE_CURVES, True)
228+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
229229
shape = ifcopenshell.geom.create_shape(settings, element)
230230
if shape:
231231
ifc_importer = import_ifc.IfcImporter(self.ifc_import_settings)

src/blenderbim/blenderbim/bim/module/model/opening.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def get_curve_2d_from_3d(profile):
291291
return tool.Ifc.get().createIfcIndexedPolyCurve(Points=ifc_points, Segments=ifc_segments)
292292

293293
settings = ifcopenshell.geom.settings()
294-
settings.set(settings.INCLUDE_CURVES, True)
294+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
295295
geometry = ifcopenshell.geom.create_shape(settings, profile)
296296
verts = ifcopenshell.util.shape.get_vertices(geometry)
297297
# [0, 2] represents X and Z ordinates

src/blenderbim/blenderbim/bim/module/qto/calculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ def create_shapely_polygon(obj: bpy.types.Object, polygon: bpy.types.MeshPolygon
11621162

11631163
def get_gross_element_mesh(element: ifcopenshell.entity_instance) -> bpy.types.Mesh:
11641164
settings = ifcopenshell.geom.settings()
1165-
settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True)
1165+
settings.set("disable-opening-subtractions", True)
11661166
return create_mesh_from_shape(element, settings)
11671167

11681168

src/blenderbim/blenderbim/tool/geometry.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,28 +514,28 @@ def import_representation(cls, obj, representation, apply_openings=True):
514514
ifc_import_settings = blenderbim.bim.import_ifc.IfcImportSettings.factory(bpy.context, None, logger)
515515
element = tool.Ifc.get_entity(obj)
516516
settings = ifcopenshell.geom.settings()
517-
settings.set(settings.WELD_VERTICES, True)
517+
settings.set("weld-vertices", True)
518518
context = representation.ContextOfItems
519519

520520
if element.is_a("IfcTypeProduct"):
521521
# You may only specify a single representation when creating shapes for types
522522
try:
523523
shape = ifcopenshell.geom.create_shape(settings, representation)
524524
except:
525-
settings.set(settings.INCLUDE_CURVES, True)
525+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
526526
shape = ifcopenshell.geom.create_shape(settings, representation)
527527
else:
528528
if not apply_openings:
529-
settings.set(settings.DISABLE_OPENING_SUBTRACTIONS, True)
529+
settings.set("disable-opening-subtractions", True)
530530

531531
if context.ContextIdentifier == "Body" and context.TargetView == "MODEL_VIEW":
532532
try:
533533
shape = ifcopenshell.geom.create_shape(settings, element, representation)
534534
except:
535-
settings.set(settings.INCLUDE_CURVES, True)
535+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
536536
shape = ifcopenshell.geom.create_shape(settings, element, representation)
537537
else:
538-
settings.set(settings.INCLUDE_CURVES, True)
538+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
539539
shape = ifcopenshell.geom.create_shape(settings, element, representation)
540540

541541
ifc_importer = blenderbim.bim.import_ifc.IfcImporter(ifc_import_settings)
@@ -779,7 +779,7 @@ def reload_representation(cls, obj_or_objs: Union[bpy.types.Object, Iterable[bpy
779779
# Filter out unique meshes to avoid
780780
# reloading the same representation multiple times.
781781
meshes_to_objects: dict[bpy.types.Mesh, bpy.types.Object]
782-
meshes_to_objects = {(obj:=tool.Ifc.get_object(element)).data: obj for element in elements}
782+
meshes_to_objects = {(obj := tool.Ifc.get_object(element)).data: obj for element in elements}
783783

784784
for obj in meshes_to_objects.values():
785785
representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id)

src/blenderbim/blenderbim/tool/profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def draw_image_for_ifc_profile(
3636
) -> None:
3737
"""generates image based on `profile` using `PIL.ImageDraw`"""
3838
settings = ifcopenshell.geom.settings()
39-
settings.set(settings.INCLUDE_CURVES, True)
39+
settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)
4040
shape = ifcopenshell.geom.create_shape(settings, profile)
4141
verts = shape.verts
4242
edges = shape.edges

src/blenderbim/blenderbim/tool/spatial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def get_boundary_lines_from_context_visible_objects(cls):
419419
@classmethod
420420
def get_gross_mesh_from_element(cls, visible_element):
421421
gross_settings = ifcopenshell.geom.settings()
422-
gross_settings.set(gross_settings.DISABLE_OPENING_SUBTRACTIONS, True)
422+
gross_settings.set("disable-opening-subtractions", True)
423423
new_mesh = cls.create_mesh_from_shape(ifcopenshell.geom.create_shape(gross_settings, visible_element))
424424
return new_mesh
425425

src/blenderbim/scripts/standalone_blender_import.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def execute(self):
1616
self.created_guids = set()
1717

1818
self.settings = ifcopenshell.geom.settings()
19-
self.settings.set_deflection_tolerance(self.deflection_tolerance)
20-
self.settings.set_angular_tolerance(self.angular_tolerance)
19+
self.settings.set("mesher-linear-deflection", self.deflection_tolerance)
20+
self.settings.set("mesher-angular-deflection", self.angular_tolerance)
2121
self.settings_2d = ifcopenshell.geom.settings()
2222
self.settings_2d.set(self.settings_2d.INCLUDE_CURVES, True)
2323

@@ -47,7 +47,7 @@ def process_context_filter(self):
4747
]
4848
)
4949
if self.body_contexts:
50-
self.settings.set_context_ids(self.body_contexts)
50+
self.settings.set("context-ids", self.body_contexts)
5151
# Annotation is to accommodate broken Revit files
5252
# See https://github.com/Autodesk/revit-ifc/issues/187
5353
self.plan_contexts = [

src/ifc5d/ifc5d/qto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def calculate(
148148
formula_functions = {}
149149

150150
gross_settings = ifcopenshell.geom.settings()
151-
gross_settings.set(gross_settings.DISABLE_OPENING_SUBTRACTIONS, True)
151+
gross_settings.set("disable-opening-subtractions", True)
152152
net_settings = ifcopenshell.geom.settings()
153153

154154
gross_qtos = {}

0 commit comments

Comments
 (0)