mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Fix #2092. Fix bug where door and window styles were excluded from authoring options.
This commit is contained in:
@@ -285,11 +285,13 @@ class IfcImporter:
|
|||||||
if c.ContextIdentifier in ["Body", "Facetation"]
|
if c.ContextIdentifier in ["Body", "Facetation"]
|
||||||
]
|
]
|
||||||
# Ideally, all representations should be in a subcontext, but some BIM programs don't do this correctly
|
# Ideally, all representations should be in a subcontext, but some BIM programs don't do this correctly
|
||||||
self.body_contexts.extend([
|
self.body_contexts.extend(
|
||||||
c.id()
|
[
|
||||||
for c in self.file.by_type("IfcGeometricRepresentationContext", include_subtypes=False)
|
c.id()
|
||||||
if c.ContextType == "Model"
|
for c in self.file.by_type("IfcGeometricRepresentationContext", include_subtypes=False)
|
||||||
])
|
if c.ContextType == "Model"
|
||||||
|
]
|
||||||
|
)
|
||||||
if self.body_contexts:
|
if self.body_contexts:
|
||||||
self.settings.set_context_ids(self.body_contexts)
|
self.settings.set_context_ids(self.body_contexts)
|
||||||
# Annotation is to accommodate broken Revit files
|
# Annotation is to accommodate broken Revit files
|
||||||
@@ -365,7 +367,7 @@ class IfcImporter:
|
|||||||
|
|
||||||
def is_native_swept_disk_solid(self, representations):
|
def is_native_swept_disk_solid(self, representations):
|
||||||
for representation in representations:
|
for representation in representations:
|
||||||
items = representation["raw"].Items or [] # Be forgiving of invalid IFCs because Revit :(
|
items = representation["raw"].Items or [] # Be forgiving of invalid IFCs because Revit :(
|
||||||
if len(items) == 1 and items[0].is_a("IfcSweptDiskSolid"):
|
if len(items) == 1 and items[0].is_a("IfcSweptDiskSolid"):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@@ -1724,10 +1726,10 @@ class IfcImporter:
|
|||||||
):
|
):
|
||||||
verts = [None] * len(geometry.verts)
|
verts = [None] * len(geometry.verts)
|
||||||
for i in range(0, len(geometry.verts), 3):
|
for i in range(0, len(geometry.verts), 3):
|
||||||
verts[i], verts[i+1], verts[i+2] = ifcopenshell.util.geolocation.enh2xyz(
|
verts[i], verts[i + 1], verts[i + 2] = ifcopenshell.util.geolocation.enh2xyz(
|
||||||
geometry.verts[i],
|
geometry.verts[i],
|
||||||
geometry.verts[i+1],
|
geometry.verts[i + 1],
|
||||||
geometry.verts[i+2],
|
geometry.verts[i + 2],
|
||||||
float(props.blender_eastings) * self.unit_scale,
|
float(props.blender_eastings) * self.unit_scale,
|
||||||
float(props.blender_northings) * self.unit_scale,
|
float(props.blender_northings) * self.unit_scale,
|
||||||
float(props.blender_orthogonal_height) * self.unit_scale,
|
float(props.blender_orthogonal_height) * self.unit_scale,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from blenderbim.bim.prop import StrProperty
|
from blenderbim.bim.prop import StrProperty
|
||||||
from blenderbim.bim.module.root.prop import getIfcClasses
|
from blenderbim.bim.module.root.prop import get_ifc_classes
|
||||||
from bpy.types import PropertyGroup
|
from bpy.types import PropertyGroup
|
||||||
from bpy.props import (
|
from bpy.props import (
|
||||||
PointerProperty,
|
PointerProperty,
|
||||||
@@ -33,14 +33,11 @@ from bpy.props import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
scenarios_enum = []
|
scenarios_enum = []
|
||||||
classes_enum = []
|
|
||||||
|
|
||||||
|
|
||||||
def purge():
|
def purge():
|
||||||
global scenarios_enum
|
global scenarios_enum
|
||||||
global classes_enum
|
|
||||||
scenarios_enum = []
|
scenarios_enum = []
|
||||||
classes_enum = []
|
|
||||||
|
|
||||||
|
|
||||||
def getScenarios(self, context):
|
def getScenarios(self, context):
|
||||||
@@ -68,7 +65,7 @@ class BimTesterProperties(PropertyGroup):
|
|||||||
feature: StringProperty(default="", name="Feature / IDS", update=refreshScenarios)
|
feature: StringProperty(default="", name="Feature / IDS", update=refreshScenarios)
|
||||||
steps: StringProperty(default="", name="Custom Steps")
|
steps: StringProperty(default="", name="Custom Steps")
|
||||||
ifc_file: StringProperty(default="", name="IFC File")
|
ifc_file: StringProperty(default="", name="IFC File")
|
||||||
audit_ifc_class: EnumProperty(items=getIfcClasses, name="Audit Class")
|
audit_ifc_class: EnumProperty(items=get_ifc_classes, name="Audit Class")
|
||||||
qa_reject_element_reason: StringProperty(name="Element Rejection Reason")
|
qa_reject_element_reason: StringProperty(name="Element Rejection Reason")
|
||||||
scenario: EnumProperty(items=getScenarios, name="Scenario")
|
scenario: EnumProperty(items=getScenarios, name="Scenario")
|
||||||
should_load_from_memory: BoolProperty(default=False, name="Load from Memory")
|
should_load_from_memory: BoolProperty(default=False, name="Load from Memory")
|
||||||
|
|||||||
@@ -69,9 +69,7 @@ class BIM_PT_documents(Panel):
|
|||||||
row.operator("bim.enable_editing_document", text="", icon="GREASEPENCIL").document = ifc_definition_id
|
row.operator("bim.enable_editing_document", text="", icon="GREASEPENCIL").document = ifc_definition_id
|
||||||
row.operator("bim.remove_document", text="", icon="X").document = ifc_definition_id
|
row.operator("bim.remove_document", text="", icon="X").document = ifc_definition_id
|
||||||
|
|
||||||
self.layout.template_list(
|
self.layout.template_list("BIM_UL_documents", "", self.props, "documents", self.props, "active_document_index")
|
||||||
"BIM_UL_documents", "", self.props, "documents", self.props, "active_document_index"
|
|
||||||
)
|
|
||||||
|
|
||||||
if self.props.active_document_id:
|
if self.props.active_document_id:
|
||||||
draw_attributes(self.props.document_attributes, self.layout)
|
draw_attributes(self.props.document_attributes, self.layout)
|
||||||
@@ -136,9 +134,7 @@ class BIM_PT_object_documents(Panel):
|
|||||||
row.operator("bim.assign_document", text="", icon="ADD").document = document.ifc_definition_id
|
row.operator("bim.assign_document", text="", icon="ADD").document = document.ifc_definition_id
|
||||||
row.operator("bim.disable_document_editing_ui", text="", icon="CANCEL")
|
row.operator("bim.disable_document_editing_ui", text="", icon="CANCEL")
|
||||||
|
|
||||||
self.layout.template_list(
|
self.layout.template_list("BIM_UL_documents", "", self.props, "documents", self.props, "active_document_index")
|
||||||
"BIM_UL_documents", "", self.props, "documents", self.props, "active_document_index"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class BIM_UL_documents(UIList):
|
class BIM_UL_documents(UIList):
|
||||||
|
|||||||
@@ -39,7 +39,12 @@ class AuthoringData:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def ifc_classes(cls):
|
def ifc_classes(cls):
|
||||||
results = []
|
results = []
|
||||||
classes = {e.is_a() for e in tool.Ifc.get().by_type("IfcElementType")}
|
classes = {
|
||||||
|
e.is_a()
|
||||||
|
for e in tool.Ifc.get().by_type("IfcElementType")
|
||||||
|
+ tool.Ifc.get().by_type("IfcDoorStyle")
|
||||||
|
+ tool.Ifc.get().by_type("IfcWindowStyle")
|
||||||
|
}
|
||||||
results.extend([(c, c, "") for c in sorted(classes)])
|
results.extend([(c, c, "") for c in sorted(classes)])
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ from math import pi, degrees
|
|||||||
from mathutils import Vector, Matrix
|
from mathutils import Vector, Matrix
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MepGenerator:
|
class MepGenerator:
|
||||||
def __init__(self, relating_type):
|
def __init__(self, relating_type):
|
||||||
self.relating_type = relating_type
|
self.relating_type = relating_type
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ class IfcClassData:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
cls.data = {
|
cls.data = {}
|
||||||
"ifc_products": cls.ifc_products(),
|
cls.data["ifc_products"] = cls.ifc_products()
|
||||||
"contexts": cls.contexts(),
|
cls.data["ifc_classes"] = cls.ifc_classes()
|
||||||
"has_entity": cls.has_entity(),
|
cls.data["contexts"] = cls.contexts()
|
||||||
"name": cls.name(),
|
cls.data["has_entity"] = cls.has_entity()
|
||||||
"ifc_class": cls.ifc_class(),
|
cls.data["name"] = cls.name()
|
||||||
}
|
cls.data["ifc_class"] = cls.ifc_class()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ifc_products(cls):
|
def ifc_products(cls):
|
||||||
@@ -64,6 +64,15 @@ class IfcClassData:
|
|||||||
]
|
]
|
||||||
return [(e, e, "") for e in products]
|
return [(e, e, "") for e in products]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def ifc_classes(cls):
|
||||||
|
ifc_product = bpy.context.scene.BIMRootProperties.ifc_product
|
||||||
|
declaration = tool.Ifc.schema().declaration_by_name(ifc_product)
|
||||||
|
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
|
||||||
|
names = [d.name() for d in declarations]
|
||||||
|
if ifc_product == "IfcElementType":
|
||||||
|
names.extend(("IfcDoorStyle", "IfcWindowStyle"))
|
||||||
|
return [(c, c, "") for c in sorted(names)]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def contexts(cls):
|
def contexts(cls):
|
||||||
|
|||||||
@@ -33,14 +33,11 @@ from bpy.props import (
|
|||||||
CollectionProperty,
|
CollectionProperty,
|
||||||
)
|
)
|
||||||
|
|
||||||
classes_enum = []
|
|
||||||
types_enum = []
|
types_enum = []
|
||||||
|
|
||||||
|
|
||||||
def purge():
|
def purge():
|
||||||
global classes_enum
|
|
||||||
global types_enum
|
global types_enum
|
||||||
classes_enum = []
|
|
||||||
types_enum = []
|
types_enum = []
|
||||||
|
|
||||||
|
|
||||||
@@ -58,10 +55,9 @@ def getIfcPredefinedTypes(self, context):
|
|||||||
return types_enum
|
return types_enum
|
||||||
|
|
||||||
|
|
||||||
def refreshClasses(self, context):
|
def refresh_classes(self, context):
|
||||||
global classes_enum
|
IfcClassData.load()
|
||||||
classes_enum.clear()
|
enum = get_ifc_classes(self, context)
|
||||||
enum = getIfcClasses(self, context)
|
|
||||||
context.scene.BIMRootProperties.ifc_class = enum[0][0]
|
context.scene.BIMRootProperties.ifc_class = enum[0][0]
|
||||||
|
|
||||||
|
|
||||||
@@ -79,14 +75,10 @@ def get_ifc_products(self, context):
|
|||||||
return IfcClassData.data["ifc_products"]
|
return IfcClassData.data["ifc_products"]
|
||||||
|
|
||||||
|
|
||||||
def getIfcClasses(self, context):
|
def get_ifc_classes(self, context):
|
||||||
global classes_enum
|
if not IfcClassData.is_loaded:
|
||||||
file = IfcStore.get_file()
|
IfcClassData.load()
|
||||||
if len(classes_enum) < 1 and file:
|
return IfcClassData.data["ifc_classes"]
|
||||||
declaration = IfcStore.get_schema().declaration_by_name(context.scene.BIMRootProperties.ifc_product)
|
|
||||||
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
|
|
||||||
classes_enum.extend([(c, c, "") for c in sorted([d.name() for d in declarations])])
|
|
||||||
return classes_enum
|
|
||||||
|
|
||||||
|
|
||||||
def get_contexts(self, context):
|
def get_contexts(self, context):
|
||||||
@@ -97,7 +89,7 @@ def get_contexts(self, context):
|
|||||||
|
|
||||||
class BIMRootProperties(PropertyGroup):
|
class BIMRootProperties(PropertyGroup):
|
||||||
contexts: EnumProperty(items=get_contexts, name="Contexts")
|
contexts: EnumProperty(items=get_contexts, name="Contexts")
|
||||||
ifc_product: EnumProperty(items=get_ifc_products, name="Products", update=refreshClasses)
|
ifc_product: EnumProperty(items=get_ifc_products, name="Products", update=refresh_classes)
|
||||||
ifc_class: EnumProperty(items=getIfcClasses, name="Class", update=refreshPredefinedTypes)
|
ifc_class: EnumProperty(items=get_ifc_classes, name="Class", update=refreshPredefinedTypes)
|
||||||
ifc_predefined_type: EnumProperty(items=getIfcPredefinedTypes, name="Predefined Type", default=None)
|
ifc_predefined_type: EnumProperty(items=getIfcPredefinedTypes, name="Predefined Type", default=None)
|
||||||
ifc_userdefined_type: StringProperty(name="Userdefined Type")
|
ifc_userdefined_type: StringProperty(name="Userdefined Type")
|
||||||
|
|||||||
@@ -90,7 +90,8 @@
|
|||||||
"IfcDistributionChamberElementType"
|
"IfcDistributionChamberElementType"
|
||||||
],
|
],
|
||||||
"IfcDoor": [
|
"IfcDoor": [
|
||||||
"IfcDoorType"
|
"IfcDoorType",
|
||||||
|
"IfcDoorStyle"
|
||||||
],
|
],
|
||||||
"IfcDuctFitting": [
|
"IfcDuctFitting": [
|
||||||
"IfcDuctFittingType"
|
"IfcDuctFittingType"
|
||||||
@@ -306,7 +307,8 @@
|
|||||||
"IfcWasteTerminalType"
|
"IfcWasteTerminalType"
|
||||||
],
|
],
|
||||||
"IfcWindow": [
|
"IfcWindow": [
|
||||||
"IfcWindowType"
|
"IfcWindowType",
|
||||||
|
"IfcWindowStyle"
|
||||||
],
|
],
|
||||||
"IfcBeamStandardCase": [
|
"IfcBeamStandardCase": [
|
||||||
"IfcBeamType"
|
"IfcBeamType"
|
||||||
|
|||||||
Reference in New Issue
Block a user