Example #1
0
        static void Main(string[] args)
        {
            String dataRoot         = @".";
            String fractionTagsName = "ListCVFracture.txt";
            String borderTagsName   = "ListCVBorder.txt";
            String modelGrid        = "Model.grid";

            string gridPathFileName = Path.Combine(dataRoot, modelGrid);

            string fractionTagPathFileName = Path.Combine(dataRoot, fractionTagsName);

            string borderTagPathFileName = Path.Combine(dataRoot, borderTagsName);

            UnstructureGeometryLoader loader = new UnstructureGeometryLoader();

            DateTime start = DateTime.Now;
            UnStructuredGridderSource source = loader.LoadSource(gridPathFileName, fractionTagPathFileName, borderTagPathFileName);
            DateTime stop    = DateTime.Now;
            double   seconds = (stop.Ticks - start.Ticks) / 1000.0d;

            System.Console.WriteLine("loan cost seconds:{0}", seconds);
            System.Console.WriteLine("Triangles:{0}", source.Triangles.Length);
            System.Console.WriteLine("Tetras:{0}", source.Tetras.Length);
            System.Console.WriteLine("Fractions:{0}", source.Fractions.Length);
        }
Example #2
0
        private void Create3DObject(object sender, EventArgs e)
        {
            try
            {
                MessageBox.Show("Please make sure you put 'ListCVFracture.txt', 'ListCVBorder.txt', 'Model.grid' under the same directory with this exe.");
                String dataRoot         = @".";
                String fractionTagsName = "ListCVFracture.txt";
                String borderTagsName   = "ListCVBorder.txt";
                String modelGrid        = "Model.grid";

                var startTime = DateTime.Now;

                string gridPathFileName = Path.Combine(dataRoot, modelGrid);

                string fractionTagPathFileName = Path.Combine(dataRoot, fractionTagsName);

                string borderTagPathFileName = Path.Combine(dataRoot, borderTagsName);

                UnstructureGeometryLoader loader = new UnstructureGeometryLoader();

                DateTime start = DateTime.Now;
                UnStructuredGridderSource source = loader.LoadSource(gridPathFileName, fractionTagPathFileName, borderTagPathFileName);
                DateTime stop    = DateTime.Now;
                double   seconds = (stop.Ticks - start.Ticks) / 1000.0d;

                this.element = new UnStructuredGridderElement(source, this.scientificVisual3DControl.Scene.CurrentCamera)
                {
                    Name = "UnStructuredGridderElement}"
                };
                element.Initialize(this.scientificVisual3DControl.OpenGL);

                ///模拟获得网格属性
                int   minValue = 100;
                int   maxValue = 10000;
                float step     = (maxValue * 1.0f - minValue * 1.0f) / 10;
                //设置色标的范围
                this.scientificVisual3DControl.SetColorIndicator(minValue, maxValue, step);

                this.scientificVisual3DControl.AddModelElement(element);

                // update ModelContainer's BoundingBox.
                BoundingBox boundingBox = this.scientificVisual3DControl.ModelContainer.BoundingBox;
                if (this.scientificVisual3DControl.ModelContainer.Children.Count > 1)
                {
                    boundingBox.Extend(source.Min);
                    boundingBox.Extend(source.Max);
                }
                else
                {
                    boundingBox.SetBounds(source.Min, source.Max);
                }
                //boundingBox.Expand();

                // update ViewType to UserView.
                this.scientificVisual3DControl.ViewType = ViewTypes.UserView;

                var endTime  = DateTime.Now;
                var interval = endTime.Subtract(startTime);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
        }