mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
Fix #2858. Fix #2856. BlenderBIM Add-on drawings and IfcCSV now support the new quoted and escaped selector capabilities.
This commit is contained in:
@@ -612,7 +612,7 @@ class CreateDrawing(bpy.types.Operator):
|
||||
classes.append("material-{}".format(re.sub("[^0-9a-zA-Z]+", "", self.get_material_name(material))))
|
||||
classes.append("globalid-{}".format(element.GlobalId))
|
||||
for attribute in svg_writer.annotations["attributes"]:
|
||||
result = self.selector.get_element_value(element, attribute)
|
||||
result = ifcopenshell.util.selector.get_element_value(element, attribute)
|
||||
if result:
|
||||
classes.append(
|
||||
"{}-{}".format(re.sub("[^0-9a-zA-Z]+", "", attribute), re.sub("[^0-9a-zA-Z]+", "", result))
|
||||
@@ -960,7 +960,6 @@ class ActivateDrawingStyle(bpy.types.Operator):
|
||||
exec(f"{path} = {value}")
|
||||
|
||||
def set_query(self, context):
|
||||
self.selector = ifcopenshell.util.selector.Selector()
|
||||
self.include_global_ids = []
|
||||
self.exclude_global_ids = []
|
||||
for ifc_file in context.scene.DocProperties.ifc_files:
|
||||
@@ -969,10 +968,10 @@ class ActivateDrawingStyle(bpy.types.Operator):
|
||||
except:
|
||||
continue
|
||||
if self.drawing_style.include_query:
|
||||
results = self.selector.parse(ifc, self.drawing_style.include_query)
|
||||
results = ifcopenshell.util.selector.Selector.parse(ifc, self.drawing_style.include_query)
|
||||
self.include_global_ids.extend([e.GlobalId for e in results])
|
||||
if self.drawing_style.exclude_query:
|
||||
results = self.selector.parse(ifc, self.drawing_style.exclude_query)
|
||||
results = ifcopenshell.util.selector.Selector.parse(ifc, self.drawing_style.exclude_query)
|
||||
self.exclude_global_ids.extend([e.GlobalId for e in results])
|
||||
if self.drawing_style.include_query:
|
||||
self.parse_filter_query("INCLUDE", context)
|
||||
|
||||
@@ -337,7 +337,7 @@ class SvgWriter:
|
||||
if custom_classes:
|
||||
classes.extend(custom_classes.split())
|
||||
for key in self.metadata:
|
||||
value = ifcopenshell.util.selector.Selector.get_element_value(element, key)
|
||||
value = ifcopenshell.util.selector.get_element_value(element, key)
|
||||
if value:
|
||||
classes.append(self.canonicalise_class_name(key) + "-" + self.canonicalise_class_name(str(value)))
|
||||
return classes
|
||||
@@ -671,11 +671,10 @@ class SvgWriter:
|
||||
literal = text_literal.Literal
|
||||
|
||||
product = tool.Drawing.get_assigned_product(element)
|
||||
selector = ifcopenshell.util.selector.Selector
|
||||
variables = {}
|
||||
if product != None:
|
||||
for variable in re.findall("{{.*?}}", literal):
|
||||
literal = literal.replace(variable, str(selector.get_element_value(product, variable[2:-2]) or ""))
|
||||
literal = literal.replace(variable, str(ifcopenshell.util.selector.get_element_value(product, variable[2:-2]) or ""))
|
||||
|
||||
for line_number, text_line in enumerate(literal.replace("\\n", "\n").split("\n")):
|
||||
self.svg.add(
|
||||
|
||||
@@ -526,10 +526,9 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
value = element.Literal
|
||||
product = cls.get_assigned_product(tool.Ifc.get_entity(obj))
|
||||
if product:
|
||||
selector = ifcopenshell.util.selector.Selector()
|
||||
variables = {}
|
||||
for variable in re.findall("{{.*?}}", value):
|
||||
value = value.replace(variable, str(selector.get_element_value(product, variable[2:-2]) or ""))
|
||||
value = value.replace(variable, str(ifcopenshell.util.selector.get_element_value(product, variable[2:-2]) or ""))
|
||||
obj.BIMTextProperties.value = value
|
||||
|
||||
# TODO below this point is highly experimental prototype code with no tests
|
||||
|
||||
Reference in New Issue
Block a user