Skip to content

Commit d7e00b6

Browse files
committed
update the constraints
1 parent de4af84 commit d7e00b6

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/compas_fofin/datastructures/cablemesh.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from compas.datastructures import Mesh
2-
from compas.geometry import Vector
2+
from compas_fd.constraints import Constraint # noqa: F401
33

44

55
class CableMesh(Mesh):
@@ -41,10 +41,16 @@ def __init__(self, constraints=None, **kwargs):
4141
self.default_face_attributes.update({})
4242
self.constraints = constraints or {}
4343

44-
# def vertex_residual(self, vertex):
45-
# residual = self.vertex_attribute(vertex, "_residual")
46-
# return residual
44+
def vertex_constraint(self, vertex):
45+
# type: (int) -> Constraint
46+
guid = self.vertex_attribute(vertex, "constraint")
47+
if guid:
48+
return self.constraints[guid]
4749

48-
# def vertex_load(self, vertex):
49-
# load = self.vertex_attribute(vertex, "load")
50-
# return load
50+
def update_constraints(self):
51+
for vertex in self.vertices():
52+
constraint = self.vertex_constraint(vertex)
53+
if constraint:
54+
constraint.location = self.vertex_point(vertex)
55+
constraint.project()
56+
self.vertex_attributes(vertex, "xyz", constraint.location)

0 commit comments

Comments
 (0)