mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Fix Brick tool
- Data is now stored regularly and parsed in props - "get_convertable_brick_spaces" returns a set - "export_brick_attributes" always returns a tuple of strings
This commit is contained in:
@@ -45,12 +45,12 @@ def get_libraries(self, context):
|
|||||||
|
|
||||||
|
|
||||||
def get_namespaces(self, context):
|
def get_namespaces(self, context):
|
||||||
return BrickStore.namespaces
|
return [(uri, f"{alias}: {uri}", "") for alias, uri in BrickStore.namespaces]
|
||||||
|
|
||||||
|
|
||||||
def get_brick_entity_classes(self, context):
|
def get_brick_entity_classes(self, context):
|
||||||
entity = self.brick_entity_create_type
|
entity = self.brick_entity_create_type
|
||||||
return BrickStore.entity_classes[entity]
|
return [(uri, uri.split("#")[-1], "") for uri in BrickStore.entity_classes[entity]]
|
||||||
|
|
||||||
|
|
||||||
def get_brick_roots(self, context):
|
def get_brick_roots(self, context):
|
||||||
@@ -58,12 +58,12 @@ def get_brick_roots(self, context):
|
|||||||
|
|
||||||
|
|
||||||
def get_brick_relations(self, context):
|
def get_brick_relations(self, context):
|
||||||
|
relations = [(uri, uri.split("#")[-1], "") for uri in BrickStore.relationships]
|
||||||
for relation in BrickschemaData.data["active_relations"]:
|
for relation in BrickschemaData.data["active_relations"]:
|
||||||
if relation["predicate_name"] == "label":
|
if relation["predicate_name"] == "label":
|
||||||
return BrickStore.relationships
|
return relations
|
||||||
new_relations = BrickStore.relationships.copy()
|
relations.append(("http://www.w3.org/2000/01/rdf-schema#label", "label", ""))
|
||||||
new_relations.append(("http://www.w3.org/2000/01/rdf-schema#label", "label", ""))
|
return relations
|
||||||
return new_relations
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
if predicate == "http://www.w3.org/2000/01/rdf-schema#label":
|
if predicate == "http://www.w3.org/2000/01/rdf-schema#label":
|
||||||
with BrickStore.new_changeset() as cs:
|
with BrickStore.new_changeset() as cs:
|
||||||
cs.add((URIRef(brick_uri), URIRef(predicate), Literal(object)))
|
cs.add((URIRef(brick_uri), URIRef(predicate), Literal(object)))
|
||||||
bpy.context.scene.BIMBrickProperties.new_brick_relation_type = BrickStore.relationships[0][0]
|
bpy.context.scene.BIMBrickProperties.new_brick_relation_type = BrickStore.relationships[0]
|
||||||
bpy.context.scene.BIMBrickProperties.add_brick_relation_failed = False
|
bpy.context.scene.BIMBrickProperties.add_brick_relation_failed = False
|
||||||
return
|
return
|
||||||
query = BrickStore.graph.query("ASK { <{object_uri}> a ?o . }".replace("{object_uri}", object))
|
query = BrickStore.graph.query("ASK { <{object_uri}> a ?o . }".replace("{object_uri}", object))
|
||||||
@@ -150,7 +150,7 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
""".replace("{brick_uri}", brick_uri))
|
""".replace("{brick_uri}", brick_uri))
|
||||||
for row in query:
|
for row in query:
|
||||||
name = row.get("label")
|
name = str(row.get("label"))
|
||||||
if not name:
|
if not name:
|
||||||
name = brick_uri.split("#")[-1]
|
name = brick_uri.split("#")[-1]
|
||||||
if tool.Ifc.get_schema() == "IFC2X3":
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
@@ -216,8 +216,8 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_convertable_brick_spaces(cls):
|
def get_convertable_brick_spaces(cls):
|
||||||
if tool.Ifc.get_schema() == "IFC2X3":
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
return tool.Ifc.get().by_type("IfcSpatialStructureElement")
|
return set(tool.Ifc.get().by_type("IfcSpatialStructureElement"))
|
||||||
return tool.Ifc.get().by_type("IfcSpatialElement")
|
return set(tool.Ifc.get().by_type("IfcSpatialElement"))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_convertable_brick_systems(cls):
|
def get_convertable_brick_systems(cls):
|
||||||
@@ -520,7 +520,7 @@ class BrickStore:
|
|||||||
ignore_namespace = True
|
ignore_namespace = True
|
||||||
break
|
break
|
||||||
if not ignore_namespace:
|
if not ignore_namespace:
|
||||||
BrickStore.namespaces.append((uri, f"{alias}: {uri}", ""))
|
BrickStore.namespaces.append((alias, str(uri)))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_entity_classes(cls):
|
def load_entity_classes(cls):
|
||||||
@@ -542,7 +542,7 @@ class BrickStore:
|
|||||||
)
|
)
|
||||||
BrickStore.entity_classes[root_class] = []
|
BrickStore.entity_classes[root_class] = []
|
||||||
for uri in sorted([x[0].toPython() for x in query]):
|
for uri in sorted([x[0].toPython() for x in query]):
|
||||||
BrickStore.entity_classes[root_class].append((uri, uri.split("#")[-1], ""))
|
BrickStore.entity_classes[root_class].append(uri)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_relationships(cls):
|
def load_relationships(cls):
|
||||||
@@ -556,7 +556,7 @@ class BrickStore:
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
for uri in sorted([x[0].toPython() for x in query]):
|
for uri in sorted([x[0].toPython() for x in query]):
|
||||||
BrickStore.relationships.append((uri, uri.split("#")[-1], ""))
|
BrickStore.relationships.append(uri)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_history_size(cls, size):
|
def set_history_size(cls, size):
|
||||||
|
|||||||
Reference in New Issue
Block a user