mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 10:52:45 +00:00
Prioritise editing rendering surface styles over shading surface styles
This commit is contained in:
@@ -16,15 +16,12 @@
|
||||
# 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.address_editor import AddressEditor
|
||||
from blenderbim.tool.aggregator import Aggregator
|
||||
from blenderbim.tool.aggregate import Aggregate
|
||||
from blenderbim.tool.blender import Blender
|
||||
from blenderbim.tool.collector import Collector
|
||||
from blenderbim.tool.container import Container
|
||||
from blenderbim.tool.context_editor import ContextEditor
|
||||
from blenderbim.tool.context import Context
|
||||
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.style import Style
|
||||
from blenderbim.tool.surveyor import Surveyor
|
||||
|
||||
@@ -1,108 +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 bpy
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.bim.helper
|
||||
import blenderbim.tool as tool
|
||||
|
||||
|
||||
class AddressEditor(blenderbim.core.tool.AddressEditor):
|
||||
@classmethod
|
||||
def set_address(cls, address):
|
||||
bpy.context.scene.BIMOwnerProperties.active_address_id = address.id()
|
||||
|
||||
@classmethod
|
||||
def import_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.address_attributes.clear()
|
||||
props.address_lines.clear()
|
||||
props.telephone_numbers.clear()
|
||||
props.facsimile_numbers.clear()
|
||||
props.electronic_mail_addresses.clear()
|
||||
props.messaging_ids.clear()
|
||||
|
||||
address = cls.get_address()
|
||||
|
||||
def callback(name, prop, data):
|
||||
if name == "AddressLines":
|
||||
for line in data[name] or []:
|
||||
props.address_lines.add().name = line
|
||||
elif name == "TelephoneNumbers":
|
||||
for line in data[name] or []:
|
||||
props.telephone_numbers.add().name = line
|
||||
elif name == "FacsimileNumbers":
|
||||
for line in data[name] or []:
|
||||
props.facsimile_numbers.add().name = line
|
||||
elif name == "ElectronicMailAddresses":
|
||||
for line in data[name] or []:
|
||||
props.electronic_mail_addresses.add().name = line
|
||||
elif name == "MessagingIDs":
|
||||
for line in data[name] or []:
|
||||
props.messaging_ids.add().name = line
|
||||
|
||||
blenderbim.bim.helper.import_attributes(address.is_a(), props.address_attributes, address.get_info(), callback)
|
||||
|
||||
@classmethod
|
||||
def clear_address(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_address_id = 0
|
||||
|
||||
@classmethod
|
||||
def get_address(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_address_id)
|
||||
|
||||
@classmethod
|
||||
def export_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
attributes = blenderbim.bim.helper.export_attributes(props.address_attributes)
|
||||
if cls.get_address().is_a("IfcPostalAddress"):
|
||||
attributes["AddressLines"] = [l.name for l in props.address_lines] or None
|
||||
elif cls.get_address().is_a("IfcTelecomAddress"):
|
||||
attributes["TelephoneNumbers"] = [l.name for l in props.telephone_numbers] or None
|
||||
attributes["FacsimileNumbers"] = [l.name for l in props.facsimile_numbers] or None
|
||||
attributes["ElectronicMailAddresses"] = [l.name for l in props.electronic_mail_addresses] or None
|
||||
attributes["MessagingIDs"] = [l.name for l in props.messaging_ids] or None
|
||||
return attributes
|
||||
|
||||
@classmethod
|
||||
def add_attribute(cls, name):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
if name == "AddressLines":
|
||||
props.address_lines.add()
|
||||
elif name == "TelephoneNumbers":
|
||||
props.telephone_numbers.add()
|
||||
elif name == "FacsimileNumbers":
|
||||
props.facsimile_numbers.add()
|
||||
elif name == "ElectronicMailAddresses":
|
||||
props.electronic_mail_addresses.add()
|
||||
elif name == "MessagingIDs":
|
||||
props.messaging_ids.add()
|
||||
|
||||
@classmethod
|
||||
def remove_attribute(cls, name, id):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
if name == "AddressLines":
|
||||
props.address_lines.remove(id)
|
||||
elif name == "TelephoneNumbers":
|
||||
props.telephone_numbers.remove(id)
|
||||
elif name == "FacsimileNumbers":
|
||||
props.facsimile_numbers.remove(id)
|
||||
elif name == "ElectronicMailAddresses":
|
||||
props.electronic_mail_addresses.remove(id)
|
||||
elif name == "MessagingIDs":
|
||||
props.messaging_ids.remove(id)
|
||||
+19
-1
@@ -1,8 +1,26 @@
|
||||
# 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 blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
|
||||
|
||||
class Aggregator(blenderbim.core.tool.Aggregator):
|
||||
class Aggregate(blenderbim.core.tool.Aggregate):
|
||||
@classmethod
|
||||
def enable_editing(cls, obj):
|
||||
obj.BIMObjectAggregateProperties.is_editing = True
|
||||
+1
-1
@@ -22,7 +22,7 @@ import blenderbim.tool as tool
|
||||
import blenderbim.core.tool
|
||||
|
||||
|
||||
class ContextEditor(blenderbim.core.tool.ContextEditor):
|
||||
class Context(blenderbim.core.tool.Context):
|
||||
@classmethod
|
||||
def set_context(cls, context):
|
||||
bpy.context.scene.BIMContextProperties.active_context_id = context.id()
|
||||
@@ -1,53 +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 bpy
|
||||
import ifcopenshell.api
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.bim.helper
|
||||
import blenderbim.tool as tool
|
||||
|
||||
|
||||
class OrganisationEditor(blenderbim.core.tool.OrganisationEditor):
|
||||
@classmethod
|
||||
def set_organisation(cls, organisation):
|
||||
bpy.context.scene.BIMOwnerProperties.active_organisation_id = organisation.id()
|
||||
|
||||
@classmethod
|
||||
def import_attributes(cls):
|
||||
organisation = tool.Ifc.get().by_id(bpy.context.scene.BIMOwnerProperties.active_organisation_id)
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.organisation_attributes.clear()
|
||||
|
||||
blenderbim.bim.helper.import_attributes(
|
||||
"IfcOrganization", props.organisation_attributes, organisation.get_info()
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def clear_organisation(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_organisation_id = 0
|
||||
|
||||
@classmethod
|
||||
def export_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
attributes = blenderbim.bim.helper.export_attributes(props.organisation_attributes)
|
||||
return attributes
|
||||
|
||||
@classmethod
|
||||
def get_organisation(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_organisation_id)
|
||||
@@ -34,3 +34,199 @@ class Owner(blenderbim.core.tool.Owner):
|
||||
@classmethod
|
||||
def clear_user(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_user_id = 0
|
||||
|
||||
@classmethod
|
||||
def set_address(cls, address):
|
||||
bpy.context.scene.BIMOwnerProperties.active_address_id = address.id()
|
||||
|
||||
@classmethod
|
||||
def import_address_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.address_attributes.clear()
|
||||
props.address_lines.clear()
|
||||
props.telephone_numbers.clear()
|
||||
props.facsimile_numbers.clear()
|
||||
props.electronic_mail_addresses.clear()
|
||||
props.messaging_ids.clear()
|
||||
|
||||
address = cls.get_address()
|
||||
|
||||
def callback(name, prop, data):
|
||||
if name == "AddressLines":
|
||||
for line in data[name] or []:
|
||||
props.address_lines.add().name = line
|
||||
elif name == "TelephoneNumbers":
|
||||
for line in data[name] or []:
|
||||
props.telephone_numbers.add().name = line
|
||||
elif name == "FacsimileNumbers":
|
||||
for line in data[name] or []:
|
||||
props.facsimile_numbers.add().name = line
|
||||
elif name == "ElectronicMailAddresses":
|
||||
for line in data[name] or []:
|
||||
props.electronic_mail_addresses.add().name = line
|
||||
elif name == "MessagingIDs":
|
||||
for line in data[name] or []:
|
||||
props.messaging_ids.add().name = line
|
||||
|
||||
blenderbim.bim.helper.import_attributes(address.is_a(), props.address_attributes, address.get_info(), callback)
|
||||
|
||||
@classmethod
|
||||
def clear_address(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_address_id = 0
|
||||
|
||||
@classmethod
|
||||
def get_address(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_address_id)
|
||||
|
||||
@classmethod
|
||||
def export_address_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
attributes = blenderbim.bim.helper.export_attributes(props.address_attributes)
|
||||
if cls.get_address().is_a("IfcPostalAddress"):
|
||||
attributes["AddressLines"] = [l.name for l in props.address_lines] or None
|
||||
elif cls.get_address().is_a("IfcTelecomAddress"):
|
||||
attributes["TelephoneNumbers"] = [l.name for l in props.telephone_numbers] or None
|
||||
attributes["FacsimileNumbers"] = [l.name for l in props.facsimile_numbers] or None
|
||||
attributes["ElectronicMailAddresses"] = [l.name for l in props.electronic_mail_addresses] or None
|
||||
attributes["MessagingIDs"] = [l.name for l in props.messaging_ids] or None
|
||||
return attributes
|
||||
|
||||
@classmethod
|
||||
def add_address_attribute(cls, name):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
if name == "AddressLines":
|
||||
props.address_lines.add()
|
||||
elif name == "TelephoneNumbers":
|
||||
props.telephone_numbers.add()
|
||||
elif name == "FacsimileNumbers":
|
||||
props.facsimile_numbers.add()
|
||||
elif name == "ElectronicMailAddresses":
|
||||
props.electronic_mail_addresses.add()
|
||||
elif name == "MessagingIDs":
|
||||
props.messaging_ids.add()
|
||||
|
||||
@classmethod
|
||||
def remove_address_attribute(cls, name, id):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
if name == "AddressLines":
|
||||
props.address_lines.remove(id)
|
||||
elif name == "TelephoneNumbers":
|
||||
props.telephone_numbers.remove(id)
|
||||
elif name == "FacsimileNumbers":
|
||||
props.facsimile_numbers.remove(id)
|
||||
elif name == "ElectronicMailAddresses":
|
||||
props.electronic_mail_addresses.remove(id)
|
||||
elif name == "MessagingIDs":
|
||||
props.messaging_ids.remove(id)
|
||||
|
||||
@classmethod
|
||||
def set_organisation(cls, organisation):
|
||||
bpy.context.scene.BIMOwnerProperties.active_organisation_id = organisation.id()
|
||||
|
||||
@classmethod
|
||||
def import_organisation_attributes(cls):
|
||||
organisation = tool.Ifc.get().by_id(bpy.context.scene.BIMOwnerProperties.active_organisation_id)
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.organisation_attributes.clear()
|
||||
|
||||
blenderbim.bim.helper.import_attributes(
|
||||
"IfcOrganization", props.organisation_attributes, organisation.get_info()
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def clear_organisation(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_organisation_id = 0
|
||||
|
||||
@classmethod
|
||||
def export_organisation_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
attributes = blenderbim.bim.helper.export_attributes(props.organisation_attributes)
|
||||
return attributes
|
||||
|
||||
@classmethod
|
||||
def get_organisation(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_organisation_id)
|
||||
|
||||
@classmethod
|
||||
def set_person(cls, person):
|
||||
bpy.context.scene.BIMOwnerProperties.active_person_id = person.id()
|
||||
|
||||
@classmethod
|
||||
def import_person_attributes(cls):
|
||||
person = tool.Ifc.get().by_id(bpy.context.scene.BIMOwnerProperties.active_person_id)
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.person_attributes.clear()
|
||||
props.middle_names.clear()
|
||||
props.prefix_titles.clear()
|
||||
props.suffix_titles.clear()
|
||||
|
||||
def callback(name, prop, data):
|
||||
if name == "MiddleNames":
|
||||
for name in data["MiddleNames"] or []:
|
||||
props.middle_names.add().name = name or ""
|
||||
if name == "PrefixTitles":
|
||||
for name in data["PrefixTitles"] or []:
|
||||
props.prefix_titles.add().name = name or ""
|
||||
if name == "SuffixTitles":
|
||||
for name in data["SuffixTitles"] or []:
|
||||
props.suffix_titles.add().name = name or ""
|
||||
|
||||
blenderbim.bim.helper.import_attributes("IfcPerson", props.person_attributes, person.get_info(), callback)
|
||||
|
||||
@classmethod
|
||||
def clear_person(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_person_id = 0
|
||||
|
||||
@classmethod
|
||||
def export_person_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
attributes = blenderbim.bim.helper.export_attributes(props.person_attributes)
|
||||
attributes["MiddleNames"] = [v.name for v in props.middle_names] if props.middle_names else None
|
||||
attributes["PrefixTitles"] = [v.name for v in props.prefix_titles] if props.prefix_titles else None
|
||||
attributes["SuffixTitles"] = [v.name for v in props.suffix_titles] if props.suffix_titles else None
|
||||
return attributes
|
||||
|
||||
@classmethod
|
||||
def get_person(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_person_id)
|
||||
|
||||
@classmethod
|
||||
def add_person_attribute(cls, name):
|
||||
if name == "MiddleNames":
|
||||
bpy.context.scene.BIMOwnerProperties.middle_names.add()
|
||||
elif name == "PrefixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.prefix_titles.add()
|
||||
elif name == "SuffixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.suffix_titles.add()
|
||||
|
||||
@classmethod
|
||||
def remove_person_attribute(cls, name, id):
|
||||
if name == "MiddleNames":
|
||||
bpy.context.scene.BIMOwnerProperties.middle_names.remove(id)
|
||||
elif name == "PrefixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.prefix_titles.remove(id)
|
||||
elif name == "SuffixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.suffix_titles.remove(id)
|
||||
|
||||
@classmethod
|
||||
def set_role(cls, role):
|
||||
bpy.context.scene.BIMOwnerProperties.active_role_id = role.id()
|
||||
|
||||
@classmethod
|
||||
def import_role_attributes(cls):
|
||||
role = cls.get_role()
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.role_attributes.clear()
|
||||
blenderbim.bim.helper.import_attributes("IfcActorRole", props.role_attributes, role.get_info())
|
||||
|
||||
@classmethod
|
||||
def clear_role(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_role_id = 0
|
||||
|
||||
@classmethod
|
||||
def get_role(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_role_id)
|
||||
|
||||
@classmethod
|
||||
def export_role_attributes(cls):
|
||||
return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMOwnerProperties.role_attributes)
|
||||
|
||||
@@ -1,86 +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 bpy
|
||||
import ifcopenshell.api
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.bim.helper
|
||||
import blenderbim.tool as tool
|
||||
|
||||
|
||||
class PersonEditor(blenderbim.core.tool.PersonEditor):
|
||||
@classmethod
|
||||
def set_person(cls, person):
|
||||
bpy.context.scene.BIMOwnerProperties.active_person_id = person.id()
|
||||
|
||||
@classmethod
|
||||
def import_attributes(cls):
|
||||
person = tool.Ifc.get().by_id(bpy.context.scene.BIMOwnerProperties.active_person_id)
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.person_attributes.clear()
|
||||
props.middle_names.clear()
|
||||
props.prefix_titles.clear()
|
||||
props.suffix_titles.clear()
|
||||
|
||||
def callback(name, prop, data):
|
||||
if name == "MiddleNames":
|
||||
for name in data["MiddleNames"] or []:
|
||||
props.middle_names.add().name = name or ""
|
||||
if name == "PrefixTitles":
|
||||
for name in data["PrefixTitles"] or []:
|
||||
props.prefix_titles.add().name = name or ""
|
||||
if name == "SuffixTitles":
|
||||
for name in data["SuffixTitles"] or []:
|
||||
props.suffix_titles.add().name = name or ""
|
||||
|
||||
blenderbim.bim.helper.import_attributes("IfcPerson", props.person_attributes, person.get_info(), callback)
|
||||
|
||||
@classmethod
|
||||
def clear_person(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_person_id = 0
|
||||
|
||||
@classmethod
|
||||
def export_attributes(cls):
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
attributes = blenderbim.bim.helper.export_attributes(props.person_attributes)
|
||||
attributes["MiddleNames"] = [v.name for v in props.middle_names] if props.middle_names else None
|
||||
attributes["PrefixTitles"] = [v.name for v in props.prefix_titles] if props.prefix_titles else None
|
||||
attributes["SuffixTitles"] = [v.name for v in props.suffix_titles] if props.suffix_titles else None
|
||||
return attributes
|
||||
|
||||
@classmethod
|
||||
def get_person(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_person_id)
|
||||
|
||||
@classmethod
|
||||
def add_attribute(cls, name):
|
||||
if name == "MiddleNames":
|
||||
bpy.context.scene.BIMOwnerProperties.middle_names.add()
|
||||
elif name == "PrefixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.prefix_titles.add()
|
||||
elif name == "SuffixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.suffix_titles.add()
|
||||
|
||||
@classmethod
|
||||
def remove_attribute(cls, name, id):
|
||||
if name == "MiddleNames":
|
||||
bpy.context.scene.BIMOwnerProperties.middle_names.remove(id)
|
||||
elif name == "PrefixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.prefix_titles.remove(id)
|
||||
elif name == "SuffixTitles":
|
||||
bpy.context.scene.BIMOwnerProperties.suffix_titles.remove(id)
|
||||
@@ -1,47 +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 bpy
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.bim.helper
|
||||
|
||||
|
||||
class RoleEditor(blenderbim.core.tool.RoleEditor):
|
||||
@classmethod
|
||||
def set_role(cls, role):
|
||||
bpy.context.scene.BIMOwnerProperties.active_role_id = role.id()
|
||||
|
||||
@classmethod
|
||||
def import_attributes(cls):
|
||||
role = cls.get_role()
|
||||
props = bpy.context.scene.BIMOwnerProperties
|
||||
props.role_attributes.clear()
|
||||
blenderbim.bim.helper.import_attributes("IfcActorRole", props.role_attributes, role.get_info())
|
||||
|
||||
@classmethod
|
||||
def clear_role(cls):
|
||||
bpy.context.scene.BIMOwnerProperties.active_role_id = 0
|
||||
|
||||
@classmethod
|
||||
def get_role(cls):
|
||||
return tool.Ifc().get().by_id(bpy.context.scene.BIMOwnerProperties.active_role_id)
|
||||
|
||||
@classmethod
|
||||
def export_attributes(cls):
|
||||
return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMOwnerProperties.role_attributes)
|
||||
@@ -0,0 +1,114 @@
|
||||
# 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 ifcopenshell
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.bim.helper
|
||||
|
||||
|
||||
class Style(blenderbim.core.tool.Style):
|
||||
@classmethod
|
||||
def disable_editing(cls, obj):
|
||||
obj.BIMStyleProperties.is_editing = False
|
||||
|
||||
@classmethod
|
||||
def enable_editing(cls, obj):
|
||||
obj.BIMStyleProperties.is_editing = True
|
||||
|
||||
@classmethod
|
||||
def export_surface_attributes(cls, obj):
|
||||
return blenderbim.bim.helper.export_attributes(obj.BIMStyleProperties.attributes)
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, obj):
|
||||
return ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
|
||||
|
||||
@classmethod
|
||||
def get_name(cls, obj):
|
||||
return obj.name
|
||||
|
||||
@classmethod
|
||||
def get_style(cls, obj):
|
||||
if obj.BIMMaterialProperties.ifc_style_id:
|
||||
return tool.Ifc.get().by_id(obj.BIMMaterialProperties.ifc_style_id)
|
||||
|
||||
@classmethod
|
||||
def get_surface_rendering_attributes(cls, obj):
|
||||
transparency = obj.diffuse_color[3]
|
||||
diffuse_colour = obj.diffuse_color
|
||||
if obj.use_nodes and hasattr(obj.node_tree, "nodes") and "Principled BSDF" in obj.node_tree.nodes:
|
||||
bsdf = obj.node_tree.nodes["Principled BSDF"]
|
||||
transparency = bsdf.inputs["Alpha"].default_value
|
||||
diffuse_colour = bsdf.inputs["Base Color"].default_value
|
||||
transparency = 1 - transparency
|
||||
return {
|
||||
"SurfaceColour": {
|
||||
"Name": None,
|
||||
"Red": obj.diffuse_color[0],
|
||||
"Green": obj.diffuse_color[1],
|
||||
"Blue": obj.diffuse_color[2],
|
||||
},
|
||||
"Transparency": transparency,
|
||||
"DiffuseColour": {
|
||||
"Name": None,
|
||||
"Red": obj.diffuse_color[0],
|
||||
"Green": obj.diffuse_color[1],
|
||||
"Blue": obj.diffuse_color[2],
|
||||
},
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_surface_rendering_style(cls, obj):
|
||||
if obj.BIMMaterialProperties.ifc_style_id:
|
||||
style = tool.Ifc.get().by_id(obj.BIMMaterialProperties.ifc_style_id)
|
||||
items = [s for s in style.Styles if s.is_a("IfcSurfaceStyleRendering")]
|
||||
if items:
|
||||
return items[0]
|
||||
|
||||
@classmethod
|
||||
def get_surface_shading_attributes(cls, obj):
|
||||
return {
|
||||
"SurfaceColour": {
|
||||
"Name": None,
|
||||
"Red": obj.diffuse_color[0],
|
||||
"Green": obj.diffuse_color[1],
|
||||
"Blue": obj.diffuse_color[2],
|
||||
},
|
||||
"Transparency": 1 - obj.diffuse_color[3],
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_surface_shading_style(cls, obj):
|
||||
if obj.BIMMaterialProperties.ifc_style_id:
|
||||
style = tool.Ifc.get().by_id(obj.BIMMaterialProperties.ifc_style_id)
|
||||
items = [s for s in style.Styles if s.is_a("IfcSurfaceStyleShading")]
|
||||
if items:
|
||||
return items[0]
|
||||
|
||||
@classmethod
|
||||
def import_surface_attributes(cls, style, obj):
|
||||
blenderbim.bim.helper.import_attributes2(style, obj.BIMStyleProperties.attributes)
|
||||
|
||||
@classmethod
|
||||
def link(cls, style, obj):
|
||||
obj.BIMMaterialProperties.ifc_style_id = style.id()
|
||||
|
||||
@classmethod
|
||||
def unlink(self, obj):
|
||||
obj.BIMMaterialProperties.ifc_style_id = 0
|
||||
Reference in New Issue
Block a user