This commit is contained in:
Andrej730
2024-11-25 18:15:35 +05:00
parent fb70374876
commit 12c08b0697
7 changed files with 21 additions and 13 deletions
@@ -3036,6 +3036,8 @@ class EditSheet(bpy.types.Operator, tool.Ifc.Operator):
identification: bpy.props.StringProperty()
name: bpy.props.StringProperty()
document_type: Literal["SHEET", "TITLEBLOCK", "EMBEDDED"]
def invoke(self, context, event):
self.props = context.scene.DocProperties
sheet = tool.Ifc.get().by_id(self.props.sheets[self.props.active_sheet_index].ifc_definition_id)
@@ -610,7 +610,7 @@ class ShowBooleans(Operator, tool.Ifc.Operator, AddObjectHelper):
obj = context.active_object
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id)
booleans = []
booleans: list[ifcopenshell.entity_instance] = []
for item in representation.Items:
booleans.extend(self.get_booleans(item))
@@ -668,14 +668,14 @@ class ShowBooleans(Operator, tool.Ifc.Operator, AddObjectHelper):
DecorationsHandler.install(bpy.context)
return {"FINISHED"}
def get_booleans(self, item):
def get_booleans(self, item: ifcopenshell.entity_instance) -> list[ifcopenshell.entity_instance]:
results = []
if item.is_a("IfcBooleanResult"):
results.extend(self.get_booleans(item.FirstOperand))
results.append(item.SecondOperand)
return results
def create_half_space_solid(self):
def create_half_space_solid(self) -> bpy.types.Object:
bm = bmesh.new()
bmesh.ops.create_grid(bm, size=0.5)
bm.verts.ensure_lookup_table()
+5 -4
View File
@@ -18,6 +18,7 @@
import bpy
import bonsai.tool as tool
import ifctester.reporter
def refresh():
@@ -34,12 +35,12 @@ class TesterData:
cls.is_loaded = True
@classmethod
def has_report(cls):
return tool.Tester.report
def has_report(cls) -> bool:
return bool(tool.Tester.report)
@classmethod
def specification(cls):
def specification(cls) -> list[ifctester.reporter.ResultsSpecification]:
if not tool.Tester.report:
return {}
return []
props = bpy.context.scene.IfcTesterProperties
return tool.Tester.report[props.active_specification_index]
+2 -2
View File
@@ -164,7 +164,7 @@ class Collector(bonsai.core.tool.Collector):
pass
@classmethod
def set_layer_collection_visibility(cls, layer_collection):
def set_layer_collection_visibility(cls, layer_collection: bpy.types.LayerCollection) -> None:
name = layer_collection.collection.name
if name in (
"IfcTypeProduct",
@@ -178,7 +178,7 @@ class Collector(bonsai.core.tool.Collector):
layer_collection.hide_viewport = False
@classmethod
def reset_default_visibility(cls):
def reset_default_visibility(cls) -> None:
project = tool.Ifc.get_object(tool.Ifc.get().by_type("IfcProject")[0])
project_collection = project.BIMObjectProperties.collection
for layer_collection in bpy.context.view_layer.layer_collection.children:
+1
View File
@@ -490,6 +490,7 @@ class Model(bonsai.core.tool.Model):
@classmethod
def clear_scene_openings(cls) -> None:
"""Clear removed scene openings."""
props = bpy.context.scene.BIMModelProperties
has_deleted_opening = True
while has_deleted_opening:
+6 -2
View File
@@ -16,7 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import ifctester.ids
import ifctester.reporter
from typing import Union
class Tester:
specs = None
report = {}
specs: Union[ifctester.ids.Ids, None] = None
report: list[ifctester.reporter.ResultsSpecification] = []
@@ -20,7 +20,7 @@ import ifcopenshell
import ifcopenshell.guid
import ifcopenshell.util.element
import ifcopenshell.util.representation
from typing import Any, Callable, Optional, Union, Literal, overload
from typing import Any, Callable, Optional, Union, Literal, overload, Sequence
from collections import namedtuple
@@ -1518,7 +1518,7 @@ def copy(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) ->
def copy_deep(
ifc_file: ifcopenshell.file,
element: ifcopenshell.entity_instance,
exclude: Optional[list[str]] = None,
exclude: Optional[Sequence[str]] = None,
exclude_callback: Optional[Callable[[ifcopenshell.entity_instance], bool]] = None,
copied_entities: Optional[dict[int, ifcopenshell.entity_instance]] = None,
) -> ifcopenshell.entity_instance: