updating a duration will not auto update schedule usage

This commit is contained in:
Sigma Dimensions (Yass)
2023-08-24 15:51:33 +01:00
parent dd02925cc4
commit a29ae07b72
15 changed files with 60 additions and 53 deletions
@@ -20,10 +20,9 @@
def get_constraints(product):
constraints = []
if product.HasAssociations:
for rel in product.HasAssociations:
if rel.is_a("IfcRelAssociatesConstraint"):
constraints.append(rel.RelatingConstraint)
for rel in product.HasAssociations or []:
if rel.is_a("IfcRelAssociatesConstraint"):
constraints.append(rel.RelatingConstraint)
return constraints
def get_metrics(constraint):
@@ -48,7 +47,7 @@ def get_metric_reference(metric, is_deep=True):
reference = metric.ReferencePath
return get_reference_Attribute(reference, "")
def has_metric_constraints(resource, attribute):
def get_metric_constraints(resource, attribute):
metrics = []
for constraint in get_constraints(resource) or []:
for metric in get_metrics(constraint) or []:
@@ -59,4 +58,18 @@ def has_metric_constraints(resource, attribute):
metrics.append(metric)
if metrics:
return metrics
return None
return None
def is_hard_constraint(metric):
if metric.ConstraintGrade == "HARD" and metric.Benchmark == "EQUALTO":
return True
def is_attribute_locked(product, attribute):
is_locked = False
metrics = get_metric_constraints(
product, attribute
)
for metric in metrics or []:
if is_hard_constraint(metric):
is_locked = True
return is_locked
@@ -114,4 +114,4 @@ def get_resource_required_work(resource):
return iso_string
def get_nested_resources(resource):
return [object for rel in resource.IsNestedBy or [] for object in rel.RelatedObjects]
return [object for rel in resource.IsNestedBy or [] for object in rel.RelatedObjects]