feat: skipping lines, arcs and circles

This commit is contained in:
Björn Steinhagen
2025-02-09 23:17:35 +01:00
parent 25bd0093af
commit 9ca9a1910b
3 changed files with 20 additions and 11 deletions
+10 -9
View File
@@ -52,7 +52,16 @@ def automate_function(
model_root = automate_context.receive_version() # TODO: Line 35 and 36!?
processor.process_elements(model_root)
# Report compliance issues
# Logger information - successes
logger_successes = logger.get_successful_summary()
if logger_successes:
automate_context.attach_success_to_objects(
category="Successfully Processed",
object_ids=logger_successes,
message="Carbon calculations completed successfully for this element.",
)
# Logger information - warnings
logger_warnings = logger.get_warnings_summary()
if logger_warnings:
for missing_property, elements in logger_warnings.items():
@@ -66,14 +75,6 @@ def automate_function(
),
)
logger_successes = logger.get_successful_summary()
if logger_successes:
automate_context.attach_success_to_objects(
category="Successfully Processed",
object_ids=logger_successes,
message="Carbon calculations completed successfully for this element.",
)
# TODO: Create new version
# automate_context.create_new_version_in_project(model_root, "dev", "")
+7 -2
View File
@@ -4,7 +4,9 @@ from src.interfaces.material_processor import MaterialProcessor
from src.interfaces.compliance_checker import ComplianceChecker
from src.interfaces.logger import Logger
from src.utils.constants import (
APPLICATION_ID,
LINE,
ARC,
CIRCLE,
ELEMENTS,
NAME,
PROPERTIES,
@@ -73,7 +75,10 @@ class RevitModelProcessor(ModelProcessor):
def process_element(self, level: str, type_name: str, revit_object: Any) -> None:
"""Process a single element following original logic exactly"""
# TODO: We can probably straight up skip Line and Arc. Logging it as a warning is dumb
# We can probably straight up skip Line and Arc. Logging it as a warning is dumb
speckle_type = getattr(revit_object, SPECKLE_TYPE, None)
if speckle_type in [LINE, ARC, CIRCLE]:
return # TODO: Possibly add to logger for info? Not a warning though.
element_id = getattr(revit_object, ID, None)
if not element_id:
+3
View File
@@ -2,9 +2,12 @@ REQUIRED_PROPERTIES = ["volume", "density", "structuralAsset"]
# Keys
APPLICATION_ID = "applicationId"
ARC = "Objects.Geometry.Arc"
CIRCLE = "Objects.Geometry.Circle"
DENSITY = "density"
ELEMENTS = "elements"
ID = "id"
LINE = "Objects.Geometry.Line"
MASS = "mass"
MATERIAL_QUANTITIES = "Material Quantities"
NAME = "name"