Assign particles' Orientation in Kangaroo PhysicalSystem

Hello everyone,

I’ve been exploring the Kangaroo PhysicalSystem for a project and I’ve found myself in a bit of a predicament. I’m attempting to assign a custom PIndex for the Beam Goal. However, I’ve noticed that merely assigning the PIndex results in invalid data when I run the program.

Given this, my assumption is that I need to also set each particle’s orientation. The issue I’m facing here is that the m_particles variable in the PhysicalSystem Class is private, thereby preventing me from modifying the particle orientation directly.

Thank you in advance for your time and assistance.

Line beamLine = new Line(newParticle.pos, PS.GetPosition(newParticle.neighbourIndices[i]));
Rhino.Geometry.Plane planeStart, planeEnd;
Vector3d direction = beamLine.Direction;
direction.Unitize();
planeStart = new Plane(beamLine.From, direction);
planeEnd = new Plane(beamLine.To, direction);
double restLength = beamLine.Length;
Plane node0, node1;
node0 = Plane.WorldXY;
node1 = Plane.WorldXY;
Transform trans0 = Transform.Translation(new Vector3d(planeStart.Origin));
Transform trans1 = Transform.Translation(new Vector3d(planeEnd.Origin));
node0.Transform(trans0);
node1.Transform(trans1);
var newBeam = new KangarooSolver.Goals.Beam(
    planeStart,
    planeEnd,
    node0,
    node1,
    restLength,
    weightingBeam,
    crossSecArea,
    lx,
    ly,
    GJ
    );
newBeam.PIndex = new int[2] { newParticle.index, newParticle.neighbourIndices[i] };

Oh, the problem was just solved.

Changed the accessibility of the variables.

1 Like