mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Ensure null values cannot be picked which result in bad IFC data
This commit is contained in:
@@ -33,7 +33,6 @@ documents_enum = []
|
||||
def getIfcPredefinedTypes(self, context):
|
||||
global types_enum
|
||||
if len(types_enum) < 1:
|
||||
types_enum.append((' ', 'None',''))
|
||||
for name, data in ifc_schema.elements.items():
|
||||
if name != self.ifc_class.strip():
|
||||
continue
|
||||
@@ -48,14 +47,11 @@ def refreshPredefinedTypes(self, context):
|
||||
global types_enum
|
||||
types_enum.clear()
|
||||
getIfcPredefinedTypes(self, context)
|
||||
# set to None
|
||||
self.ifc_predefined_type = " "
|
||||
|
||||
|
||||
def getIfcClasses(self, context):
|
||||
global classes_enum
|
||||
if len(classes_enum) < 1:
|
||||
classes_enum.append((' ', 'None', ''))
|
||||
classes_enum.extend([(e, e, '') for e in ifc_schema.elements])
|
||||
return classes_enum
|
||||
|
||||
@@ -64,7 +60,6 @@ def getPsetNames(self, context):
|
||||
global psetnames_enum
|
||||
if len(psetnames_enum) < 1:
|
||||
psetnames_enum.clear()
|
||||
psetnames_enum.append((' ', 'None', ''))
|
||||
files = os.listdir(os.path.join(self.data_dir, 'pset'))
|
||||
psetnames_enum.extend([(f, f, '') for f in files])
|
||||
return psetnames_enum
|
||||
@@ -73,13 +68,10 @@ def refreshPsetFiles(self, context):
|
||||
global psetfiles_enum
|
||||
psetfiles_enum.clear()
|
||||
getPsetFiles(self, context)
|
||||
# set to None
|
||||
self.pset_file = " "
|
||||
|
||||
def getPsetFiles(self, context):
|
||||
global psetfiles_enum
|
||||
if len(psetfiles_enum) < 1:
|
||||
psetfiles_enum.append((' ', 'None', ''))
|
||||
if not self.pset_name.strip():
|
||||
return psetfiles_enum
|
||||
files = os.listdir(os.path.join(self.data_dir, 'pset', self.pset_name.strip()))
|
||||
@@ -90,7 +82,6 @@ def getClassifications(self, context):
|
||||
global classification_enum
|
||||
if len(classification_enum) < 1:
|
||||
classification_enum.clear()
|
||||
classification_enum.append((' ', 'None', ''))
|
||||
with open(os.path.join(self.data_dir, 'class', 'classifications.csv'), 'r') as f:
|
||||
data = list(csv.reader(f))
|
||||
keys = data.pop(0)
|
||||
@@ -102,13 +93,10 @@ def refreshReferences(self, context):
|
||||
global reference_enum
|
||||
reference_enum.clear()
|
||||
getReferences(self, context)
|
||||
# set to None
|
||||
self.reference = " "
|
||||
|
||||
def getReferences(self, context):
|
||||
global reference_enum
|
||||
if len(reference_enum) < 1:
|
||||
reference_enum.append((' ', 'None', ''))
|
||||
if not self.classification.strip():
|
||||
return reference_enum
|
||||
with open(os.path.join(self.data_dir, 'class', 'references.csv'), 'r') as f:
|
||||
@@ -121,7 +109,6 @@ def getReferences(self, context):
|
||||
def getApplicableAttributes(self, context):
|
||||
global attributes_enum
|
||||
attributes_enum.clear()
|
||||
attributes_enum.append((' ', 'None', ''))
|
||||
if '/' in context.active_object.name \
|
||||
and context.active_object.name.split('/')[0] in ifc_schema.elements:
|
||||
attributes_enum.extend([(a['name'], a['name'], '') for a in
|
||||
@@ -132,7 +119,6 @@ def getApplicableAttributes(self, context):
|
||||
def getApplicableDocuments(self, context):
|
||||
global documents_enum
|
||||
documents_enum.clear()
|
||||
documents_enum.append((' ', 'None', ''))
|
||||
doc_path = os.path.join(context.scene.BIMProperties.data_dir, 'doc')
|
||||
for filename in Path(doc_path).glob('**/*'):
|
||||
uri = str(filename.relative_to(doc_path).as_posix())
|
||||
|
||||
Reference in New Issue
Block a user