mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Merge remote-tracking branch 'origin/v0.8.0' into ifcviewer-wgpu
This commit is contained in:
@@ -145,7 +145,8 @@ class configuration:
|
||||
config.set(
|
||||
"snippets",
|
||||
"print all wall ids",
|
||||
self.config_encode("""
|
||||
self.config_encode(
|
||||
"""
|
||||
###########################################################################
|
||||
# A simple script that iterates over all walls in the current model #
|
||||
# and prints their Globally unique IDs (GUIDS) to the console window #
|
||||
@@ -153,13 +154,15 @@ class configuration:
|
||||
|
||||
for wall in model.by_type("IfcWall"):
|
||||
print ("wall with global id: "+str(wall.GlobalId))
|
||||
""".lstrip()),
|
||||
""".lstrip()
|
||||
),
|
||||
)
|
||||
|
||||
config.set(
|
||||
"snippets",
|
||||
"print properties of current selection",
|
||||
self.config_encode("""
|
||||
self.config_encode(
|
||||
"""
|
||||
###########################################################################
|
||||
# A simple script that iterates over all IfcPropertySets of the currently #
|
||||
# selected object and prints them to the console #
|
||||
@@ -177,7 +180,8 @@ if selection:
|
||||
for prop in relDefinesByProperties.RelatingPropertyDefinition.HasProperties:
|
||||
print ("{:<20} :{}".format(prop.Name,prop.NominalValue.wrappedValue))
|
||||
print ("\\n")
|
||||
""".lstrip()),
|
||||
""".lstrip()
|
||||
),
|
||||
)
|
||||
with open(conf_file, "w") as configfile:
|
||||
config.write(configfile)
|
||||
|
||||
@@ -300,13 +300,16 @@ class iterator(ifcopenshell_wrapper.Iterator):
|
||||
include: Optional[Union[list[entity_instance], list[str]]] = None,
|
||||
exclude: Optional[Union[list[entity_instance], list[str]]] = None,
|
||||
geometry_library: GEOMETRY_LIBRARY = "opencascade",
|
||||
logger=None,
|
||||
):
|
||||
self.settings = settings
|
||||
if logger is None and (logger_type := getattr(ifcopenshell_wrapper, "logger", None)):
|
||||
logger = logger_type.Root()
|
||||
if isinstance(file_or_filename, file):
|
||||
self.file = file
|
||||
file_or_filename = file_or_filename
|
||||
else:
|
||||
file_or_filename = self.file = open(file_or_filename)
|
||||
file_or_filename = self.file = open(file_or_filename, logger=logger)
|
||||
|
||||
if include is not None and exclude is not None:
|
||||
raise ValueError("include and exclude cannot be specified simultaneously")
|
||||
@@ -334,13 +337,18 @@ class iterator(ifcopenshell_wrapper.Iterator):
|
||||
else:
|
||||
initializer = ifcopenshell_wrapper.construct_iterator_with_include_exclude
|
||||
|
||||
self.this = initializer(
|
||||
geometry_library, self.settings, file_or_filename, include_or_exclude, include is not None, num_threads
|
||||
args = (
|
||||
geometry_library,
|
||||
self.settings,
|
||||
file_or_filename,
|
||||
include_or_exclude,
|
||||
include is not None,
|
||||
num_threads,
|
||||
)
|
||||
self.this = initializer(*args, *((logger,) if logger is not None else ()))
|
||||
else:
|
||||
self.this = ifcopenshell_wrapper.construct_iterator(
|
||||
geometry_library, self.settings, file_or_filename, num_threads
|
||||
)
|
||||
args = (geometry_library, self.settings, file_or_filename, num_threads)
|
||||
self.this = ifcopenshell_wrapper.construct_iterator(*args, *((logger,) if logger is not None else ()))
|
||||
|
||||
if has_occ:
|
||||
|
||||
@@ -454,6 +462,7 @@ def create_shape(
|
||||
inst: entity_instance,
|
||||
repr: Optional[entity_instance] = None,
|
||||
geometry_library: GEOMETRY_LIBRARY = "opencascade",
|
||||
logger: Optional[ifcopenshell.logger] = None,
|
||||
) -> Union[ShapeType, ShapeElementType, ifcopenshell_wrapper.Transformation, utils.shape_tuple, TopoDS.TopoDS_Shape]:
|
||||
"""
|
||||
Returns a geometric interpretation of the IFC entity instance
|
||||
@@ -500,9 +509,9 @@ def create_shape(
|
||||
return wrap_shape_creation(
|
||||
settings,
|
||||
(
|
||||
ifcopenshell_wrapper.create_shape(settings, inst, repr, geometry_library)
|
||||
ifcopenshell_wrapper.create_shape(settings, inst, repr, geometry_library, *((logger,) if logger is not None else ()),)
|
||||
if repr
|
||||
else ifcopenshell_wrapper.create_shape(settings, inst, geometry_library)
|
||||
else ifcopenshell_wrapper.create_shape(settings, inst, geometry_library, *((logger,) if logger is not None else ()),)
|
||||
),
|
||||
)
|
||||
|
||||
@@ -556,6 +565,7 @@ def iterate(
|
||||
*,
|
||||
with_progress: Literal[False] = False,
|
||||
geometry_library: GEOMETRY_LIBRARY = "opencascade",
|
||||
logger=None,
|
||||
) -> Generator[IteratorOutput, None, None]: ...
|
||||
@overload
|
||||
def iterate(
|
||||
@@ -567,6 +577,7 @@ def iterate(
|
||||
*,
|
||||
with_progress: Literal[True] = True,
|
||||
geometry_library: GEOMETRY_LIBRARY = "opencascade",
|
||||
logger=None,
|
||||
) -> Generator[tuple[int, IteratorOutput], None, None]: ...
|
||||
@overload
|
||||
def iterate(
|
||||
@@ -578,6 +589,7 @@ def iterate(
|
||||
*,
|
||||
with_progress: bool = False,
|
||||
geometry_library: GEOMETRY_LIBRARY = "opencascade",
|
||||
logger=None,
|
||||
) -> Generator[Union[IteratorOutput, tuple[int, IteratorOutput]], None, None]: ...
|
||||
def iterate(
|
||||
settings: settings,
|
||||
@@ -588,6 +600,7 @@ def iterate(
|
||||
*,
|
||||
with_progress: bool = False,
|
||||
geometry_library: GEOMETRY_LIBRARY = "opencascade",
|
||||
logger=None,
|
||||
) -> Generator[Union[IteratorOutput, tuple[int, IteratorOutput]], None, None]:
|
||||
"""Get a geometry iterator for the provided file."""
|
||||
it = iterator(settings, file_or_filename, num_threads, include, exclude, geometry_library)
|
||||
|
||||
Reference in New Issue
Block a user