Skip to content
Snippets Groups Projects
Commit 49304bbe authored by Boman Romain's avatar Boman Romain
Browse files

update script

parent 922e630d
No related branches found
No related tags found
1 merge request!1new loads
Pipeline #23794 passed
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -3,12 +3,16 @@ ...@@ -3,12 +3,16 @@
# #
# Test of the "boneload.create_loads" subroutine # Test of the "boneload.create_loads" subroutine
# with a simple geometry (cylinder) # with a simple geometry (cylinder)
# The force vectors are computed according to the 'Tangential-Traction Model' # The force vectors are computed according to a chosen model
# and displayed with VTK # and displayed with VTK
#
# RUN THIS FILE from the "models" directory:
# cd models
# python view_cylinder_T.py
from boneload import * from boneload import *
if __name__=="__main__": if __name__ == "__main__":
# load meshes (main mesh, selection and focal point) # load meshes (main mesh, selection and focal point)
surface, _, _ = SurfMesh.load('cylinder/cylinder.ply', vertices=False) surface, _, _ = SurfMesh.load('cylinder/cylinder.ply', vertices=False)
...@@ -16,8 +20,11 @@ if __name__=="__main__": ...@@ -16,8 +20,11 @@ if __name__=="__main__":
muscleF, focalnodes, _ = SurfMesh.load('cylinder/muscleF.off') muscleF, focalnodes, _ = SurfMesh.load('cylinder/muscleF.off')
# calls 'create_loads' # calls 'create_loads'
loads = create_loads(nodes, tris, \ loads = create_loads(nodes, tris,
total_force=10., target=focalnodes[0], method='T') total_force=10.,
target=focalnodes[0],
method='T') # <= change loading model here
# among 'U', 'T', 'T+N', 'N' or 'D'
# add vector field to the surface for display # add vector field to the surface for display
muscle.add_vectors(loads) muscle.add_vectors(loads)
...@@ -26,21 +33,20 @@ if __name__=="__main__": ...@@ -26,21 +33,20 @@ if __name__=="__main__":
# configure 3D display # configure 3D display
view = View() view = View()
view.addActors(surface.actor) view.addActors(surface.actor)
view.addActors(muscle.actor) view.addActors(muscle.actor)
view.addActors(muscleF.actor) view.addActors(muscleF.actor)
view.addActors(forces.actor) view.addActors(forces.actor)
surface.actor.GetProperty().SetOpacity(0.3) surface.actor.GetProperty().SetOpacity(0.3)
muscle.mapper.SetResolveCoincidentTopologyToPolygonOffset() muscle.mapper.SetResolveCoincidentTopologyToPolygonOffset()
muscle.actor.GetProperty().SetColor( colors.GetColor3d('red') ) muscle.actor.GetProperty().SetColor(colors.GetColor3d('red'))
muscle.actor.GetProperty().SetOpacity(0.5) muscle.actor.GetProperty().SetOpacity(0.5)
muscle.actor.GetProperty().EdgeVisibilityOn() muscle.actor.GetProperty().EdgeVisibilityOn()
muscle.actor.GetProperty().SetPointSize(1.0) muscle.actor.GetProperty().SetPointSize(1.0)
muscleF.actor.GetProperty().SetPointSize(15.0) muscleF.actor.GetProperty().SetPointSize(15.0)
muscleF.actor.GetProperty().SetColor( colors.GetColor3d('green') ) muscleF.actor.GetProperty().SetColor(colors.GetColor3d('green'))
view.interact() view.interact()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment