mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +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 bpy
|
||||||
import time
|
import time
|
||||||
import bmesh
|
import bmesh
|
||||||
import shutil
|
|
||||||
import logging
|
import logging
|
||||||
import threading
|
|
||||||
import mathutils
|
import mathutils
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
@@ -31,7 +29,6 @@ import ifcopenshell
|
|||||||
import ifcopenshell.geom
|
import ifcopenshell.geom
|
||||||
import ifcopenshell.util.unit
|
import ifcopenshell.util.unit
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
import ifcopenshell.util.selector
|
|
||||||
import ifcopenshell.util.geolocation
|
import ifcopenshell.util.geolocation
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from itertools import chain, accumulate
|
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
|
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:
|
class MaterialCreator:
|
||||||
def __init__(self, ifc_import_settings, ifc_importer):
|
def __init__(self, ifc_import_settings, ifc_importer):
|
||||||
self.mesh = None
|
self.mesh = None
|
||||||
|
|||||||
@@ -355,8 +355,8 @@ class AppendEntireLibrary(bpy.types.Operator):
|
|||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
self.library = IfcStore.library_file
|
self.library = IfcStore.library_file
|
||||||
|
|
||||||
lib_elements = ifcopenshell.util.selector.Selector().parse(
|
lib_elements = ifcopenshell.util.selector.filter_elements(
|
||||||
self.library, ".IfcTypeProduct | .IfcMaterial | .IfcCostSchedule| .IfcProfileDef"
|
self.library, "IfcTypeProduct, IfcMaterial, IfcCostSchedule, IfcProfileDef"
|
||||||
)
|
)
|
||||||
for element in lib_elements:
|
for element in lib_elements:
|
||||||
bpy.ops.bim.append_library_element(definition=element.id())
|
bpy.ops.bim.append_library_element(definition=element.id())
|
||||||
@@ -768,12 +768,12 @@ class LoadProjectElements(bpy.types.Operator):
|
|||||||
return elements
|
return elements
|
||||||
|
|
||||||
def get_whitelist_elements(self):
|
def get_whitelist_elements(self):
|
||||||
selector = ifcopenshell.util.selector.Selector()
|
return set(ifcopenshell.util.selector.filter_elements(self.file, self.props.filter_query))
|
||||||
return set(selector.parse(self.file, self.props.filter_query))
|
|
||||||
|
|
||||||
def get_blacklist_elements(self):
|
def get_blacklist_elements(self):
|
||||||
selector = ifcopenshell.util.selector.Selector()
|
return set(self.file.by_type("IfcElement")) - set(
|
||||||
return set(self.file.by_type("IfcElement")) - set(selector.parse(self.file, self.props.filter_query))
|
ifcopenshell.util.selector.filter_elements(self.file, self.props.filter_query)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ToggleFilterCategories(bpy.types.Operator):
|
class ToggleFilterCategories(bpy.types.Operator):
|
||||||
@@ -895,6 +895,7 @@ class ReloadLink(bpy.types.Operator):
|
|||||||
for c in bpy.data.collections
|
for c in bpy.data.collections
|
||||||
if "IfcProject" in c.name and c.library and os.path.basename(c.library.filepath) == selected_filename
|
if "IfcProject" in c.name and c.library and os.path.basename(c.library.filepath) == selected_filename
|
||||||
]
|
]
|
||||||
|
|
||||||
for library in get_linked_ifcs() or []:
|
for library in get_linked_ifcs() or []:
|
||||||
library.reload()
|
library.reload()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -920,7 +921,9 @@ class ToggleLinkSelectability(bpy.types.Operator):
|
|||||||
|
|
||||||
def get_linked_collections(self):
|
def get_linked_collections(self):
|
||||||
return [
|
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):
|
def get_linked_collections(self):
|
||||||
return [
|
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