mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Unlinking elements is now a bit more stable. Also simplify core tool namespace.
This commit is contained in:
@@ -202,6 +202,14 @@ class IfcStore:
|
||||
except:
|
||||
pass
|
||||
|
||||
if obj is None:
|
||||
try:
|
||||
potential_obj = IfcStore.id_map[element.id()]
|
||||
potential_obj.name
|
||||
obj = potential_obj
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
if element:
|
||||
del IfcStore.id_map[element.id()]
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class AddressEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_address(cls, address):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_address(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_address(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def add_attribute(cls, name):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def remove_attribute(cls, name, id):
|
||||
pass
|
||||
|
||||
|
||||
class Blender(abc.ABC):
|
||||
pass
|
||||
|
||||
|
||||
class Collector(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def assign(cls, obj):
|
||||
pass
|
||||
|
||||
|
||||
class Container(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def can_contain(cls, structure_obj, element_obj):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def enable_editing(cls, obj):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def disable_editing(cls, obj):
|
||||
pass
|
||||
|
||||
|
||||
class ContextEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_context(cls, context):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_context(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_context(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
|
||||
|
||||
class Ifc(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def run(cls, command, **kwargs):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_entity(cls, obj):
|
||||
pass
|
||||
|
||||
|
||||
class OrganisationEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_organisation(cls, organisation):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_organisation(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_organisation(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
|
||||
|
||||
class Owner(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_user(cls, user):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_user(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_user(cls):
|
||||
pass
|
||||
|
||||
|
||||
class PersonEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_person(cls, person):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_person(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_person(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def add_attribute(cls, name):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def remove_attribute(cls, name, id):
|
||||
pass
|
||||
|
||||
|
||||
class RoleEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_role(cls, role):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_role(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_role(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
|
||||
|
||||
class Selector(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_active(cls, obj):
|
||||
pass
|
||||
|
||||
|
||||
class Surveyor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_absolute_matrix(cls, obj):
|
||||
pass
|
||||
|
||||
|
||||
class Voider(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def can_void(cls, opening, element):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def void(cls, opening_obj, building_obj):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def unvoid(cls, opening_obj):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_void_display(cls, opening_obj):
|
||||
pass
|
||||
@@ -1,27 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from blenderbim.core.tool.ifc import Ifc
|
||||
from blenderbim.core.tool.blender import Blender
|
||||
from blenderbim.core.tool.person_editor import PersonEditor
|
||||
from blenderbim.core.tool.role_editor import RoleEditor
|
||||
from blenderbim.core.tool.address_editor import AddressEditor
|
||||
from blenderbim.core.tool.organisation_editor import OrganisationEditor
|
||||
from blenderbim.core.tool.context_editor import ContextEditor
|
||||
from blenderbim.core.tool.owner import Owner
|
||||
from blenderbim.core.tool.surveyor import Surveyor
|
||||
@@ -1,56 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class AddressEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_address(cls, address):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_address(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_address(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def add_attribute(cls, name):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def remove_attribute(cls, name, id):
|
||||
pass
|
||||
@@ -1,23 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class Blender(abc.ABC):
|
||||
pass
|
||||
@@ -1,46 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class ContextEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_context(cls, context):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_context(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_context(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
@@ -1,31 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class Ifc(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def run(cls, command, **kwargs):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_entity(cls, obj):
|
||||
pass
|
||||
@@ -1,46 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class OrganisationEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_organisation(cls, organisation):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_organisation(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_organisation(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
@@ -1,18 +0,0 @@
|
||||
import abc
|
||||
|
||||
|
||||
class Owner(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_user(cls, user):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_user(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_user(cls):
|
||||
pass
|
||||
@@ -1,56 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class PersonEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_person(cls, person):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_person(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_person(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def add_attribute(cls, name):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def remove_attribute(cls, name, id):
|
||||
pass
|
||||
@@ -1,46 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class RoleEditor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def set_role(cls, role):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def import_attributes(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def clear_role(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_role(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def export_attributes(cls):
|
||||
pass
|
||||
@@ -1,8 +0,0 @@
|
||||
import abc
|
||||
|
||||
|
||||
class Surveyor(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def get_absolute_matrix(cls, obj):
|
||||
pass
|
||||
@@ -16,12 +16,13 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from blenderbim.tool.ifc import Ifc
|
||||
from blenderbim.tool.address_editor import AddressEditor
|
||||
from blenderbim.tool.blender import Blender
|
||||
from blenderbim.tool.context_editor import ContextEditor
|
||||
from blenderbim.tool.ifc import Ifc
|
||||
from blenderbim.tool.organisation_editor import OrganisationEditor
|
||||
from blenderbim.tool.owner import Owner
|
||||
from blenderbim.tool.person_editor import PersonEditor
|
||||
from blenderbim.tool.role_editor import RoleEditor
|
||||
from blenderbim.tool.address_editor import AddressEditor
|
||||
from blenderbim.tool.organisation_editor import OrganisationEditor
|
||||
from blenderbim.tool.context_editor import ContextEditor
|
||||
from blenderbim.tool.owner import Owner
|
||||
from blenderbim.tool.surveyor import Surveyor
|
||||
from blenderbim.tool.container import Container
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
import bpy
|
||||
import blenderbim.bim.helper
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.core.tool.context_editor
|
||||
import blenderbim.core.tool
|
||||
|
||||
|
||||
class ContextEditor(blenderbim.core.tool.context_editor.ContextEditor):
|
||||
class ContextEditor(blenderbim.core.tool.ContextEditor):
|
||||
@classmethod
|
||||
def set_context(cls, context):
|
||||
bpy.context.scene.BIMContextProperties.active_context_id = context.id()
|
||||
|
||||
@@ -22,7 +22,7 @@ import blenderbim.core.tool
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
|
||||
class Ifc(blenderbim.core.tool.ifc.Ifc):
|
||||
class Ifc(blenderbim.core.tool.Ifc):
|
||||
@classmethod
|
||||
def run(cls, command, **kwargs):
|
||||
return ifcopenshell.api.run(command, IfcStore.get_file(), **kwargs)
|
||||
@@ -48,3 +48,15 @@ class Ifc(blenderbim.core.tool.ifc.Ifc):
|
||||
return IfcStore.get_file().by_id(props.ifc_definition_id)
|
||||
except:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def get_object(cls, element):
|
||||
return IfcStore.get_element(element.id())
|
||||
|
||||
@classmethod
|
||||
def link(cls, element, obj):
|
||||
IfcStore.link_element(element, obj)
|
||||
|
||||
@classmethod
|
||||
def unlink(cls, element=None, obj=None):
|
||||
IfcStore.unlink_element(element, obj)
|
||||
|
||||
@@ -23,7 +23,7 @@ import blenderbim.bim.helper
|
||||
import blenderbim.tool as tool
|
||||
|
||||
|
||||
class OrganisationEditor(blenderbim.core.tool.organisation_editor.OrganisationEditor):
|
||||
class OrganisationEditor(blenderbim.core.tool.OrganisationEditor):
|
||||
@classmethod
|
||||
def set_organisation(cls, organisation):
|
||||
bpy.context.scene.BIMOwnerProperties.active_organisation_id = organisation.id()
|
||||
|
||||
@@ -2,7 +2,7 @@ import bpy
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
|
||||
class Owner(blenderbim.core.tool.owner.Owner):
|
||||
class Owner(blenderbim.core.tool.Owner):
|
||||
@classmethod
|
||||
def set_user(cls, user):
|
||||
bpy.context.scene.BIMOwnerProperties.active_user_id = user.id()
|
||||
|
||||
@@ -23,7 +23,7 @@ import blenderbim.bim.helper
|
||||
import blenderbim.tool as tool
|
||||
|
||||
|
||||
class PersonEditor(blenderbim.core.tool.person_editor.PersonEditor):
|
||||
class PersonEditor(blenderbim.core.tool.PersonEditor):
|
||||
@classmethod
|
||||
def set_person(cls, person):
|
||||
bpy.context.scene.BIMOwnerProperties.active_person_id = person.id()
|
||||
|
||||
@@ -22,7 +22,7 @@ import blenderbim.tool as tool
|
||||
import blenderbim.bim.helper
|
||||
|
||||
|
||||
class RoleEditor(blenderbim.core.tool.role_editor.RoleEditor):
|
||||
class RoleEditor(blenderbim.core.tool.RoleEditor):
|
||||
@classmethod
|
||||
def set_role(cls, role):
|
||||
bpy.context.scene.BIMOwnerProperties.active_role_id = role.id()
|
||||
|
||||
@@ -5,7 +5,7 @@ import blenderbim.tool as tool
|
||||
import numpy as np
|
||||
|
||||
|
||||
class Surveyor(blenderbim.core.tool.surveyor.Surveyor):
|
||||
class Surveyor(blenderbim.core.tool.Surveyor):
|
||||
@classmethod
|
||||
def get_absolute_matrix(cls, obj):
|
||||
matrix = np.array(obj.matrix_world)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[pytest]
|
||||
markers =
|
||||
context
|
||||
geometry
|
||||
owner
|
||||
void
|
||||
|
||||
@@ -77,6 +77,20 @@ def owner():
|
||||
prophet.verify()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def voider():
|
||||
prophet = Prophecy(blenderbim.core.tool.Voider)
|
||||
yield prophet
|
||||
prophet.verify()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def selector():
|
||||
prophet = Prophecy(blenderbim.core.tool.Selector)
|
||||
yield prophet
|
||||
prophet.verify()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def surveyor():
|
||||
prophet = Prophecy(blenderbim.core.tool.Surveyor)
|
||||
@@ -84,6 +98,20 @@ def surveyor():
|
||||
prophet.verify()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def collector():
|
||||
prophet = Prophecy(blenderbim.core.tool.Collector)
|
||||
yield prophet
|
||||
prophet.verify()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def container():
|
||||
prophet = Prophecy(blenderbim.core.tool.Container)
|
||||
yield prophet
|
||||
prophet.verify()
|
||||
|
||||
|
||||
class Prophecy:
|
||||
def __init__(self, cls):
|
||||
self.subject = cls
|
||||
|
||||
@@ -26,7 +26,7 @@ from blenderbim.tool.context_editor import ContextEditor as subject
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.context_editor.ContextEditor)
|
||||
assert isinstance(subject(), blenderbim.core.tool.ContextEditor)
|
||||
|
||||
|
||||
class TestSetContext(test.bim.bootstrap.NewFile):
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import test.bim.bootstrap
|
||||
import blenderbim.core.tool.ifc
|
||||
from blenderbim.tool import Ifc as subject
|
||||
import blenderbim.core.tool
|
||||
from blenderbim.tool.ifc import Ifc as subject
|
||||
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.ifc.Ifc)
|
||||
assert isinstance(subject(), blenderbim.core.tool.Ifc)
|
||||
|
||||
|
||||
class TestSet(test.bim.bootstrap.NewFile):
|
||||
@@ -64,7 +64,7 @@ class TestGetSchema(test.bim.bootstrap.NewFile):
|
||||
assert subject.get_schema() == "IFC4"
|
||||
|
||||
|
||||
class TestGetElement(test.bim.bootstrap.NewFile):
|
||||
class TestGetEntity(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
subject.set(ifc)
|
||||
@@ -88,3 +88,56 @@ class TestGetElement(test.bim.bootstrap.NewFile):
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
obj.BIMObjectProperties.ifc_definition_id = 1
|
||||
assert subject.get_entity(obj) is None
|
||||
|
||||
|
||||
class TestGetObject(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
subject.set(ifc)
|
||||
element = ifc.createIfcWall()
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
subject.link(element, obj)
|
||||
assert subject.get_object(element) == obj
|
||||
|
||||
|
||||
class TestLink(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
subject.set(ifc)
|
||||
element = ifc.createIfcWall()
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
subject.link(element, obj)
|
||||
assert subject.get_entity(obj) == element
|
||||
assert subject.get_object(element) == obj
|
||||
|
||||
|
||||
class TestUnlink(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
subject.set(ifc)
|
||||
element = ifc.createIfcWall()
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
subject.link(element, obj)
|
||||
subject.unlink(element, obj)
|
||||
assert subject.get_entity(obj) is None
|
||||
assert subject.get_object(element) is None
|
||||
|
||||
def test_unlinking_using_an_object(self):
|
||||
ifc = ifcopenshell.file()
|
||||
subject.set(ifc)
|
||||
element = ifc.createIfcWall()
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
subject.link(element, obj)
|
||||
subject.unlink(obj=obj)
|
||||
assert subject.get_entity(obj) is None
|
||||
assert subject.get_object(element) is None
|
||||
|
||||
def test_unlinking_using_an_element(self):
|
||||
ifc = ifcopenshell.file()
|
||||
subject.set(ifc)
|
||||
element = ifc.createIfcWall()
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
subject.link(element, obj)
|
||||
subject.unlink(element=element)
|
||||
assert subject.get_entity(obj) is None
|
||||
assert subject.get_object(element) is None
|
||||
|
||||
@@ -26,7 +26,7 @@ from blenderbim.tool.organisation_editor import OrganisationEditor as subject
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.organisation_editor.OrganisationEditor)
|
||||
assert isinstance(subject(), blenderbim.core.tool.OrganisationEditor)
|
||||
|
||||
|
||||
class TestSetOrganisation(test.bim.bootstrap.NewFile):
|
||||
|
||||
@@ -8,7 +8,7 @@ from blenderbim.tool.owner import Owner as subject
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.owner.Owner)
|
||||
assert isinstance(subject(), blenderbim.core.tool.Owner)
|
||||
|
||||
|
||||
class TestSetUser(test.bim.bootstrap.NewFile):
|
||||
|
||||
@@ -26,7 +26,7 @@ from blenderbim.tool.person_editor import PersonEditor as subject
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.person_editor.PersonEditor)
|
||||
assert isinstance(subject(), blenderbim.core.tool.PersonEditor)
|
||||
|
||||
|
||||
class TestSetPerson(test.bim.bootstrap.NewFile):
|
||||
|
||||
@@ -26,7 +26,7 @@ from blenderbim.tool.role_editor import RoleEditor as subject
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.role_editor.RoleEditor)
|
||||
assert isinstance(subject(), blenderbim.core.tool.RoleEditor)
|
||||
|
||||
|
||||
class TestSetRole(test.bim.bootstrap.NewFile):
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import bpy
|
||||
import numpy as np
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import blenderbim.tool as tool
|
||||
|
||||
import test.bim.bootstrap
|
||||
import blenderbim.core.tool.surveyor
|
||||
import numpy as np
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
from blenderbim.tool import Surveyor as subject
|
||||
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.surveyor.Surveyor)
|
||||
assert isinstance(subject(), blenderbim.core.tool.Surveyor)
|
||||
|
||||
|
||||
class TestGetGlobalMatrix(test.bim.bootstrap.NewFile):
|
||||
|
||||
Reference in New Issue
Block a user