mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
autopep8
autopep8 --in-place --recursive --max-line-length=200 ifcopenshell
This commit is contained in:
@@ -37,8 +37,8 @@ else:
|
|||||||
python_version_tuple = tuple(sys.version.split(' ')[0].split('.'))
|
python_version_tuple = tuple(sys.version.split(' ')[0].split('.'))
|
||||||
|
|
||||||
python_distribution = os.path.join(platform_system,
|
python_distribution = os.path.join(platform_system,
|
||||||
platform_architecture,
|
platform_architecture,
|
||||||
'python%s.%s' % python_version_tuple[:2])
|
'python%s.%s' % python_version_tuple[:2])
|
||||||
sys.path.append(os.path.abspath(os.path.join(
|
sys.path.append(os.path.abspath(os.path.join(
|
||||||
os.path.dirname(__file__),
|
os.path.dirname(__file__),
|
||||||
'lib', python_distribution)))
|
'lib', python_distribution)))
|
||||||
@@ -57,15 +57,18 @@ from . import guid
|
|||||||
from .file import file
|
from .file import file
|
||||||
from .entity_instance import entity_instance
|
from .entity_instance import entity_instance
|
||||||
|
|
||||||
|
|
||||||
def open(fn=None):
|
def open(fn=None):
|
||||||
return file(ifcopenshell_wrapper.open(os.path.abspath(fn))) if fn else file()
|
return file(ifcopenshell_wrapper.open(os.path.abspath(fn))) if fn else file()
|
||||||
|
|
||||||
|
|
||||||
def create_entity(type,*args,**kwargs):
|
def create_entity(type, *args, **kwargs):
|
||||||
e = entity_instance(type)
|
e = entity_instance(type)
|
||||||
attrs = list(enumerate(args)) + \
|
attrs = list(enumerate(args)) + \
|
||||||
[(e.wrapped_data.get_argument_index(name), arg) for name, arg in kwargs.items()]
|
[(e.wrapped_data.get_argument_index(name), arg) for name, arg in kwargs.items()]
|
||||||
for idx, arg in attrs: e[idx] = arg
|
for idx, arg in attrs:
|
||||||
|
e[idx] = arg
|
||||||
return e
|
return e
|
||||||
|
|
||||||
|
|
||||||
from .main import *
|
from .main import *
|
||||||
|
|||||||
@@ -62,14 +62,16 @@ class entity_instance(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def wrap_value(v):
|
def wrap_value(v):
|
||||||
wrap = lambda e: entity_instance(e)
|
def wrap(e): return entity_instance(e)
|
||||||
is_instance = lambda e: isinstance(e, ifcopenshell_wrapper.entity_instance)
|
|
||||||
|
def is_instance(e): return isinstance(e, ifcopenshell_wrapper.entity_instance)
|
||||||
return entity_instance.walk(is_instance, wrap, v)
|
return entity_instance.walk(is_instance, wrap, v)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def unwrap_value(v):
|
def unwrap_value(v):
|
||||||
unwrap = lambda e: e.wrapped_data
|
def unwrap(e): return e.wrapped_data
|
||||||
is_instance = lambda e: isinstance(e, entity_instance)
|
|
||||||
|
def is_instance(e): return isinstance(e, entity_instance)
|
||||||
return entity_instance.walk(is_instance, unwrap, v)
|
return entity_instance.walk(is_instance, unwrap, v)
|
||||||
|
|
||||||
def attribute_type(self, attr):
|
def attribute_type(self, attr):
|
||||||
@@ -95,7 +97,8 @@ class entity_instance(object):
|
|||||||
attr_type = attr_type.replace('Binary', 'String')
|
attr_type = attr_type.replace('Binary', 'String')
|
||||||
attr_type = attr_type.replace('Enumeration', 'String')
|
attr_type = attr_type.replace('Enumeration', 'String')
|
||||||
try:
|
try:
|
||||||
if isinstance(value, unicode): value = value.encode("utf-8")
|
if isinstance(value, unicode):
|
||||||
|
value = value.encode("utf-8")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
@@ -117,7 +120,8 @@ class entity_instance(object):
|
|||||||
return self.wrapped_data.id()
|
return self.wrapped_data.id()
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if type(self) != type(other): return False
|
if type(self) != type(other):
|
||||||
|
return False
|
||||||
return self.wrapped_data == other.wrapped_data
|
return self.wrapped_data == other.wrapped_data
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
@@ -144,17 +148,18 @@ class entity_instance(object):
|
|||||||
continue
|
continue
|
||||||
attr_value = self[i]
|
attr_value = self[i]
|
||||||
if recursive:
|
if recursive:
|
||||||
is_instance = lambda e: isinstance(e, entity_instance)
|
def is_instance(e): return isinstance(e, entity_instance)
|
||||||
|
|
||||||
def get_info_(inst):
|
def get_info_(inst):
|
||||||
# for ty in ignore:
|
# for ty in ignore:
|
||||||
# if inst.is_a(ty):
|
# if inst.is_a(ty):
|
||||||
# return None
|
# return None
|
||||||
return entity_instance.get_info(inst,
|
return entity_instance.get_info(inst,
|
||||||
include_identifier=include_identifier,
|
include_identifier=include_identifier,
|
||||||
recursive=recursive,
|
recursive=recursive,
|
||||||
return_type=return_type,
|
return_type=return_type,
|
||||||
ignore=ignore
|
ignore=ignore
|
||||||
)
|
)
|
||||||
attr_value = entity_instance.walk(is_instance, get_info_, attr_value)
|
attr_value = entity_instance.walk(is_instance, get_info_, attr_value)
|
||||||
yield self.attribute_name(i), attr_value
|
yield self.attribute_name(i), attr_value
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -34,42 +34,58 @@ except NameError:
|
|||||||
# Python 3 or newer
|
# Python 3 or newer
|
||||||
basestring = (str, bytes)
|
basestring = (str, bytes)
|
||||||
|
|
||||||
|
|
||||||
class file(object):
|
class file(object):
|
||||||
def __init__(self, f=None):
|
def __init__(self, f=None):
|
||||||
self.wrapped_data = f or ifcopenshell_wrapper.file()
|
self.wrapped_data = f or ifcopenshell_wrapper.file()
|
||||||
def create_entity(self,type,*args,**kwargs):
|
|
||||||
|
def create_entity(self, type, *args, **kwargs):
|
||||||
e = entity_instance(type)
|
e = entity_instance(type)
|
||||||
self.wrapped_data.add(e.wrapped_data)
|
self.wrapped_data.add(e.wrapped_data)
|
||||||
e.wrapped_data.this.disown()
|
e.wrapped_data.this.disown()
|
||||||
attrs = list(enumerate(args)) + \
|
attrs = list(enumerate(args)) + \
|
||||||
[(e.wrapped_data.get_argument_index(name), arg) for name, arg in kwargs.items()]
|
[(e.wrapped_data.get_argument_index(name), arg) for name, arg in kwargs.items()]
|
||||||
for idx, arg in attrs: e[idx] = arg
|
for idx, arg in attrs:
|
||||||
|
e[idx] = arg
|
||||||
return e
|
return e
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
if attr[0:6] == 'create': return functools.partial(self.create_entity,attr[6:])
|
if attr[0:6] == 'create':
|
||||||
else: return getattr(self.wrapped_data, attr)
|
return functools.partial(self.create_entity, attr[6:])
|
||||||
|
else:
|
||||||
|
return getattr(self.wrapped_data, attr)
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
if isinstance(key, numbers.Integral):
|
if isinstance(key, numbers.Integral):
|
||||||
return entity_instance(self.wrapped_data.by_id(key))
|
return entity_instance(self.wrapped_data.by_id(key))
|
||||||
elif isinstance(key, basestring):
|
elif isinstance(key, basestring):
|
||||||
return entity_instance(self.wrapped_data.by_guid(str(key)))
|
return entity_instance(self.wrapped_data.by_guid(str(key)))
|
||||||
|
|
||||||
def by_id(self, id): return self[id]
|
def by_id(self, id): return self[id]
|
||||||
|
|
||||||
def by_guid(self, guid): return self[guid]
|
def by_guid(self, guid): return self[guid]
|
||||||
|
|
||||||
def add(self, inst):
|
def add(self, inst):
|
||||||
inst.wrapped_data.this.disown()
|
inst.wrapped_data.this.disown()
|
||||||
return entity_instance(self.wrapped_data.add(inst.wrapped_data))
|
return entity_instance(self.wrapped_data.add(inst.wrapped_data))
|
||||||
|
|
||||||
def by_type(self, type):
|
def by_type(self, type):
|
||||||
return [entity_instance(e) for e in self.wrapped_data.by_type(type)]
|
return [entity_instance(e) for e in self.wrapped_data.by_type(type)]
|
||||||
|
|
||||||
def traverse(self, inst, max_levels=None):
|
def traverse(self, inst, max_levels=None):
|
||||||
if max_levels is None:
|
if max_levels is None:
|
||||||
max_levels = -1
|
max_levels = -1
|
||||||
return [entity_instance(e) for e in self.wrapped_data.traverse(inst.wrapped_data, max_levels)]
|
return [entity_instance(e) for e in self.wrapped_data.traverse(inst.wrapped_data, max_levels)]
|
||||||
|
|
||||||
def get_inverse(self, inst):
|
def get_inverse(self, inst):
|
||||||
return [entity_instance(e) for e in self.wrapped_data.get_inverse(inst.wrapped_data)]
|
return [entity_instance(e) for e in self.wrapped_data.get_inverse(inst.wrapped_data)]
|
||||||
|
|
||||||
def remove(self, inst):
|
def remove(self, inst):
|
||||||
return self.wrapped_data.remove(inst.wrapped_data)
|
return self.wrapped_data.remove(inst.wrapped_data)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self[id] for id in self.wrapped_data.entity_names())
|
return iter(self[id] for id in self.wrapped_data.entity_names())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_string(s):
|
def from_string(s):
|
||||||
return file(ifcopenshell_wrapper.read(s))
|
return file(ifcopenshell_wrapper.read(s))
|
||||||
|
|||||||
@@ -15,21 +15,27 @@ from collections import defaultdict, Iterable, OrderedDict
|
|||||||
os.environ['QT_API'] = 'pyqt4'
|
os.environ['QT_API'] = 'pyqt4'
|
||||||
try:
|
try:
|
||||||
from pyqode.qt import QtCore
|
from pyqode.qt import QtCore
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
from PyQt4 import QtGui, QtCore
|
from PyQt4 import QtGui, QtCore
|
||||||
|
|
||||||
from .code_editor_pane import code_edit
|
from .code_editor_pane import code_edit
|
||||||
|
|
||||||
try: from OCC.Display.pyqt4Display import qtViewer3d
|
try:
|
||||||
|
from OCC.Display.pyqt4Display import qtViewer3d
|
||||||
except:
|
except:
|
||||||
import OCC.Display
|
import OCC.Display
|
||||||
|
|
||||||
try: import OCC.Display.backend
|
try:
|
||||||
except: pass
|
import OCC.Display.backend
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try: OCC.Display.backend.get_backend("qt-pyqt4")
|
try:
|
||||||
except: OCC.Display.backend.load_backend("qt-pyqt4")
|
OCC.Display.backend.get_backend("qt-pyqt4")
|
||||||
|
except:
|
||||||
|
OCC.Display.backend.load_backend("qt-pyqt4")
|
||||||
|
|
||||||
from OCC.Display.qtDisplay import qtViewer3d
|
from OCC.Display.qtDisplay import qtViewer3d
|
||||||
|
|
||||||
@@ -46,6 +52,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
QString = str
|
QString = str
|
||||||
|
|
||||||
|
|
||||||
class configuration(object):
|
class configuration(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
try:
|
try:
|
||||||
@@ -53,7 +60,8 @@ class configuration(object):
|
|||||||
Cfg = ConfigParser.RawConfigParser
|
Cfg = ConfigParser.RawConfigParser
|
||||||
except:
|
except:
|
||||||
import configparser
|
import configparser
|
||||||
Cfg = lambda: configparser.ConfigParser(interpolation=None)
|
|
||||||
|
def Cfg(): return configparser.ConfigParser(interpolation=None)
|
||||||
|
|
||||||
conf_file = os.path.expanduser(os.path.join("~", ".ifcopenshell", "app", "snippets.conf"))
|
conf_file = os.path.expanduser(os.path.join("~", ".ifcopenshell", "app", "snippets.conf"))
|
||||||
if conf_file.startswith("~"):
|
if conf_file.startswith("~"):
|
||||||
@@ -155,8 +163,9 @@ class application(QtGui.QApplication):
|
|||||||
|
|
||||||
def select(self, product):
|
def select(self, product):
|
||||||
itm = self.product_to_item.get(product)
|
itm = self.product_to_item.get(product)
|
||||||
if itm is None: return
|
if itm is None:
|
||||||
self.selectionModel().setCurrentIndex(itm, QtGui.QItemSelectionModel.SelectCurrent | QtGui.QItemSelectionModel.Rows);
|
return
|
||||||
|
self.selectionModel().setCurrentIndex(itm, QtGui.QItemSelectionModel.SelectCurrent | QtGui.QItemSelectionModel.Rows)
|
||||||
|
|
||||||
class decomposition_treeview(abstract_treeview):
|
class decomposition_treeview(abstract_treeview):
|
||||||
|
|
||||||
@@ -217,8 +226,9 @@ class application(QtGui.QApplication):
|
|||||||
for t in types:
|
for t in types:
|
||||||
def add(t):
|
def add(t):
|
||||||
s = get_supertype(t)
|
s = get_supertype(t)
|
||||||
if s: add(s)
|
if s:
|
||||||
s2, t2 = map(QString, (s,t))
|
add(s)
|
||||||
|
s2, t2 = map(QString, (s, t))
|
||||||
if t2 not in items:
|
if t2 not in items:
|
||||||
itm = items[t2] = QtGui.QTreeWidgetItem(items.get(s2, self), [t2])
|
itm = items[t2] = QtGui.QTreeWidgetItem(items.get(s2, self), [t2])
|
||||||
itm.setData(0, QtCore.Qt.UserRole, t2)
|
itm.setData(0, QtCore.Qt.UserRole, t2)
|
||||||
@@ -235,13 +245,11 @@ class application(QtGui.QApplication):
|
|||||||
self.connect(self, QtCore.SIGNAL("clicked(const QModelIndex &)"), self.clicked)
|
self.connect(self, QtCore.SIGNAL("clicked(const QModelIndex &)"), self.clicked)
|
||||||
self.expandAll()
|
self.expandAll()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class property_table(QtGui.QWidget):
|
class property_table(QtGui.QWidget):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QtGui.QWidget.__init__(self)
|
QtGui.QWidget.__init__(self)
|
||||||
self.layout= QtGui.QVBoxLayout(self)
|
self.layout = QtGui.QVBoxLayout(self)
|
||||||
self.setLayout(self.layout)
|
self.setLayout(self.layout)
|
||||||
self.scroll = QtGui.QScrollArea(self)
|
self.scroll = QtGui.QScrollArea(self)
|
||||||
self.layout.addWidget(self.scroll)
|
self.layout.addWidget(self.scroll)
|
||||||
@@ -252,7 +260,7 @@ class application(QtGui.QApplication):
|
|||||||
self.scroll.setWidget(self.scrollContent)
|
self.scroll.setWidget(self.scrollContent)
|
||||||
self.prop_dict = {}
|
self.prop_dict = {}
|
||||||
|
|
||||||
#triggered by selection event in either component of parent
|
# triggered by selection event in either component of parent
|
||||||
def select(self, product):
|
def select(self, product):
|
||||||
|
|
||||||
# Clear the old contents if any
|
# Clear the old contents if any
|
||||||
@@ -268,7 +276,7 @@ class application(QtGui.QApplication):
|
|||||||
prop_sets = self.prop_dict.get(str(product))
|
prop_sets = self.prop_dict.get(str(product))
|
||||||
|
|
||||||
if prop_sets is not None:
|
if prop_sets is not None:
|
||||||
for k,v in prop_sets:
|
for k, v in prop_sets:
|
||||||
group_box = QtGui.QGroupBox()
|
group_box = QtGui.QGroupBox()
|
||||||
|
|
||||||
group_box.setTitle(k)
|
group_box.setTitle(k)
|
||||||
@@ -299,10 +307,9 @@ class application(QtGui.QApplication):
|
|||||||
|
|
||||||
self.scrollLayout.addStretch()
|
self.scrollLayout.addStretch()
|
||||||
else:
|
else:
|
||||||
label = QtGui.QLabel("No IfcPropertySets asscociated with selected entity instance" )
|
label = QtGui.QLabel("No IfcPropertySets asscociated with selected entity instance")
|
||||||
self.scrollLayout.addWidget(label)
|
self.scrollLayout.addWidget(label)
|
||||||
|
|
||||||
|
|
||||||
def load_file(self, f, **kwargs):
|
def load_file(self, f, **kwargs):
|
||||||
for p in f.by_type("IfcProduct"):
|
for p in f.by_type("IfcProduct"):
|
||||||
propsets = []
|
propsets = []
|
||||||
@@ -314,16 +321,16 @@ class application(QtGui.QApplication):
|
|||||||
if prop_def.is_a("IfcElementQuantity"):
|
if prop_def.is_a("IfcElementQuantity"):
|
||||||
for q in prop_def.Quantities:
|
for q in prop_def.Quantities:
|
||||||
if q.is_a("IfcPhysicalSimpleQuantity"):
|
if q.is_a("IfcPhysicalSimpleQuantity"):
|
||||||
props[q.Name]=q[3]
|
props[q.Name] = q[3]
|
||||||
elif prop_def.is_a("IfcPropertySet"):
|
elif prop_def.is_a("IfcPropertySet"):
|
||||||
for prop in prop_def.HasProperties:
|
for prop in prop_def.HasProperties:
|
||||||
if prop.is_a("IfcPropertySingleValue"):
|
if prop.is_a("IfcPropertySingleValue"):
|
||||||
props[prop.Name]=prop.NominalValue
|
props[prop.Name] = prop.NominalValue
|
||||||
else:
|
else:
|
||||||
# Entity introduced in IFC4
|
# Entity introduced in IFC4
|
||||||
# prop_def.is_a("IfcPreDefinedPropertySet"):
|
# prop_def.is_a("IfcPreDefinedPropertySet"):
|
||||||
for prop in range(4, len(prop_def)):
|
for prop in range(4, len(prop_def)):
|
||||||
props[prop_def.attribute_name(prop)]=prop_def[prop]
|
props[prop_def.attribute_name(prop)] = prop_def[prop]
|
||||||
return prop_set_name, props
|
return prop_set_name, props
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -332,7 +339,8 @@ class application(QtGui.QApplication):
|
|||||||
propsets.append(process_pset(is_def_by.RelatingPropertyDefinition))
|
propsets.append(process_pset(is_def_by.RelatingPropertyDefinition))
|
||||||
elif is_def_by.is_a("IfcRelDefinesByType"):
|
elif is_def_by.is_a("IfcRelDefinesByType"):
|
||||||
type_psets = is_def_by.RelatingType.HasPropertySets
|
type_psets = is_def_by.RelatingType.HasPropertySets
|
||||||
if type_psets is None: continue
|
if type_psets is None:
|
||||||
|
continue
|
||||||
for propset in type_psets:
|
for propset in type_psets:
|
||||||
propsets.append(process_pset(propset))
|
propsets.append(process_pset(propset))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -343,7 +351,7 @@ class application(QtGui.QApplication):
|
|||||||
if len(propsets):
|
if len(propsets):
|
||||||
self.prop_dict[str(p)] = propsets
|
self.prop_dict[str(p)] = propsets
|
||||||
|
|
||||||
print ("property set dictionary has {} entries".format(len(self.prop_dict)))
|
print("property set dictionary has {} entries".format(len(self.prop_dict)))
|
||||||
|
|
||||||
class viewer(qtViewer3d):
|
class viewer(qtViewer3d):
|
||||||
|
|
||||||
@@ -357,17 +365,20 @@ class application(QtGui.QApplication):
|
|||||||
yield ais.Shape()
|
yield ais.Shape()
|
||||||
return
|
return
|
||||||
shp = OCC.AIS.Handle_AIS_Shape.DownCast(ais_handle)
|
shp = OCC.AIS.Handle_AIS_Shape.DownCast(ais_handle)
|
||||||
if not shp.IsNull(): yield shp.Shape()
|
if not shp.IsNull():
|
||||||
|
yield shp.Shape()
|
||||||
return
|
return
|
||||||
mult = ais_handle
|
mult = ais_handle
|
||||||
if mult.IsNull():
|
if mult.IsNull():
|
||||||
shp = OCC.AIS.Handle_AIS_Shape.DownCast(ais_handle)
|
shp = OCC.AIS.Handle_AIS_Shape.DownCast(ais_handle)
|
||||||
if not shp.IsNull(): yield shp
|
if not shp.IsNull():
|
||||||
|
yield shp
|
||||||
else:
|
else:
|
||||||
li = mult.GetObject().ConnectedTo()
|
li = mult.GetObject().ConnectedTo()
|
||||||
for i in range(li.Length()):
|
for i in range(li.Length()):
|
||||||
shp = OCC.AIS.Handle_AIS_Shape.DownCast(li.Value(i+1))
|
shp = OCC.AIS.Handle_AIS_Shape.DownCast(li.Value(i + 1))
|
||||||
if not shp.IsNull(): yield shp
|
if not shp.IsNull():
|
||||||
|
yield shp
|
||||||
return tuple(shp.HashCode(1 << 24) for shp in yield_shapes())
|
return tuple(shp.HashCode(1 << 24) for shp in yield_shapes())
|
||||||
|
|
||||||
def __init__(self, widget):
|
def __init__(self, widget):
|
||||||
@@ -390,7 +401,8 @@ class application(QtGui.QApplication):
|
|||||||
v = self._display
|
v = self._display
|
||||||
|
|
||||||
t = {0: time.time()}
|
t = {0: time.time()}
|
||||||
def update(dt = None):
|
|
||||||
|
def update(dt=None):
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
if t1 - t[0] > (dt or -1):
|
if t1 - t[0] > (dt or -1):
|
||||||
v.FitAll()
|
v.FitAll()
|
||||||
@@ -408,7 +420,8 @@ class application(QtGui.QApplication):
|
|||||||
|
|
||||||
old_progress = -1
|
old_progress = -1
|
||||||
while True:
|
while True:
|
||||||
if terminate[0]: break
|
if terminate[0]:
|
||||||
|
break
|
||||||
shape = it.get()
|
shape = it.get()
|
||||||
product = f[shape.data.id]
|
product = f[shape.data.id]
|
||||||
ais = display_shape(shape, viewer_handle=v)
|
ais = display_shape(shape, viewer_handle=v)
|
||||||
@@ -427,13 +440,14 @@ class application(QtGui.QApplication):
|
|||||||
break
|
break
|
||||||
update(0.2)
|
update(0.2)
|
||||||
|
|
||||||
print("\rOpened file in %.2f seconds%s" % (time.time() - t0, " "*25))
|
print("\rOpened file in %.2f seconds%s" % (time.time() - t0, " " * 25))
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
|
||||||
def select(self, product):
|
def select(self, product):
|
||||||
ais = self.product_to_ais.get(product)
|
ais = self.product_to_ais.get(product)
|
||||||
if ais is None: return
|
if ais is None:
|
||||||
|
return
|
||||||
v = self._display.Context
|
v = self._display.Context
|
||||||
v.ClearSelected(False)
|
v.ClearSelected(False)
|
||||||
v.SetSelected(ais, True)
|
v.SetSelected(ais, True)
|
||||||
@@ -509,7 +523,6 @@ class application(QtGui.QApplication):
|
|||||||
a.triggered.connect(callback)
|
a.triggered.connect(callback)
|
||||||
m.addAction(a)
|
m.addAction(a)
|
||||||
|
|
||||||
|
|
||||||
def makeSelectionHandler(self, component):
|
def makeSelectionHandler(self, component):
|
||||||
def handler(inst):
|
def handler(inst):
|
||||||
for c in self.components:
|
for c in self.components:
|
||||||
@@ -536,8 +549,8 @@ class application(QtGui.QApplication):
|
|||||||
self.editor = code_edit(self.canvas, configuration().options('snippets'))
|
self.editor = code_edit(self.canvas, configuration().options('snippets'))
|
||||||
splitter2.addWidget(self.editor)
|
splitter2.addWidget(self.editor)
|
||||||
splitter.addWidget(splitter2)
|
splitter.addWidget(splitter2)
|
||||||
splitter.setSizes([200,600])
|
splitter.setSizes([200, 600])
|
||||||
splitter2.setSizes([400,200])
|
splitter2.setSizes([400, 200])
|
||||||
self.window.setCentralWidget(splitter)
|
self.window.setCentralWidget(splitter)
|
||||||
self.canvas.initialize()
|
self.canvas.initialize()
|
||||||
self.components = [self.tree, self.tree2, self.canvas, self.propview, self.editor]
|
self.components = [self.tree, self.tree2, self.canvas, self.propview, self.editor]
|
||||||
@@ -569,7 +582,7 @@ class application(QtGui.QApplication):
|
|||||||
sys.exit(self.exec_())
|
sys.exit(self.exec_())
|
||||||
|
|
||||||
def browse(self):
|
def browse(self):
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self.window, 'Open file',".","Industry Foundation Classes (*.ifc)")
|
filename = QtGui.QFileDialog.getOpenFileName(self.window, 'Open file', ".", "Industry Foundation Classes (*.ifc)")
|
||||||
self.load(filename)
|
self.load(filename)
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
@@ -578,11 +591,13 @@ class application(QtGui.QApplication):
|
|||||||
self.files.clear()
|
self.files.clear()
|
||||||
|
|
||||||
def load(self, fn):
|
def load(self, fn):
|
||||||
if fn in self.files: return
|
if fn in self.files:
|
||||||
|
return
|
||||||
f = open_ifc_file(str(fn))
|
f = open_ifc_file(str(fn))
|
||||||
self.files[fn] = f
|
self.files[fn] = f
|
||||||
for c in self.components:
|
for c in self.components:
|
||||||
c.load_file(f, setting=self.settings)
|
c.load_file(f, setting=self.settings)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
application().start()
|
application().start()
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ class StdoutRedirector(object):
|
|||||||
'''A class for redirecting stdout to this Text widget.'''
|
'''A class for redirecting stdout to this Text widget.'''
|
||||||
|
|
||||||
def __init__(self, widget):
|
def __init__(self, widget):
|
||||||
self.widget=widget
|
self.widget = widget
|
||||||
self.isError = False
|
self.isError = False
|
||||||
|
|
||||||
def write(self,str):
|
def write(self, str):
|
||||||
self.widget.moveCursor(QtGui.QTextCursor.End)
|
self.widget.moveCursor(QtGui.QTextCursor.End)
|
||||||
if self.isError:
|
if self.isError:
|
||||||
self.widget.setTextColor(QtCore.Qt.red)
|
self.widget.setTextColor(QtCore.Qt.red)
|
||||||
@@ -60,7 +60,7 @@ class code_edit(QtGui.QWidget):
|
|||||||
def runCode(self):
|
def runCode(self):
|
||||||
sys.stdout = StdoutRedirector(self.output)
|
sys.stdout = StdoutRedirector(self.output)
|
||||||
sys.stderr = StdoutRedirector(self.output)
|
sys.stderr = StdoutRedirector(self.output)
|
||||||
sys.stderr.isError=True
|
sys.stderr.isError = True
|
||||||
|
|
||||||
if not self.model:
|
if not self.model:
|
||||||
print("please load a model first", file=sys.stderr)
|
print("please load a model first", file=sys.stderr)
|
||||||
@@ -70,15 +70,15 @@ class code_edit(QtGui.QWidget):
|
|||||||
sys.stdout = sys.__stdout__
|
sys.stdout = sys.__stdout__
|
||||||
sys.stderr = sys.__stderr__
|
sys.stderr = sys.__stderr__
|
||||||
|
|
||||||
def select(self,product):
|
def select(self, product):
|
||||||
self.c = self.Console({'model':self.model, 'viewer':self.viewer, 'selection':product})
|
self.c = self.Console({'model': self.model, 'viewer': self.viewer, 'selection': product})
|
||||||
|
|
||||||
def __init__(self,viewer,snippets=None):
|
def __init__(self, viewer, snippets=None):
|
||||||
|
|
||||||
self.model=None
|
self.model = None
|
||||||
self.viewer = viewer
|
self.viewer = viewer
|
||||||
QtGui.QWidget.__init__(self)
|
QtGui.QWidget.__init__(self)
|
||||||
self.layout= QtGui.QVBoxLayout(self)
|
self.layout = QtGui.QVBoxLayout(self)
|
||||||
self.setLayout(self.layout)
|
self.setLayout(self.layout)
|
||||||
self.c = None
|
self.c = None
|
||||||
|
|
||||||
@@ -150,5 +150,5 @@ class code_edit(QtGui.QWidget):
|
|||||||
output = []
|
output = []
|
||||||
sys.stdout = StdoutRedirector(self.output)
|
sys.stdout = StdoutRedirector(self.output)
|
||||||
self.model = f
|
self.model = f
|
||||||
self.c = self.Console({'model':self.model, 'selection':None, 'viewer':self.viewer})
|
self.c = self.Console({'model': self.model, 'selection': None, 'viewer': self.viewer})
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = sys.__stdout__
|
||||||
|
|||||||
@@ -28,23 +28,34 @@ from .. import ifcopenshell_wrapper
|
|||||||
from ..file import file
|
from ..file import file
|
||||||
from ..entity_instance import entity_instance
|
from ..entity_instance import entity_instance
|
||||||
|
|
||||||
|
|
||||||
def has_occ():
|
def has_occ():
|
||||||
try: import OCC.BRepTools
|
try:
|
||||||
except: return False
|
import OCC.BRepTools
|
||||||
|
except:
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
has_occ = has_occ()
|
has_occ = has_occ()
|
||||||
wrap_shape_creation = lambda settings, shape: shape
|
|
||||||
|
|
||||||
|
def wrap_shape_creation(settings, shape): return shape
|
||||||
|
|
||||||
|
|
||||||
if has_occ:
|
if has_occ:
|
||||||
from . import occ_utils as utils
|
from . import occ_utils as utils
|
||||||
wrap_shape_creation = lambda settings, shape: utils.create_shape_from_serialization(shape) if getattr(settings, 'use_python_opencascade', False) else shape
|
|
||||||
|
def wrap_shape_creation(settings, shape): return utils.create_shape_from_serialization(shape) if getattr(settings, 'use_python_opencascade', False) else shape
|
||||||
|
|
||||||
# Subclass the settings module to provide an additional
|
# Subclass the settings module to provide an additional
|
||||||
# setting to enable pythonOCC when available
|
# setting to enable pythonOCC when available
|
||||||
|
|
||||||
|
|
||||||
class settings(ifcopenshell_wrapper.settings):
|
class settings(ifcopenshell_wrapper.settings):
|
||||||
if has_occ:
|
if has_occ:
|
||||||
USE_PYTHON_OPENCASCADE = -1
|
USE_PYTHON_OPENCASCADE = -1
|
||||||
|
|
||||||
def set(self, *args):
|
def set(self, *args):
|
||||||
setting, value = args
|
setting, value = args
|
||||||
if setting == settings.USE_PYTHON_OPENCASCADE:
|
if setting == settings.USE_PYTHON_OPENCASCADE:
|
||||||
@@ -55,6 +66,7 @@ class settings(ifcopenshell_wrapper.settings):
|
|||||||
else:
|
else:
|
||||||
ifcopenshell_wrapper.settings.set(self, *args)
|
ifcopenshell_wrapper.settings.set(self, *args)
|
||||||
|
|
||||||
|
|
||||||
# Hide templating precision to the user by choosing based on Python's
|
# Hide templating precision to the user by choosing based on Python's
|
||||||
# internal float type. This is probably always going to be a double.
|
# internal float type. This is probably always going to be a double.
|
||||||
for ty in (ifcopenshell_wrapper.iterator_single_precision, ifcopenshell_wrapper.iterator_double_precision):
|
for ty in (ifcopenshell_wrapper.iterator_single_precision, ifcopenshell_wrapper.iterator_double_precision):
|
||||||
@@ -127,7 +139,7 @@ def create_shape(settings, inst, repr=None):
|
|||||||
settings,
|
settings,
|
||||||
inst.wrapped_data,
|
inst.wrapped_data,
|
||||||
repr.wrapped_data if repr is not None else None
|
repr.wrapped_data if repr is not None else None
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
def iterate(settings, filename):
|
def iterate(settings, filename):
|
||||||
@@ -135,12 +147,15 @@ def iterate(settings, filename):
|
|||||||
if it.initialize():
|
if it.initialize():
|
||||||
while True:
|
while True:
|
||||||
yield it.get()
|
yield it.get()
|
||||||
if not it.next(): break
|
if not it.next():
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def make_shape_function(fn):
|
def make_shape_function(fn):
|
||||||
entity_instance_or_none = lambda e: None if e is None else entity_instance(e)
|
def entity_instance_or_none(e): return None if e is None else entity_instance(e)
|
||||||
if has_occ:
|
if has_occ:
|
||||||
import OCC.TopoDS
|
import OCC.TopoDS
|
||||||
|
|
||||||
def _(string_or_shape, *args):
|
def _(string_or_shape, *args):
|
||||||
if isinstance(string_or_shape, OCC.TopoDS.TopoDS_Shape):
|
if isinstance(string_or_shape, OCC.TopoDS.TopoDS_Shape):
|
||||||
string_or_shape = utils.serialize_shape(string_or_shape)
|
string_or_shape = utils.serialize_shape(string_or_shape)
|
||||||
@@ -150,5 +165,6 @@ def make_shape_function(fn):
|
|||||||
return entity_instance_or_none(fn(string, *args))
|
return entity_instance_or_none(fn(string, *args))
|
||||||
return _
|
return _
|
||||||
|
|
||||||
|
|
||||||
serialise = make_shape_function(ifcopenshell_wrapper.serialise)
|
serialise = make_shape_function(ifcopenshell_wrapper.serialise)
|
||||||
tesselate = make_shape_function(ifcopenshell_wrapper.tesselate)
|
tesselate = make_shape_function(ifcopenshell_wrapper.tesselate)
|
||||||
|
|||||||
@@ -30,20 +30,21 @@ shape_tuple = namedtuple('shape_tuple', ('data', 'geometry', 'styles'))
|
|||||||
handle, main_loop, add_menu, add_function_to_menu = None, None, None, None
|
handle, main_loop, add_menu, add_function_to_menu = None, None, None, None
|
||||||
|
|
||||||
DEFAULT_STYLES = {
|
DEFAULT_STYLES = {
|
||||||
"DEFAULT" : (.7 , .7, .7 ),
|
"DEFAULT": (.7, .7, .7),
|
||||||
"IfcWall" : (.8 , .8, .8 ),
|
"IfcWall": (.8, .8, .8),
|
||||||
"IfcSite" : (.75, .8, .65 ),
|
"IfcSite": (.75, .8, .65),
|
||||||
"IfcSlab" : (.4 , .4, .4 ),
|
"IfcSlab": (.4, .4, .4),
|
||||||
"IfcWallStandardCase": (.9 , .9, .9 ),
|
"IfcWallStandardCase": (.9, .9, .9),
|
||||||
"IfcWall" : (.9 , .9, .9 ),
|
"IfcWall": (.9, .9, .9),
|
||||||
"IfcWindow" : (.75, .8, .75, .3),
|
"IfcWindow": (.75, .8, .75, .3),
|
||||||
"IfcDoor" : (.55, .3, .15 ),
|
"IfcDoor": (.55, .3, .15),
|
||||||
"IfcBeam" : (.75, .7, .7 ),
|
"IfcBeam": (.75, .7, .7),
|
||||||
"IfcRailing" : (.65, .6, .6 ),
|
"IfcRailing": (.65, .6, .6),
|
||||||
"IfcMember" : (.65, .6, .6 ),
|
"IfcMember": (.65, .6, .6),
|
||||||
"IfcPlate" : (.8 , .8, .8 )
|
"IfcPlate": (.8, .8, .8)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def initialize_display():
|
def initialize_display():
|
||||||
import OCC.V3d
|
import OCC.V3d
|
||||||
import OCC.Display.SimpleGui
|
import OCC.Display.SimpleGui
|
||||||
@@ -58,8 +59,10 @@ def initialize_display():
|
|||||||
def lights():
|
def lights():
|
||||||
viewer.InitActiveLights()
|
viewer.InitActiveLights()
|
||||||
while True:
|
while True:
|
||||||
try: active_light = viewer.ActiveLight()
|
try:
|
||||||
except: break
|
active_light = viewer.ActiveLight()
|
||||||
|
except:
|
||||||
|
break
|
||||||
yield active_light
|
yield active_light
|
||||||
viewer.NextActiveLights()
|
viewer.NextActiveLights()
|
||||||
|
|
||||||
@@ -67,7 +70,7 @@ def initialize_display():
|
|||||||
for l in lights:
|
for l in lights:
|
||||||
viewer.DelLight(l)
|
viewer.DelLight(l)
|
||||||
|
|
||||||
for dir in [(3,2,1), (-1,-2,-3)]:
|
for dir in [(3, 2, 1), (-1, -2, -3)]:
|
||||||
light = OCC.V3d.V3d_DirectionalLight(viewer_handle)
|
light = OCC.V3d.V3d_DirectionalLight(viewer_handle)
|
||||||
light.SetDirection(*dir)
|
light.SetDirection(*dir)
|
||||||
viewer.SetLightOn(light.GetHandle())
|
viewer.SetLightOn(light.GetHandle())
|
||||||
@@ -75,6 +78,7 @@ def initialize_display():
|
|||||||
setup()
|
setup()
|
||||||
return handle
|
return handle
|
||||||
|
|
||||||
|
|
||||||
def yield_subshapes(shape):
|
def yield_subshapes(shape):
|
||||||
import OCC.TopoDS
|
import OCC.TopoDS
|
||||||
|
|
||||||
@@ -83,16 +87,19 @@ def yield_subshapes(shape):
|
|||||||
yield it.Value()
|
yield it.Value()
|
||||||
it.Next()
|
it.Next()
|
||||||
|
|
||||||
|
|
||||||
def display_shape(shape, clr=None, viewer_handle=None):
|
def display_shape(shape, clr=None, viewer_handle=None):
|
||||||
import OCC.gp
|
import OCC.gp
|
||||||
import OCC.AIS
|
import OCC.AIS
|
||||||
import OCC.Quantity
|
import OCC.Quantity
|
||||||
|
|
||||||
if viewer_handle is None: viewer_handle = handle
|
if viewer_handle is None:
|
||||||
|
viewer_handle = handle
|
||||||
|
|
||||||
if isinstance(shape, shape_tuple):
|
if isinstance(shape, shape_tuple):
|
||||||
shape, representation = shape.geometry, shape
|
shape, representation = shape.geometry, shape
|
||||||
else: representation = None
|
else:
|
||||||
|
representation = None
|
||||||
|
|
||||||
material = OCC.Graphic3d.Graphic3d_MaterialAspect(OCC.Graphic3d.Graphic3d_NOM_PLASTER)
|
material = OCC.Graphic3d.Graphic3d_MaterialAspect(OCC.Graphic3d.Graphic3d_NOM_PLASTER)
|
||||||
material.SetDiffuse(1)
|
material.SetDiffuse(1)
|
||||||
@@ -150,7 +157,8 @@ def display_shape(shape, clr=None, viewer_handle=None):
|
|||||||
# in order for transparency to be rendered on the subshape.
|
# in order for transparency to be rendered on the subshape.
|
||||||
applied_styles = representation.styles
|
applied_styles = representation.styles
|
||||||
if default_style_applied:
|
if default_style_applied:
|
||||||
if len(default_style_applied) == 3: default_style_applied += (1.,)
|
if len(default_style_applied) == 3:
|
||||||
|
default_style_applied += (1.,)
|
||||||
applied_styles += (default_style_applied,)
|
applied_styles += (default_style_applied,)
|
||||||
|
|
||||||
if len(applied_styles):
|
if len(applied_styles):
|
||||||
@@ -163,7 +171,7 @@ def display_shape(shape, clr=None, viewer_handle=None):
|
|||||||
ais = OCC.AIS.AIS_Shape(shape)
|
ais = OCC.AIS.AIS_Shape(shape)
|
||||||
ais.SetMaterial(material)
|
ais.SetMaterial(material)
|
||||||
|
|
||||||
r = lambda: random.random() * 0.3 + 0.7
|
def r(): return random.random() * 0.3 + 0.7
|
||||||
clr = OCC.Quantity.Quantity_Color(r(), r(), r(), OCC.Quantity.Quantity_TOC_RGB)
|
clr = OCC.Quantity.Quantity_Color(r(), r(), r(), OCC.Quantity.Quantity_TOC_RGB)
|
||||||
ais.SetColor(clr)
|
ais.SetColor(clr)
|
||||||
|
|
||||||
@@ -180,9 +188,10 @@ def set_shape_transparency(ais, t):
|
|||||||
def get_bounding_box_center(bbox):
|
def get_bounding_box_center(bbox):
|
||||||
import OCC.gp
|
import OCC.gp
|
||||||
|
|
||||||
bbmin = [0.]*3; bbmax = [0.]*3
|
bbmin = [0.] * 3
|
||||||
|
bbmax = [0.] * 3
|
||||||
bbmin[0], bbmin[1], bbmin[2], bbmax[0], bbmax[1], bbmax[2] = bbox.Get()
|
bbmin[0], bbmin[1], bbmin[2], bbmax[0], bbmax[1], bbmax[2] = bbox.Get()
|
||||||
return OCC.gp.gp_Pnt(*map(lambda xy: (xy[0]+xy[1])/2., zip(bbmin, bbmax)))
|
return OCC.gp.gp_Pnt(*map(lambda xy: (xy[0] + xy[1]) / 2., zip(bbmin, bbmax)))
|
||||||
|
|
||||||
|
|
||||||
def serialize_shape(shape):
|
def serialize_shape(shape):
|
||||||
@@ -192,6 +201,7 @@ def serialize_shape(shape):
|
|||||||
shapes.Add(shape)
|
shapes.Add(shape)
|
||||||
return shapes.WriteToString()
|
return shapes.WriteToString()
|
||||||
|
|
||||||
|
|
||||||
def create_shape_from_serialization(brep_object):
|
def create_shape_from_serialization(brep_object):
|
||||||
import OCC.BRepTools
|
import OCC.BRepTools
|
||||||
|
|
||||||
@@ -206,20 +216,22 @@ def create_shape_from_serialization(brep_object):
|
|||||||
brep_data = brep_object.brep_data
|
brep_data = brep_object.brep_data
|
||||||
styles = brep_object.surface_styles
|
styles = brep_object.surface_styles
|
||||||
is_product_shape = False
|
is_product_shape = False
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
styles = tuple(styles[i:i+4] for i in range(0, len(styles), 4))
|
styles = tuple(styles[i:i + 4] for i in range(0, len(styles), 4))
|
||||||
|
|
||||||
if not brep_data: return shape_tuple(brep_object, None, styles)
|
if not brep_data:
|
||||||
|
return shape_tuple(brep_object, None, styles)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ss = OCC.BRepTools.BRepTools_ShapeSet()
|
ss = OCC.BRepTools.BRepTools_ShapeSet()
|
||||||
ss.ReadFromString(brep_data)
|
ss.ReadFromString(brep_data)
|
||||||
occ_shape = ss.Shape(ss.NbShapes())
|
occ_shape = ss.Shape(ss.NbShapes())
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if is_product_shape:
|
if is_product_shape:
|
||||||
return shape_tuple(brep_object, occ_shape, styles)
|
return shape_tuple(brep_object, occ_shape, styles)
|
||||||
else:
|
else:
|
||||||
return occ_shape
|
return occ_shape
|
||||||
|
|
||||||
|
|||||||
@@ -28,23 +28,28 @@ from functools import reduce
|
|||||||
|
|
||||||
chars = string.digits + string.ascii_uppercase + string.ascii_lowercase + '_$'
|
chars = string.digits + string.ascii_uppercase + string.ascii_lowercase + '_$'
|
||||||
|
|
||||||
|
|
||||||
def compress(g):
|
def compress(g):
|
||||||
bs = [int(g[i:i+2], 16) for i in range(0, len(g), 2)]
|
bs = [int(g[i:i + 2], 16) for i in range(0, len(g), 2)]
|
||||||
|
|
||||||
def b64(v, l=4):
|
def b64(v, l=4):
|
||||||
return ''.join([chars[(v // (64**i))%64] for i in range(l)][::-1])
|
return ''.join([chars[(v // (64**i)) % 64] for i in range(l)][::-1])
|
||||||
return ''.join([b64(bs[0], 2)] + [b64((bs[i] << 16) + (bs[i+1] << 8) + bs[i+2]) for i in range(1,16,3)])
|
return ''.join([b64(bs[0], 2)] + [b64((bs[i] << 16) + (bs[i + 1] << 8) + bs[i + 2]) for i in range(1, 16, 3)])
|
||||||
|
|
||||||
|
|
||||||
def expand(g):
|
def expand(g):
|
||||||
def b64(v):
|
def b64(v):
|
||||||
return reduce(lambda a, b: a * 64 + b, map(lambda c: chars.index(c), v))
|
return reduce(lambda a, b: a * 64 + b, map(lambda c: chars.index(c), v))
|
||||||
bs = [b64(g[0:2])]
|
bs = [b64(g[0:2])]
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
d = b64(g[2+4*i:6+4*i])
|
d = b64(g[2 + 4 * i:6 + 4 * i])
|
||||||
bs += [(d >> (8*(2-j)))%256 for j in range(3)]
|
bs += [(d >> (8 * (2 - j))) % 256 for j in range(3)]
|
||||||
return ''.join(['%02x'%b for b in bs])
|
return ''.join(['%02x' % b for b in bs])
|
||||||
|
|
||||||
|
|
||||||
def split(g):
|
def split(g):
|
||||||
return '{%s-%s-%s-%s-%s}'%(g[:8], g[8:12], g[12:16], g[16:20], g[20:])
|
return '{%s-%s-%s-%s-%s}' % (g[:8], g[8:12], g[12:16], g[16:20], g[20:])
|
||||||
|
|
||||||
|
|
||||||
def new():
|
def new():
|
||||||
return compress(uuid.uuid4().hex)
|
return compress(uuid.uuid4().hex)
|
||||||
|
|||||||
@@ -70,11 +70,13 @@ DEFAULTS = {
|
|||||||
"timestring": lambda d: time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(d.get('timestamp') or time.time()))
|
"timestring": lambda d: time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(d.get('timestamp') or time.time()))
|
||||||
}
|
}
|
||||||
|
|
||||||
def create(filename=None, timestring=None, organization=None, creator=None,\
|
|
||||||
schema_identifier=None, application_version=None, timestamp=None,\
|
def create(filename=None, timestring=None, organization=None, creator=None,
|
||||||
|
schema_identifier=None, application_version=None, timestamp=None,
|
||||||
application=None, project_globalid=None, project_name=None):
|
application=None, project_globalid=None, project_name=None):
|
||||||
|
|
||||||
d = dict(locals())
|
d = dict(locals())
|
||||||
|
|
||||||
def _():
|
def _():
|
||||||
for var, value in d.items():
|
for var, value in d.items():
|
||||||
if value is None:
|
if value is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user