public Dictionary <Tuple <int, int>, Mesh> GenerateRodMeshes() { RodMeshes.Clear(); RodCentrelines.Clear(); foreach (Tuple <int, int> e in Edges) { Curve centreline = new LineCurve(Vertices[e.Item1], Vertices[e.Item2]); try { var o1 = Offsets[e]; var o2 = Offsets[Tuple.Create(e.Item2, e.Item1)]; if (o1 > 0) { centreline = centreline.Trim(CurveEnd.Start, o1); } if (o2 > 0) { centreline = centreline.Trim(CurveEnd.End, o2); } if (centreline == null) { throw new Exception(); } } catch { throw new Exception("Rod not created. Radius and tolerance too large for edge lengths. Try reducing either or increase the edge lengths."); } RodCentrelines[e] = centreline; RodMeshes[e] = Mesh.CreateFromCurvePipe(centreline, Radius, Sides, 0, MeshPipeCapStyle.Flat, false); } return(RodMeshes); }
public void ClearModelGeometries() { RodMeshes.Clear(); RodCentrelines.Clear(); JointMeshes.Clear(); }