Download this file

153 lines (133 with data), 5.2 kB

AnyFolder SpineFixation ={
  
  // AN EXAMPLE OF SIMPLE SPINE FIXATION DEVICE
  
  // Change these segments and the following device attachment nodes 
  // in order to modify the position of the implant
  AnySeg &bottom =.BodyModel.Trunk.SegmentsLumbar.L5Seg;
  AnySeg &top =.BodyModel.Trunk.SegmentsLumbar.L4Seg;
  //---------------------------------------------------------------------
  // CLAMPS & SCREWS POSITIONS
  //---------------------------------------------------------------------
  bottom={
    AnyRefNode  FixationRight ={
      sRel={0.02,0.02,0.016};
      AnyRefNode Cad={
        ARel=RotMat(-55*pi/180,y)*RotMat(-5*pi/180,z)*RotMat(-20*pi/180,x);
        AnyDrawSurf fixation ={
          FileName ="../Input/CAD/block.stl";
          ScaleXYZ={0.0006,0.0006,0.0006};
        };
        AnyRefNode rodnode ={
          sRel={-0.0095,0,0.0015};
        };
      };
    };
    AnyRefNode  FixationLeft ={
      sRel={0.02,0.02,-0.016};
      ARel=RotMat(-pi,x);
      AnyRefNode Cad={
        ARel=RotMat(-55*pi/180,y)*RotMat(5*pi/180,z)*RotMat(20*pi/180,x);
        AnyDrawSurf fixation ={
          FileName ="../Input/CAD/block.stl";
          ScaleXYZ={0.0006,0.0006,0.0006};
        };
        AnyRefNode rodnode ={sRel={-0.0095,0,0.0015};};
      };
    };
    
  }; // bottom
  top={
    AnyRefNode  FixationRight ={
      sRel={0.02,0.0475,0.019};
      AnyRefNode Cad={
        ARel=RotMat(-50*pi/180,y)*RotMat(-10*pi/180,z)*RotMat(-20*pi/180,x)*RotMat(-10*pi/180,y)*RotMat(20*pi/180,x)*RotMat(-15*pi/180,y);
        AnyDrawSurf fixation ={
          FileName ="../Input/CAD/block.stl";
          ScaleXYZ={0.0006,0.0006,0.0006};
        };
        AnyRefNode rodnode ={sRel={-0.0095,0,0.0015};};
      };
    };
    AnyRefNode  FixationLeft ={
      sRel={0.02,0.0475,-0.019};
      ARel=RotMat(-pi,x);
      
      AnyRefNode Cad={
        ARel=RotMat(-50*pi/180,y)*RotMat(10*pi/180,z)*RotMat(20*pi/180,x)*RotMat(-10*pi/180,y)*RotMat(-20*pi/180,x)*RotMat(-15*pi/180,y);
        AnyDrawSurf fixation ={
          FileName ="../Input/CAD/block.stl";
          ScaleXYZ={0.0006,0.0006,0.0006};
        };
        AnyRefNode rodnode ={sRel={-0.0095,0,0.0015};};
      };
    };
  }; // top
  
  
  
  
  AnyKinPLine RightRod={
    AnyRefNode &ref2=  .bottom.FixationRight.Cad.rodnode;
    AnyRefNode &ref3=  .top.FixationRight.Cad.rodnode;
    AnyDrawPLine drw={Thickness=0.002; RGB={0.8,0.8,0.8};};
  };
  AnyKinPLine LeftRod={
    AnyRefNode &ref2=  .bottom.FixationLeft.Cad.rodnode;
    AnyRefNode &ref3=  .top.FixationLeft.Cad.rodnode;
    AnyDrawPLine drw={Thickness=0.002; RGB={0.8,0.8,0.8};};
  };  
  
  //---------------------------------------------------------------------
  // VISUALIZE FORCE ACTING IN THE IMPLANTS
  //---------------------------------------------------------------------
  
  AnyVec3 vforceT = bottom.FixationLeft.Cad.rodnode.r - top.FixationLeft.Cad.rodnode.r;
  AnyFloat vn = vnorm(vforceT,2);
  AnyVec3 vforceback = -vforceT/vn;
  AnyVec3 vforceforward = vforceT/vn;

  AnyDrawVector DrawForce1 = {
    Vec = .vforceforward*.RodForceLeft.Fout[0]/1000;
    GlobalCoord = On;
    AnyRefNode &ref=.bottom.FixationLeft.Cad.rodnode;
    Line.Thickness=0.0025;
    Line.RGB={0,1,1};
    Line.End.Style = {5} ;
    Line.End.Thickness = 3*Line.Thickness;  
    Line.End.Length = 4*Line.Thickness;
    Line.Start.Style = {0};
    Line.Start.Thickness = 3*Line.Thickness;  
    Line.Start.Length = 3*Line.Thickness;
    Line.Start.RGB = {1,0,0};
  };
  AnyDrawVector DrawForce2 = {
    Vec = .vforceback*.RodForceLeft.Fout[0]/1000;
    GlobalCoord = On;
    AnyRefNode &ref=.top.FixationLeft.Cad.rodnode;
    Line.Thickness=0.0025;
    Line.RGB={0,1,1};
    Line.End.Style = {5} ;
    Line.End.Thickness = 3*Line.Thickness;  
    Line.End.Length = 4*Line.Thickness;
    Line.Start.Style = {0};
    Line.Start.Thickness = 3*Line.Thickness;  
    Line.Start.Length = 3*Line.Thickness;
    Line.Start.RGB = {1,0,0};
  };

  AnyVar coeff = Main.ImplantStiffnessCoefficient;

  AnyKinRotational alpha = 
  {
    Type = RotAxesAngles;
    Axis1 = z;
    AnyRefFrame &a1 = .bottom.L4L5JntNode;
    AnyRefFrame &a2 = .top.L4L5JntNode;
  };
  AnyVar beta = (alpha.Pos[0])/pi*180;
  
  //---------------------------------------------------------------------
  // IMPLANT FORCE VALUES
  //---------------------------------------------------------------------
  
  // !!! PLEASE NOTE: this device is just a demonstration of possible developments
  // and only works during flexion/extension activities as it depends on the flex/ext angle
  
  // The following value is a linear fit for the rotational stiffness 
  // found from an FE bending analysis of a circular elastic titanium rod 
  // fixed from both sides by rigid clamps.  
  
  AnyFloat RotStiffness = 15;
  
  AnyForce RodForceRight = {
    AnyKinMeasure& l = .RightRod;
    F = {.coeff*.beta*.RotStiffness};
  };
  AnyForce RodForceLeft = {
    AnyKinMeasure& l = .LeftRod;
    F = {.coeff*.beta*.RotStiffness};
  };
};