void CreateChainWithOneFixedEnd(ReferencePoint pt1, int numX, double springDampening, double springRestLength, double springConstant, double mass) { Particle p; XYZ partXYZ1 = pt1.Position; Particle fixedPart1 = ParticleSystem.makeParticleFromElementID(pt1.Id, mass, pt1.Position, true); // true means 'make fixed' XYZ partXYZ2 = partXYZ1 + new XYZ(10, 0, 0); //Line tempLine = this.UIDocument.Application.Application.Create.NewLineBound(partXYZ1, partXYZ2); XYZ vector = partXYZ2 - partXYZ1; XYZ step = vector.Divide(numX); for (int j = 0; j < numX; j++)//step along curve and evaluate at each step, making sure to thread in the existing fixed parts { //double curveParam = 0; XYZ pointOnLine; pointOnLine = partXYZ1 + step.Multiply(j); if (j == 0) // starting point { //curveParam = (double)j / numX; //pointOnLine = tempLine.Evaluate(curveParam, true); p = ParticleSystem.makeParticle(mass, pointOnLine, true); // make first particle fixed } else // middle points { //curveParam = (double)j / numX; //pointOnLine = tempLine.Evaluate(curveParam, true); p = ParticleSystem.makeParticle(mass, pointOnLine, false); // make a new particle along curve at j-th point on line ParticleSystem.makeSpring(ParticleSystem.getParticle((j - 1)), p, springRestLength, springConstant, springDampening); //make a new spring and connect it to the last-made point } } }