mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Project advanced mode filtering now uses new filter syntax
This commit is contained in:
@@ -21,9 +21,7 @@ import re
|
||||
import bpy
|
||||
import time
|
||||
import bmesh
|
||||
import shutil
|
||||
import logging
|
||||
import threading
|
||||
import mathutils
|
||||
import numpy as np
|
||||
import multiprocessing
|
||||
@@ -31,7 +29,6 @@ import ifcopenshell
|
||||
import ifcopenshell.geom
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.selector
|
||||
import ifcopenshell.util.geolocation
|
||||
import blenderbim.tool as tool
|
||||
from itertools import chain, accumulate
|
||||
@@ -39,16 +36,6 @@ from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.drawing.prop import ANNOTATION_TYPES_DATA
|
||||
|
||||
|
||||
class FileCopy(threading.Thread):
|
||||
def __init__(self, file_path, destination):
|
||||
threading.Thread.__init__(self)
|
||||
self.file_path = file_path
|
||||
self.destination = destination
|
||||
|
||||
def run(self):
|
||||
shutil.copy(self.file_path, self.destination)
|
||||
|
||||
|
||||
class MaterialCreator:
|
||||
def __init__(self, ifc_import_settings, ifc_importer):
|
||||
self.mesh = None
|
||||
|
||||
@@ -355,8 +355,8 @@ class AppendEntireLibrary(bpy.types.Operator):
|
||||
self.file = IfcStore.get_file()
|
||||
self.library = IfcStore.library_file
|
||||
|
||||
lib_elements = ifcopenshell.util.selector.Selector().parse(
|
||||
self.library, ".IfcTypeProduct | .IfcMaterial | .IfcCostSchedule| .IfcProfileDef"
|
||||
lib_elements = ifcopenshell.util.selector.filter_elements(
|
||||
self.library, "IfcTypeProduct, IfcMaterial, IfcCostSchedule, IfcProfileDef"
|
||||
)
|
||||
for element in lib_elements:
|
||||
bpy.ops.bim.append_library_element(definition=element.id())
|
||||
@@ -768,12 +768,12 @@ class LoadProjectElements(bpy.types.Operator):
|
||||
return elements
|
||||
|
||||
def get_whitelist_elements(self):
|
||||
selector = ifcopenshell.util.selector.Selector()
|
||||
return set(selector.parse(self.file, self.props.filter_query))
|
||||
return set(ifcopenshell.util.selector.filter_elements(self.file, self.props.filter_query))
|
||||
|
||||
def get_blacklist_elements(self):
|
||||
selector = ifcopenshell.util.selector.Selector()
|
||||
return set(self.file.by_type("IfcElement")) - set(selector.parse(self.file, self.props.filter_query))
|
||||
return set(self.file.by_type("IfcElement")) - set(
|
||||
ifcopenshell.util.selector.filter_elements(self.file, self.props.filter_query)
|
||||
)
|
||||
|
||||
|
||||
class ToggleFilterCategories(bpy.types.Operator):
|
||||
@@ -895,6 +895,7 @@ class ReloadLink(bpy.types.Operator):
|
||||
for c in bpy.data.collections
|
||||
if "IfcProject" in c.name and c.library and os.path.basename(c.library.filepath) == selected_filename
|
||||
]
|
||||
|
||||
for library in get_linked_ifcs() or []:
|
||||
library.reload()
|
||||
return {"FINISHED"}
|
||||
@@ -920,7 +921,9 @@ class ToggleLinkSelectability(bpy.types.Operator):
|
||||
|
||||
def get_linked_collections(self):
|
||||
return [
|
||||
c for c in bpy.data.collections if "IfcProject" in c.name and c.library and c.library.filepath == self.filepath
|
||||
c
|
||||
for c in bpy.data.collections
|
||||
if "IfcProject" in c.name and c.library and c.library.filepath == self.filepath
|
||||
]
|
||||
|
||||
|
||||
@@ -974,7 +977,9 @@ class ToggleLinkVisibility(bpy.types.Operator):
|
||||
|
||||
def get_linked_collections(self):
|
||||
return [
|
||||
c for c in bpy.data.collections if "IfcProject" in c.name and c.library and c.library.filepath == self.filepath
|
||||
c
|
||||
for c in bpy.data.collections
|
||||
if "IfcProject" in c.name and c.library and c.library.filepath == self.filepath
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user