public override void Scale(double factor) { if (Vertices != null) { for (var i = 0; i < Vertices.Count(); i++) { Vertices[i] *= factor; } } if (Offset != null && Offset.Count() > 0) { for (var i = 0; i < Offset.Count(); i++) { Offset[i] *= factor; } } //The ScaleProperties method doesn't scale primitive properties, which is correct for most cases //except for: gsaMeshSize if (GSAMeshSize.HasValue && GSAMeshSize.Value > 0) { GSAMeshSize *= factor; } Helper.ScaleProperties(Properties, factor); GenerateHash(); }
public Structural2DElement[] Explode() { var elements = new List <Structural2DElement>(); var faceCounter = 0; for (var i = 0; i < Faces.Count(); i++) { var vertices = new List <double>(); var colors = new List <int>(); var numVertices = Faces[i++] + 3; for (var j = 0; j < numVertices; j++) { if (Colors != null && Colors.Count() > Faces[i]) { colors.Add(Colors[Faces[i]]); } vertices.AddRange(Vertices.Skip(Faces[i++] * 3).Take(3)); } i--; var element = new Structural2DElement( vertices.ToArray(), (new List <int>() { numVertices - 3 }).Concat(Enumerable.Range(0, numVertices)).ToArray(), colors.Count() == vertices.Count() / 3 ? colors.ToArray() : new int[0], ElementType, PropertyRef, Axis != null && Axis.Count() > faceCounter ? Axis[faceCounter] : null, Offset != null && Offset.Count() > faceCounter ? Offset[faceCounter] : 0, ElementApplicationId != null && ElementApplicationId.Count() > faceCounter ? ElementApplicationId[faceCounter] : Helper.CreateChildApplicationId(i, ApplicationId + "-" + faceCounter.ToString()) ) { GSADummy = GSADummy, GSAMeshSize = GSAMeshSize }; elements.Add(element); faceCounter++; } return(elements.ToArray()); }
public override void Scale(double factor) { for (var i = 0; i < Value.Count(); i++) { Value[i] *= factor; } if (Offset != null) { for (var i = 0; i < Offset.Count(); i++) { Offset[i].Scale(factor); } } Properties = ScaleProperties(Properties, factor); GenerateHash(); }
public override void Scale(double factor) { for (var i = 0; i < Vertices.Count(); i++) { Vertices[i] *= factor; } if (Offset != null && Offset.Count() > 0) { for (var i = 0; i < Offset.Count(); i++) { Offset[i] *= factor; } } Properties = ScaleProperties(Properties, factor); GenerateHash(); }
public Structural1DElement[] Explode() { var elements = new List <Structural1DElement>(); for (var i = 0; i < Value.Count() / 3 - 1; i++) { var element = new Structural1DElement( Value.Skip(i * 3).Take(6).ToArray(), ElementType, PropertyRef, ZAxis == null || ZAxis.Count() <= i ? null : ZAxis[i], EndRelease == null || EndRelease.Count() < i * 2 + 2 ? null : EndRelease.Skip(i * 2).Take(2).ToArray(), Offset == null || Offset.Count() < i * 2 + 2 ? null : Offset.Skip(i * 2).Take(2).ToArray(), ElementApplicationId != null && ElementApplicationId.Count() > i ? ElementApplicationId[i] : ApplicationId + "_" + i.ToString() ); element.GSADummy = GSADummy; element.GSAMeshSize = GSAMeshSize; elements.Add(element); } return(elements.ToArray()); }