public Structural2DElementMesh(IEnumerable <double> edgeVertices, int?color, Structural2DElementType elementType, string propertyRef,
                                       IEnumerable <StructuralAxis> axes, IEnumerable <double> offsets, string applicationId = null, Dictionary <string, object> properties = null)
        {
            if (properties != null)
            {
                Properties = properties;
            }

            var pm = new PolygonMesher.PolygonMesher();

            pm.Init(edgeVertices);
            Faces    = pm.Faces().ToList();
            Vertices = pm.Coordinates.ToList();

            Colors = (color == null) ? new List <int>() : Enumerable.Repeat(color.Value, Vertices.Count() / 3).ToList();

            ElementType = elementType;
            PropertyRef = propertyRef;
            if (axes != null)
            {
                Axis = axes.ToList();
            }
            if (offsets != null && offsets.Count() > 0)
            {
                Offset = offsets.ToList();
            }
            ApplicationId = applicationId;

            TextureCoordinates = null;

            GenerateHash();
        }
 private string ElementTypeToString(Structural2DElementType t)
 {
   if (t == Structural2DElementType.Slab)
   {
     return "SLAB";
   }
   if (t == Structural2DElementType.Wall)
   {
     return "WALL";
   }
   return "2D_GENERIC";
 }
예제 #3
0
        public Structural2DElementMesh(double[] edgeVertices, int?color, Structural2DElementType elementType, string propertyRef, StructuralAxis[] axis, double[] offset, string applicationId = null, Dictionary <string, object> properties = null)
        {
            if (properties != null)
            {
                Properties = properties;
            }
            Vertices = edgeVertices.ToList();

            // Perform mesh making
            var faces = SplitMesh(
                edgeVertices,
                (Enumerable.Range(0, edgeVertices.Count() / 3).ToArray()));

            Faces = new List <int>();

            foreach (var face in faces)
            {
                Faces.Add(face.Count() - 3);
                Faces.AddRange(face);
            }

            if (color != null)
            {
                Colors = Enumerable.Repeat(color.Value, Vertices.Count() / 3).ToList();
            }
            else
            {
                Colors = new List <int>();
            }

            ElementType = elementType;
            PropertyRef = propertyRef;
            if (axis != null)
            {
                Axis = axis.ToList();
            }
            if (offset != null && offset.Count() > 0)
            {
                Offset = offset.ToList();
            }
            ApplicationId = applicationId;

            TextureCoordinates = null;

            GenerateHash();
        }
예제 #4
0
        public Structural2DElement(double[] vertices, int[] faces, int[] colors, Structural2DElementType elementType, string propertyRef, StructuralAxis axis, double offset, string applicationId = null, Dictionary <string, object> properties = null)
        {
            if (properties != null)
            {
                Properties = properties;
            }
            Vertices      = vertices.ToList();
            Faces         = faces.ToList();
            Colors        = colors == null ? null : colors.ToList();
            ElementType   = elementType;
            PropertyRef   = propertyRef;
            Axis          = axis;
            Offset        = offset;
            ApplicationId = applicationId;

            TextureCoordinates = null;

            GenerateHash();
        }
예제 #5
0
        public Structural2DElementMesh(double[] vertices, int[] faces, int[] colors, Structural2DElementType elementType, string propertyRef, StructuralAxis[] axis, double[] offset, string applicationId = null, double meshSize = 0, Dictionary <string, object> properties = null)
        {
            if (properties != null)
            {
                Properties = properties;
            }
            Vertices    = vertices.ToList();
            Faces       = faces.ToList();
            Colors      = colors == null ? null : colors.ToList();
            ElementType = elementType;
            PropertyRef = propertyRef;
            Axis        = axis.ToList();
            if (offset != null && offset.Count() > 0)
            {
                Offset = offset.ToList();
            }
            GSAMeshSize        = meshSize;
            ApplicationId      = applicationId;
            TextureCoordinates = null;

            GenerateHash();
        }
        public Structural2DElementMesh(IEnumerable <double> vertices, IEnumerable <int> faces, IEnumerable <int> colors,
                                       Structural2DElementType elementType, string propertyRef, IEnumerable <StructuralAxis> axes, IEnumerable <double> offsets,
                                       string applicationId = null, double meshSize = 0, Dictionary <string, object> properties = null)
        {
            if (properties != null)
            {
                Properties = properties;
            }
            Vertices    = vertices.ToList();
            Faces       = faces.ToList();
            Colors      = colors == null ? null : colors.ToList();
            ElementType = elementType;
            PropertyRef = propertyRef;
            Axis        = axes.ToList();
            if (offsets != null && offsets.Count() > 0)
            {
                Offset = offsets.ToList();
            }
            GSAMeshSize        = meshSize;
            ApplicationId      = applicationId;
            TextureCoordinates = null;

            GenerateHash();
        }