See #3817. WARNING: fundamental change. Standardise prioritisation of all context permutations when loading occurrences and types.

This commit is contained in:
Dion Moult
2023-10-09 23:21:09 +11:00
parent 83a43725f9
commit 7170d9f06f
2 changed files with 116 additions and 91 deletions
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
def get_context(ifc_file, context, subcontext=None, target_view=None):
if subcontext or target_view:
@@ -33,6 +35,9 @@ def get_context(ifc_file, context, subcontext=None, target_view=None):
def is_representation_of_context(representation, context, subcontext=None, target_view=None):
if isinstance(context, ifcopenshell.entity_instance):
return representation.ContextOfItems == context
if target_view is not None:
return (
representation.ContextOfItems.is_a("IfcGeometricRepresentationSubContext")