Beispiel #1
0
        protected override void OnContentRendered(EventArgs e)
        {
            _readFile = new devDept.Eyeshot.Translators.ReadFile("../../../../../../dataset/Assets/Piston.eye");
            _readFile.DoWork();
            _readFile.AddToScene(model1, System.Drawing.Color.White);

            // Inizializes original entity index
            _originalIndex = 0;

            Sh = new SplitHelper(model1);
            Sh.DrawNormalDirection(Point3D.Origin, _readFile.Entities[_originalIndex].BoxSize.Diagonal);

            // sets trimetric view
            model1.SetView(viewType.Trimetric);
            model1.Camera.ProjectionMode = projectionType.Orthographic;
            model1.GetGrid().Visible = false;

            // fits the model in the viewport
            model1.ZoomFit();

            //refresh the model control
            model1.Invalidate();

            base.OnContentRendered(e);
        }
Beispiel #2
0
        protected override void OnContentRendered(EventArgs e)
        {
            //////
            // adds a custom mesh to the CoordinateSystemIcon
            //////
            model1.GetCoordinateSystemIcon().Entities.Clear();

            // reads the mesh obj (eyeshot file) from the Assets directory
            devDept.Eyeshot.Translators.ReadFile rf = new devDept.Eyeshot.Translators.ReadFile("../../../../../../dataset/Assets/figure_Object011.eye");
            rf.DoWork();
            Mesh torso = (Mesh)rf.Entities[0];

            torso.Scale(0.5, 0.5, 0.5);
            torso.NormalAveragingMode = Mesh.normalAveragingType.Averaged;
            torso.Regen(0.1);

            // orients the mesh
            Point3D midPoint = (torso.BoxMin + torso.BoxMax) / 2;

            torso.Translate(-midPoint.X, -midPoint.Y, -midPoint.Z);
            torso.Rotate(Math.PI / 2, Vector3D.AxisX);

            // sets the color
            torso.Color = System.Drawing.Color.Pink;

            // sets the model on the CoordinateSystemIcon entities and remove the labels
            CoordinateSystemIcon csi = model1.GetCoordinateSystemIcon();

            csi.Entities.Add(torso);
            csi.LabelAxisX = "";
            csi.LabelAxisY = "";
            csi.LabelAxisZ = "";
            csi.Lighting   = true;

            model1.CompileUserInterfaceElements();
            // sets my event handler to the ToolBarButton.Click event

            // Previous view
            model1.GetToolBar().Buttons[0].Click += PreviousViewClickEventHandler;

            // Next view
            model1.GetToolBar().Buttons[1].Click += NextViewClickEventHandler;

            // MyPushButton
            model1.GetToolBar().Buttons[6].Click += MyPushButtonClickEventHandler;

            // MyToggleButton
            model1.GetToolBar().Buttons[7].Click += MyToggleButtonClickEventHandler;

            // sets trimetric view
            model1.SetView(viewType.Trimetric);

            // fits the model in the viewport
            model1.ZoomFit();

            //refresh the viewport
            model1.Invalidate();

            base.OnContentRendered(e);
        }
Beispiel #3
0
        protected override void OnContentRendered(EventArgs e)
        {
            // Creates the pens
            PenSilho = new Pen(System.Drawing.Color.Black, 3.0f);
            PenEdge  = new Pen(System.Drawing.Color.Black, 1.0f);
            PenWire  = new Pen(System.Drawing.Color.Black, 1.0f);
            PenEdge.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            PenSilho.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
            PenWire.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);


            model1.GetGrid().AutoSize = true;
            model1.GetGrid().Step     = 50;
            model1.Camera.FocalLength    = 30;
            model1.Camera.ProjectionMode = projectionType.Perspective;
            model1.SetView(viewType.Trimetric);
            model1.ZoomFit();
            model1.Invalidate();

            // Imports an Ascii model
            devDept.Eyeshot.Translators.ReadFile rf = new devDept.Eyeshot.Translators.ReadFile("../../../../../../dataset/Assets/house.eye");
            rf.DoWork();
            model1.Entities.AddRange(rf.Entities, Color.Gray);

            // Changes the color/material of the fifth entity
            rf.Entities[5].Color = System.Drawing.Color.Pink;

            model1.ZoomFit();
            comboBoxPrintMode.SelectedIndex = 0;

            base.OnContentRendered(e);
        }
Beispiel #4
0
        private void AddStlToBlock(Block block, string eyeName, System.Drawing.Color color)
        {
            devDept.Eyeshot.Translators.ReadFile readFile = new devDept.Eyeshot.Translators.ReadFile(Assets + eyeName);

            readFile.DoWork();


            readFile.Entities[0].ColorMethod = colorMethodType.byEntity;

            readFile.Entities[0].Color = color;

            block.Entities.Add(readFile.Entities[0]);
        }
Beispiel #5
0
        protected override void OnContentRendered(EventArgs e)
        {
            model1.GetGrid().AutoSize = true;
            model1.GetGrid().Step     = 500;

            devDept.Eyeshot.Translators.ReadFile readFile = new devDept.Eyeshot.Translators.ReadFile(Assets + "160.eye");
            readFile.DoWork();
            model1.Entities.AddRange(readFile.Entities, System.Drawing.Color.DimGray);

            Block firstBlock = new Block("First");

            AddStlToBlock(firstBlock, "930.eye", System.Drawing.Color.DeepSkyBlue);
            AddStlToBlock(firstBlock, "940.eye", System.Drawing.Color.DeepSkyBlue);

            Block secondBlock = new Block("Second");

            AddStlToBlock(secondBlock, "570.eye", System.Drawing.Color.DodgerBlue);

            Block thirdBlock = new Block("Third");

            AddStlToBlock(thirdBlock, "590.eye", System.Drawing.Color.SlateBlue);

            firstBlock.Entities.Add(new TranslatingAlongY("Second"));
            secondBlock.Entities.Add(new TranslatingAlongZ("Third"));

            model1.Blocks.Add(firstBlock);
            model1.Blocks.Add(secondBlock);
            model1.Blocks.Add(thirdBlock);

            model1.Entities.Add(new TranslatingAlongX("First"));

            model1.SetView(viewType.Trimetric);

            model1.ZoomFit();

            // Turn off silhouettes to increase drawing speed
            model1.Rendered.SilhouettesDrawingMode = silhouettesDrawingType.Never;

            // Shadows are not currently supported in animations
            model1.Rendered.ShadowMode = shadowType.None;

            model1.StartAnimation(_interval);
            startButton.IsEnabled = false;

            base.OnContentRendered(e);
        }
Beispiel #6
0
        private BlockReference CreateBlockReference(string partName, String fileName)
        {
            devDept.Eyeshot.Translators.ReadFile readFile = new devDept.Eyeshot.Translators.ReadFile(fileName);
            readFile.DoWork();

            Entity entity = readFile.Entities[0];

            ((Mesh)entity).NormalAveragingMode = Mesh.normalAveragingType.Averaged;
            entity.ColorMethod = colorMethodType.byParent;

            Block bl = new Block(partName, Point3D.Origin);

            bl.Entities.Add(entity);
            model1.Blocks.Add(bl);

            BlockReference br = new BlockReference(new Identity(), partName);

            br.ColorMethod = colorMethodType.byParent;
            return(br);
        }