Skip to content

Commit e8e80b2

Browse files
committed
differentiate between upper and lower cracks
1 parent 639238f commit e8e80b2

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/compas_masonry/scene/formobject.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class RhinoFormDiagramObject(RUIMeshObject):
3737
compressioncolor = ColorAttribute(default=Color.blue())
3838
tensioncolor = ColorAttribute(default=Color.red())
3939

40-
crackcolor = ColorAttribute(default=Color.red())
40+
ecrackcolor = ColorAttribute(default=Color.green())
41+
icrackcolor = ColorAttribute(default=Color.blue())
42+
4143
boundscolor = ColorAttribute(default=Color.magenta())
4244

4345
def __init__(
@@ -493,10 +495,13 @@ def draw_bounds(self):
493495
if bound:
494496
name = self.vertex_bound_name(vertex)
495497
attr = self.compile_attributes(name=name, color=self.boundscolor)
498+
496499
guid = sc.doc.Objects.AddLine(compas_rhino.conversions.line_to_rhino(bound), attr)
497500
guids.append(guid)
501+
498502
guid = sc.doc.Objects.AddPoint(compas_rhino.conversions.point_to_rhino(bound.start), attr)
499503
guids.append(guid)
504+
500505
guid = sc.doc.Objects.AddPoint(compas_rhino.conversions.point_to_rhino(bound.end), attr)
501506
guids.append(guid)
502507

@@ -513,14 +518,20 @@ def draw_cracks(self):
513518
guids = []
514519

515520
for vertex in self.vertices():
516-
if self.vertex_is_on_lower_bound(vertex) or self.vertex_is_on_upper_bound(vertex):
517-
point = self.diagram.vertex_point(vertex)
518-
radius = self.session.settings.formdiagram.crack_radius
519-
sphere = Sphere(radius, point=point)
521+
if self.vertex_is_on_lower_bound(vertex):
520522
name = self.vertex_crack_name(vertex)
521-
attr = self.compile_attributes(name=name, color=self.crackcolor)
522-
guid = sc.doc.Objects.AddSphere(compas_rhino.conversions.sphere_to_rhino(sphere), attr)
523-
guids.append(guid)
523+
attr = self.compile_attributes(name=name, color=self.icrackcolor)
524+
elif self.vertex_is_on_upper_bound(vertex):
525+
name = self.vertex_crack_name(vertex)
526+
attr = self.compile_attributes(name=name, color=self.ecrackcolor)
527+
else:
528+
continue
529+
530+
point = self.diagram.vertex_point(vertex)
531+
radius = self.session.settings.formdiagram.crack_radius
532+
sphere = Sphere(radius, point=point)
533+
guid = sc.doc.Objects.AddSphere(compas_rhino.conversions.sphere_to_rhino(sphere), attr)
534+
guids.append(guid)
524535

525536
if guids:
526537
if self.crackgroup:

0 commit comments

Comments
 (0)