Пример #1
0
        private Mesh ImportModel(string path)
        {
            ReadSTL stl = new ReadSTL(path, false, Mesh.natureType.Plain);

            eyeshot.DoWork(stl);
            // return (Mesh)stl.Entities[0];
            return((stl.Entities[0] as IFace).GetPolygonMeshes()[0]);
        }
Пример #2
0
        private void OpenCADFile()
        {
            if (disabled)
            {
                return;
            }
            ReadFileAsynch rfa;

            rfa = new ReadSTL(new MemoryStream(Properties.Resources.iBeam), false);                    //    break;
            rfa.Unlock(EYESHOT_SERIAL);
            rfa.LoadingText = "iBeam";
            viewPortLayout1.DoWork(rfa);
            rfa.AddToSceneAsSingleObject(viewPortLayout1, "iBeamParent", 0);
        }
        private void btnImport_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                Filter          = "STL File|*.STL",
                Multiselect     = false,
                AddExtension    = true,
                CheckFileExists = true,
                CheckPathExists = true
            };

            openFileDialog.InitialDirectory = "c:\\";

            //  openFileDialog.Filter = "Object files (*.STL,*.OBJ,*.FBX,*.3DS)|*.STL,*.OBJ,*.FBX,*.3DS|All files (*.*)|*.*";

            if (openFileDialog.ShowDialog() == true)
            {
                //Get the path of specified file
                var filePath = openFileDialog.FileName;

                //Read the contents of the file into a stream
                var fileStream  = openFileDialog.OpenFile();
                var fileContent = "";
                using (StreamReader reader = new StreamReader(fileStream))
                {
                    //devDept.Eyeshot.Translators.ReadFile filePath = new devDept.Eyeshot.Translators.ReadFile(filePath);
                    model1.Clear();
                    var readAutodesk = new ReadAutodesk(filePath);
                    readAutodesk.DoWork();
                    readAutodesk.AddToScene(model1);
                    var ReadObj = new ReadSTL(filePath);
                    ReadObj.DoWork();
                    Entity[] toAdd = ReadObj.Entities;

                    //fileContent = reader.ReadToEnd();
                    //ModelVisual3D device3D = new ModelVisual3D();
                    //Viewport3DVisual viewport = new Viewport3DVisual();
                    //viewport readFile;


                    model1.Entities.AddRange(toAdd, System.Drawing.Color.Chocolate);
                    //model1.SetView(viewType.Top);
                    //model1.ZoomFit();
                    model1.Invalidate();
                }
                //view.Export(filePath);
            }
        }