mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
ifcopenshell.util - make ifc_file argument optional if it can be deduced from ifc element
This commit is contained in:
@@ -66,7 +66,7 @@ class Clipping:
|
||||
raise Exception(f"Unexpected clipping type provided: {raw_data}")
|
||||
|
||||
def apply(
|
||||
self, ifc_file: ifcopenshell.file, first_operand: ifcopenshell.entity_instance, unit_scale: float
|
||||
self, ifc_file: Union[ifcopenshell.file, None], first_operand: ifcopenshell.entity_instance, unit_scale: float
|
||||
) -> ifcopenshell.entity_instance:
|
||||
"""Applies the clipping data as an IfcBooleanClippingResult to an operand
|
||||
|
||||
@@ -76,6 +76,9 @@ class Clipping:
|
||||
:return: An IfcBooleanClippingResult which uses an IfcHalfSpaceSolid to clip the first operand
|
||||
"""
|
||||
|
||||
if not ifc_file:
|
||||
ifc_file = first_operand.file
|
||||
|
||||
location = ifc_file.createIfcCartesianPoint([i / unit_scale for i in self.location])
|
||||
direction = ifc_file.createIfcDirection(self.normal)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user