Ejemplo n.º 1
0
        public void CreateDoorEl(string groupel, string ingroupel, string iningroupel, string objgr, double AxisX, double AxisY, double AxisZ, double LenX, double LenY, double LenZ, double thickness, ModelUIElement3D thisobject1, ModelUIElement3D thisobject2, ModelUIElement3D thisobject3, ModelUIElement3D thisobject4, int napr, int naprv, ArrayList conttemp, string text = "-1", int id = -1)
        {
            if (text == "-1")
            {
                text = win.soureseDefault;
            }
            if (id == -1)
            {
                id = win.iddefault;
            }
            MeshGeometry3D meshgeometry = new MeshGeometry3D();

            meshgeometry.TriangleIndices = win.trianglerectangleobject;
            meshgeometry.Positions       = win.rectangleobject;
            GeometryModel3D modelgeometry = new GeometryModel3D();

            modelgeometry.Geometry = meshgeometry;

            meshgeometry.TextureCoordinates = new PointCollection(win.textures);
            ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Венге.jpg", UriKind.Relative)));

            modelgeometry.Material = new DiffuseMaterial(texture);
            ModelUIElement3D modelUI = new ModelUIElement3D();

            modelUI.MouseUp += win.ClickOnModel;
            modelUI.Model    = modelgeometry;
            ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);

            tempmodel.groupel     = groupel;
            tempmodel.ingroupel   = ingroupel;
            tempmodel.iningroupel = iningroupel;
            tempmodel.thickness   = thickness;
            tempmodel.hashtable   = win.CreatedElements;
            tempmodel.objgr       = objgr;
            ElementCabinet[] tempel = new ElementCabinet[4];
            tempel[2] = win.CreatedElements[thisobject1.GetHashCode()] as ElementCabinet;
            tempel[3] = win.CreatedElements[thisobject2.GetHashCode()] as ElementCabinet;
            tempel[0] = win.CreatedElements[thisobject3.GetHashCode()] as ElementCabinet;
            tempel[1] = win.CreatedElements[thisobject4.GetHashCode()] as ElementCabinet;

            tempmodel.select      = tempel[2];
            tempmodel.twoselect   = tempel[3];
            tempmodel.threeselect = tempel[0];
            tempmodel.fourselect  = tempel[1];

            tempmodel.naprv = naprv;
            tempmodel.napr  = napr;


            tempmodel.changeObject(LenX, LenY, LenZ, AxisX, AxisY, AxisZ);
            win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
            win.container.Children.Add(modelUI);
            conttemp.Add(modelUI);

            tempmodel.changeTexture(text, id);
        }
Ejemplo n.º 2
0
        public void CreateShaft(string gr, string type, MouseButtonEventArgs e, double centerz)
        {
            MeshGeometry3D meshgeometry = new MeshGeometry3D();

            meshgeometry.TriangleIndices = win.trianglerectangleobject;
            meshgeometry.Positions       = win.rectangleobject;
            GeometryModel3D modelgeometry = new GeometryModel3D();

            modelgeometry.Geometry = meshgeometry;
            modelgeometry.Material = new DiffuseMaterial(
                new SolidColorBrush(Colors.Green));
            meshgeometry.TextureCoordinates = new PointCollection(win.textures);
            ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Венге.jpg", UriKind.Relative)));

            modelgeometry.Material = new DiffuseMaterial(texture);
            ModelUIElement3D modelUI = new ModelUIElement3D();

            modelUI.MouseUp += win.ClickOnModel;
            modelUI.Model    = modelgeometry;
            ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);

            tempmodel.groupel   = gr;
            tempmodel.ingroupel = "ShelfC";
            tempmodel.objgr     = "S";
            tempmodel.thickness = 0.015;
            tempmodel.select    = win.CreatedElements[win.selectedobject.GetHashCode()] as ElementCabinet;
            if (win.twoselectedobject != null)
            {
                tempmodel.twoselect = win.CreatedElements[win.twoselectedobject.GetHashCode()] as ElementCabinet;
            }
            if (type == "L")
            {
                tempmodel.napr = 1;
            }
            if (type == "R")
            {
                tempmodel.napr = -1;
            }
            tempmodel.hashtable = win.CreatedElements;
            tempmodel.center    = centerz - tempmodel.select.AxisZ;
            tempmodel.changeTexture(win.soureseDefault, win.iddefault);
            _3DObject        tempmodel1 = win.CreatedElements[win.selectedobject.GetHashCode()] as _3DObject;
            Transform3DGroup group3d    = tempmodel1.thismodel.Transform as Transform3DGroup;
            ScaleTransform3D tln        = group3d.Children.OfType <ScaleTransform3D>().FirstOrDefault();

            tempmodel.changeObject(0, tln.ScaleY, 0, 0, 0, 0);
            win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
            win.container.Children.Add(modelUI);
            win.ClickOnCamera(modelUI, e as MouseButtonEventArgs);
            win.ClickOnModel(modelUI, e);
        }
Ejemplo n.º 3
0
        public void CreateRack(string gr, string type, MouseButtonEventArgs e, double centerz, double centery)
        {
            PipeVisual3D pipe = new PipeVisual3D();

            pipe.Diameter = 1;
            pipe.Point1   = new Point3D(0, 0, 0);
            pipe.Point2   = new Point3D(1, 0, 0);
            MeshElement3D tpipe = pipe as MeshElement3D;

            tpipe.Model.Material = Materials.White;
            ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Задняя стена белый.jpg", UriKind.Relative)));

            tpipe.Model.Material = new DiffuseMaterial(texture);
            ModelUIElement3D modelUI = new ModelUIElement3D();

            modelUI.MouseUp += win.ClickOnModel;
            modelUI.Model    = tpipe.Model;
            ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);

            tempmodel.groupel   = gr;
            tempmodel.ingroupel = "Rack";
            tempmodel.objgr     = "S";
            tempmodel.thickness = 0.015;
            tempmodel.select    = win.CreatedElements[win.selectedobject.GetHashCode()] as ElementCabinet;
            if (win.twoselectedobject != null)
            {
                tempmodel.twoselect = win.CreatedElements[win.twoselectedobject.GetHashCode()] as ElementCabinet;
            }
            if (type == "L")
            {
                tempmodel.napr = 1;
            }
            if (type == "R")
            {
                tempmodel.napr = -1;
            }
            tempmodel.hashtable = win.CreatedElements;
            tempmodel.center    = centerz - tempmodel.select.AxisZ;
            tempmodel.centery   = centery - tempmodel.select.AxisY;
            tempmodel.changeTexture(win.soureseDefault, win.iddefault);
            _3DObject        tempmodel1 = win.CreatedElements[win.selectedobject.GetHashCode()] as _3DObject;
            Transform3DGroup group3d    = tempmodel1.thismodel.Transform as Transform3DGroup;
            ScaleTransform3D tln        = group3d.Children.OfType <ScaleTransform3D>().FirstOrDefault();

            tempmodel.changeObject(0, tln.ScaleY, 0, 0, 0, 0);
            win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
            win.container.Children.Add(modelUI);
            win.ClickOnCamera(modelUI, e as MouseButtonEventArgs);
            win.ClickOnModel(modelUI, e);
        }
Ejemplo n.º 4
0
        public void CreateShelfWall(string groupel, string ingroupel, string objgr, double AxisX, double AxisY, double AxisZ, double LenX, double LenY, double LenZ, double thickness, ModelUIElement3D thisobject1, ModelUIElement3D thisobject2, int napr, double center, bool basewallstatus, double descreaselen, ArrayList conttemp, double otDR, double otUL, string text = "-1", int id = -1)
        {
            if (text == "-1")
            {
                text = win.soureseDefault;
            }
            if (id == -1)
            {
                id = win.iddefault;
            }
            MeshGeometry3D meshgeometry = new MeshGeometry3D();

            meshgeometry.TriangleIndices = win.trianglerectangleobject;
            meshgeometry.Positions       = win.rectangleobject;
            GeometryModel3D modelgeometry = new GeometryModel3D();

            modelgeometry.Geometry = meshgeometry;
            modelgeometry.Material = new DiffuseMaterial(
                new SolidColorBrush(Colors.Green));
            meshgeometry.TextureCoordinates = new PointCollection(win.textures);
            ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(text, UriKind.Relative)));

            modelgeometry.Material = new DiffuseMaterial(texture);
            ModelUIElement3D modelUI = new ModelUIElement3D();

            modelUI.MouseUp += win.ClickOnModel;
            modelUI.Model    = modelgeometry;
            ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);

            tempmodel.groupel        = groupel;
            tempmodel.ingroupel      = ingroupel;
            tempmodel.objgr          = objgr;
            tempmodel.thickness      = thickness;
            tempmodel.select         = win.CreatedElements[thisobject1.GetHashCode()] as ElementCabinet;
            tempmodel.twoselect      = win.CreatedElements[thisobject2.GetHashCode()] as ElementCabinet;
            tempmodel.napr           = napr;
            tempmodel.basewallstatus = basewallstatus;
            tempmodel.descreaselen   = descreaselen;
            tempmodel.hashtable      = win.CreatedElements;
            tempmodel.center         = center;
            tempmodel.otUL           = otUL;
            tempmodel.otDR           = otDR;
            tempmodel.changeObject(LenX, LenY, LenZ, AxisX, AxisY, AxisZ);
            win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
            win.container.Children.Add(modelUI);
            conttemp.Add(modelUI);
            tempmodel.changeTexture(text, id);
        }
Ejemplo n.º 5
0
        public void CreateRackEl(string groupel, string ingroupel, string objgr, double AxisX, double AxisY, double AxisZ, double LenX, double LenY, double LenZ, double thickness, ModelUIElement3D thisobject1, ModelUIElement3D thisobject2, int napr, double center, double centery, ArrayList conttemp, string text = "-1", int id = -1)
        {
            if (text == "-1")
            {
                text = win.soureseDefault;
            }
            if (id == -1)
            {
                id = win.iddefault;
            }
            PipeVisual3D pipe = new PipeVisual3D();

            pipe.Diameter = 1;
            pipe.Point1   = new Point3D(0, 0, 0);
            pipe.Point2   = new Point3D(1, 0, 0);
            MeshElement3D tpipe = pipe as MeshElement3D;

            tpipe.Model.Material = Materials.White;
            ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(text, UriKind.Relative)));

            tpipe.Model.Material = new DiffuseMaterial(texture);
            ModelUIElement3D modelUI = new ModelUIElement3D();

            modelUI.MouseUp += win.ClickOnModel;
            modelUI.Model    = tpipe.Model;
            ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);

            tempmodel.groupel   = groupel;
            tempmodel.ingroupel = ingroupel;
            tempmodel.objgr     = objgr;
            tempmodel.thickness = thickness;
            tempmodel.select    = win.CreatedElements[thisobject1.GetHashCode()] as ElementCabinet;
            tempmodel.twoselect = win.CreatedElements[thisobject2.GetHashCode()] as ElementCabinet;
            tempmodel.napr      = -1;
            tempmodel.hashtable = win.CreatedElements;
            tempmodel.center    = center;
            tempmodel.centery   = centery;
            tempmodel.changeObject(LenX, LenY, LenZ, AxisX, AxisY, AxisZ);
            win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
            win.container.Children.Add(modelUI);
            conttemp.Add(modelUI);
            tempmodel.changeTexture(text, id);
        }
Ejemplo n.º 6
0
        public void CreateFoundationEl(string groupel, string ingroupel, string objgr, double AxisX, double AxisY, double AxisZ, double LenX, double LenY, double LenZ, double thickness, ArrayList cont, string text = "-1", int id = -1)
        {
            if (text == "-1")
            {
                text = win.soureseDefault;
            }
            if (id == -1)
            {
                id = win.iddefault;
            }
            MeshGeometry3D meshgeometry = new MeshGeometry3D();

            meshgeometry.TriangleIndices = win.trianglerectangleobject;
            meshgeometry.Positions       = win.rectangleobject;
            GeometryModel3D modelgeometry = new GeometryModel3D();

            modelgeometry.Geometry          = meshgeometry;
            meshgeometry.TextureCoordinates = new PointCollection(win.textures);
            ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(text, UriKind.Relative)));

            modelgeometry.Material = new DiffuseMaterial(texture);
            ModelUIElement3D modelUI = new ModelUIElement3D();

            modelUI.MouseUp += win.ClickOnModel;
            modelUI.Model    = modelgeometry;
            ElementCabinet tempmodel = new ElementCabinet(modelUI, 1, 1, 2, 0, 0, 0);

            tempmodel.groupel   = groupel;
            tempmodel.ingroupel = ingroupel;
            tempmodel.objgr     = objgr;
            tempmodel.thickness = thickness;
            tempmodel.hashtable = win.CreatedElements;
            tempmodel.changeObject(LenX, LenY, LenZ, AxisX, AxisY, AxisZ);
            win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
            win.container.Children.Add(modelUI);
            cont.Add(modelUI);
            tempmodel.changeTexture(text, id);
        }
Ejemplo n.º 7
0
        public void CreateCountB(string gr, string type, string type2, MouseButtonEventArgs e, string port)
        {
            ElementCabinet[] tempel = new ElementCabinet[4];
            tempel[port.IndexOf('0')] = win.CreatedElements[win.selectedobject.GetHashCode()] as ElementCabinet;
            tempel[port.IndexOf('1')] = win.CreatedElements[win.twoselectedobject.GetHashCode()] as ElementCabinet;
            tempel[port.IndexOf('2')] = win.CreatedElements[win.threeselectedobject.GetHashCode()] as ElementCabinet;
            tempel[port.IndexOf('3')] = win.CreatedElements[win.fourselectedobject.GetHashCode()] as ElementCabinet;
            int                  countW   = Convert.ToInt32(win.CountB.Text);
            ElementCabinet       tm1      = tempel[0];
            Transform3DGroup     group3d1 = tm1.thismodel.Transform as Transform3DGroup;
            TranslateTransform3D tln1     = group3d1.Children.OfType <TranslateTransform3D>().FirstOrDefault();
            ElementCabinet       tm2      = tempel[1];
            Transform3DGroup     group3d2 = tm2.thismodel.Transform as Transform3DGroup;
            TranslateTransform3D tln2     = group3d2.Children.OfType <TranslateTransform3D>().FirstOrDefault();
            double               otstup   = 0;
            double               nach     = 0;

            if (tln1.OffsetZ - tln2.OffsetZ >= 0)
            {
                otstup  = tln1.OffsetZ - tln2.OffsetZ;
                otstup /= countW;
                otstup -= 0.005;
                nach    = tln2.OffsetZ;
            }
            if (tln2.OffsetZ - tln1.OffsetZ >= 0)
            {
                otstup  = tln2.OffsetZ - tln1.OffsetZ;
                otstup /= countW;
                otstup -= 0.005;
                nach    = tln1.OffsetZ;
            }
            for (int i = 0; i < countW; i++)
            {
                int idd = win.rand.Next(0, 100000);
                for (int h = 0; h < 6; h++)
                {
                    MeshGeometry3D meshgeometry = new MeshGeometry3D();
                    meshgeometry.TriangleIndices = win.trianglerectangleobject;
                    meshgeometry.Positions       = win.rectangleobject;
                    GeometryModel3D modelgeometry = new GeometryModel3D();
                    modelgeometry.Geometry = meshgeometry;
                    modelgeometry.Material = new DiffuseMaterial(
                        new SolidColorBrush(Colors.Green));
                    meshgeometry.TextureCoordinates = new PointCollection(win.textures);
                    ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Венге.jpg", UriKind.Relative)));
                    modelgeometry.Material = new DiffuseMaterial(texture);
                    ModelUIElement3D modelUI = new ModelUIElement3D();
                    modelUI.MouseUp += win.ClickOnModel;
                    modelUI.Model    = modelgeometry;
                    ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);
                    tempmodel.groupel   = gr;
                    tempmodel.ingroupel = "Box-" + idd;
                    if (h == 0)
                    {
                        tempmodel.iningroupel = "WF";
                    }
                    if (h == 1)
                    {
                        tempmodel.iningroupel = "WB";
                    }
                    if (h == 2)
                    {
                        tempmodel.iningroupel = "WR";
                    }
                    if (h == 3)
                    {
                        tempmodel.iningroupel = "WL";
                    }
                    if (h == 4)
                    {
                        tempmodel.iningroupel = "WFF";
                    }
                    if (h == 5)
                    {
                        tempmodel.iningroupel = "WD";
                    }
                    if (h == 5)
                    {
                        tempmodel.thickness = 0.003;
                    }
                    else
                    {
                        tempmodel.thickness = 0.015;
                    }
                    tempmodel.otsx      = 0.02;
                    tempmodel.otsy      = 0.02;
                    tempmodel.otsz      = 0.02;
                    tempmodel.lenbox    = otstup;
                    tempmodel.select    = tempel[3];
                    tempmodel.twoselect = tempel[2];
                    if (type2 == "L")
                    {
                        tempmodel.napr = 1;
                    }
                    if (type2 == "R")
                    {
                        tempmodel.napr = -1;
                    }
                    tempmodel.hashtable = win.CreatedElements;
                    tempmodel.center    = nach;
                    tempmodel.changeObject(0, 0, 0, 0, 0, 0);
                    win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
                    win.container.Children.Add(modelUI);
                    if (h == 5)
                    {
                        tempmodel.changeTexture(win.soureseDefaultB, win.iddefaultB);
                    }
                    else
                    {
                        tempmodel.changeTexture(win.soureseDefault, win.iddefault);
                    }
                }
                nach += otstup + 0.005;
            }
        }
Ejemplo n.º 8
0
        public void CreateCountS(string gr, string type, string type2, MouseButtonEventArgs e, string port)
        {
            ElementCabinet[] tempel = new ElementCabinet[4];
            tempel[port.IndexOf('0')] = win.CreatedElements[win.selectedobject.GetHashCode()] as ElementCabinet;
            tempel[port.IndexOf('1')] = win.CreatedElements[win.twoselectedobject.GetHashCode()] as ElementCabinet;
            tempel[port.IndexOf('2')] = win.CreatedElements[win.threeselectedobject.GetHashCode()] as ElementCabinet;
            tempel[port.IndexOf('3')] = win.CreatedElements[win.fourselectedobject.GetHashCode()] as ElementCabinet;
            int                  countW   = Convert.ToInt32(win.CountB.Text);
            ElementCabinet       tm1      = tempel[0];
            Transform3DGroup     group3d1 = tm1.thismodel.Transform as Transform3DGroup;
            TranslateTransform3D tln1     = group3d1.Children.OfType <TranslateTransform3D>().FirstOrDefault();
            ElementCabinet       tm2      = tempel[1];
            Transform3DGroup     group3d2 = tm2.thismodel.Transform as Transform3DGroup;
            TranslateTransform3D tln2     = group3d2.Children.OfType <TranslateTransform3D>().FirstOrDefault();
            double               otstup   = 0;
            double               nach     = 0;

            if (tln1.OffsetZ - tln2.OffsetZ >= 0)
            {
                otstup  = tln1.OffsetZ - tln2.OffsetZ;
                otstup -= tm2.thickness;
                otstup /= countW + 1;
                nach    = tln2.OffsetZ;
            }
            if (tln2.OffsetZ - tln1.OffsetZ >= 0)
            {
                otstup  = tln2.OffsetZ - tln1.OffsetZ;
                otstup -= tm1.thickness;
                otstup /= countW + 1;
                nach    = tln1.OffsetZ;
            }
            nach += otstup;
            for (int i = 0; i < countW; i++)
            {
                MeshGeometry3D meshgeometry = new MeshGeometry3D();
                meshgeometry.TriangleIndices = win.trianglerectangleobject;
                meshgeometry.Positions       = win.rectangleobject;
                GeometryModel3D modelgeometry = new GeometryModel3D();
                modelgeometry.Geometry          = meshgeometry;
                meshgeometry.TextureCoordinates = new PointCollection(win.textures);
                ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Венге.jpg", UriKind.Relative)));
                modelgeometry.Material = new DiffuseMaterial(texture);
                ModelUIElement3D modelUI = new ModelUIElement3D();
                modelUI.MouseUp += win.ClickOnModel;
                modelUI.Model    = modelgeometry;
                ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);
                tempmodel.groupel   = gr;
                tempmodel.ingroupel = "ShelfC";
                tempmodel.objgr     = "S";
                tempmodel.thickness = 0.015;
                tempmodel.hashtable = win.CreatedElements;
                tempmodel.select    = tempel[2];
                tempmodel.twoselect = tempel[3];
                if (type2 == "L")
                {
                    tempmodel.napr = 1;
                }
                if (type2 == "R")
                {
                    tempmodel.napr = -1;
                }
                tempmodel.center = nach;
                _3DObject        tempmodel1 = win.CreatedElements[win.selectedobject.GetHashCode()] as _3DObject;
                Transform3DGroup group3d    = tempmodel1.thismodel.Transform as Transform3DGroup;
                ScaleTransform3D tln        = group3d.Children.OfType <ScaleTransform3D>().FirstOrDefault();
                tempmodel.changeObject(0, tln.ScaleY, 0, 0, 0, 0);
                win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
                win.container.Children.Add(modelUI);
                tempmodel.changeTexture(win.soureseDefault, win.iddefault);
                nach += otstup;
            }
        }
Ejemplo n.º 9
0
        public void CreateDoorTwo(string gr, string type, string type2, MouseButtonEventArgs e, string port)
        {
            int idd = win.rand.Next(0, 100000);
            ModelUIElement3D tmpmod = null;

            for (int i = 0; i < 2; i++)
            {
                MeshGeometry3D meshgeometry = new MeshGeometry3D();
                meshgeometry.TriangleIndices = win.trianglerectangleobject;
                meshgeometry.Positions       = win.rectangleobject;
                GeometryModel3D modelgeometry = new GeometryModel3D();
                modelgeometry.Geometry          = meshgeometry;
                meshgeometry.TextureCoordinates = new PointCollection(win.textures);
                ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Венге.jpg", UriKind.Relative)));
                modelgeometry.Material = new DiffuseMaterial(texture);
                ModelUIElement3D modelUI = new ModelUIElement3D();
                modelUI.MouseUp += win.ClickOnModel;
                modelUI.Model    = modelgeometry;
                ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);
                tempmodel.groupel   = gr;
                tempmodel.ingroupel = "Door-" + idd;
                if (i == 0)
                {
                    tempmodel.iningroupel = "DoorL";
                }
                if (i == 1)
                {
                    tempmodel.iningroupel = "DoorR";
                }
                tempmodel.thickness = 0.015;
                tempmodel.hashtable = win.CreatedElements;
                tempmodel.objgr     = "WBF";
                string[]         tmp1   = port.Split('|');
                ElementCabinet[] tempel = new ElementCabinet[4];
                tempel[port.IndexOf('0')] = win.CreatedElements[win.selectedobject.GetHashCode()] as ElementCabinet;
                tempel[port.IndexOf('1')] = win.CreatedElements[win.twoselectedobject.GetHashCode()] as ElementCabinet;
                tempel[port.IndexOf('2')] = win.CreatedElements[win.threeselectedobject.GetHashCode()] as ElementCabinet;
                tempel[port.IndexOf('3')] = win.CreatedElements[win.fourselectedobject.GetHashCode()] as ElementCabinet;
                tempmodel.select          = tempel[2];
                tempmodel.twoselect       = tempel[3];
                tempmodel.threeselect     = tempel[0];
                tempmodel.fourselect      = tempel[1];
                if (type == "D")
                {
                    tempmodel.naprv = 1;
                }
                if (type == "U")
                {
                    tempmodel.naprv = -1;
                }
                if (type2 == "L")
                {
                    tempmodel.napr = 1;
                }
                if (type2 == "R")
                {
                    tempmodel.napr = -1;
                }
                tempmodel.center = win.xclickonView;
                _3DObject        tempmodel1 = win.CreatedElements[win.selectedobject.GetHashCode()] as _3DObject;
                Transform3DGroup group3d    = tempmodel1.thismodel.Transform as Transform3DGroup;
                ScaleTransform3D tln        = group3d.Children.OfType <ScaleTransform3D>().FirstOrDefault();
                tempmodel.changeObject(0, tln.ScaleY, 0, 0, 0, 0);
                tempmodel.changeObject(0, tln.ScaleY, 0, 0, 0, 0);
                win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
                win.container.Children.Add(modelUI);
                tempmodel.changeTexture(win.soureseDefault, win.iddefault);
                tmpmod = modelUI;
            }
            win.ClickOnCamera(tmpmod, e as MouseButtonEventArgs);
            win.ClickOnModel(tmpmod, e);
        }
Ejemplo n.º 10
0
        public void CreateFoundation(string type)
        {
            if (win.iddefault == -1 || win.iddefaultB == -1)
            {
                MessageBox.Show("Выберите в настройках материалы по умолчанию"); return;
            }
            int idd = win.rand.Next(0, 100000);

            for (int i = 0; i < 6; i++)
            {
                MeshGeometry3D meshgeometry = new MeshGeometry3D();
                meshgeometry.TriangleIndices = win.trianglerectangleobject;
                meshgeometry.Positions       = win.rectangleobject;
                GeometryModel3D modelgeometry = new GeometryModel3D();
                modelgeometry.Geometry          = meshgeometry;
                meshgeometry.TextureCoordinates = new PointCollection(win.textures);
                ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Венге.jpg", UriKind.Relative)));
                modelgeometry.Material = new DiffuseMaterial(texture);
                ModelUIElement3D modelUI = new ModelUIElement3D();
                modelUI.MouseUp += win.ClickOnModel;
                modelUI.Model    = modelgeometry;
                ElementCabinet tempmodel = new ElementCabinet(modelUI, 1, 1, 2, 0, 0, 0);
                tempmodel.groupel = type + idd;
                if (i == 0)
                {
                    tempmodel.ingroupel = "WallR";
                    tempmodel.objgr     = "W";
                    tempmodel.thickness = 0.015;
                }
                if (i == 1)
                {
                    tempmodel.ingroupel = "WallL";
                    tempmodel.objgr     = "W";
                    tempmodel.thickness = 0.015;
                }
                if (i == 2)
                {
                    tempmodel.ingroupel = "Ceiling";
                    tempmodel.objgr     = "S";
                    tempmodel.thickness = 0.015;
                }
                if (i == 3)
                {
                    tempmodel.ingroupel = "WallB";
                    tempmodel.thickness = 0.003;
                    tempmodel.objgr     = "WBF";
                }
                if (i == 4)
                {
                    tempmodel.ingroupel = "Floor";
                    tempmodel.objgr     = "S";
                    tempmodel.thickness = 0.015;
                }
                if (i == 5)
                {
                    tempmodel.ingroupel = "WallF";
                    tempmodel.thickness = 0.015;
                    tempmodel.objgr     = "WBF";
                }
                tempmodel.hashtable = win.CreatedElements;
                tempmodel.changeObject(1, 1, 2, 0, 0, 0);
                win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
                win.container.Children.Add(modelUI);
                if (i == 3)
                {
                    tempmodel.changeTexture(win.soureseDefaultB, win.iddefaultB);
                }
                else
                {
                    tempmodel.changeTexture(win.soureseDefault, win.iddefault);
                }
            }
        }
Ejemplo n.º 11
0
        public void CreateBox(string gr, string type, MouseButtonEventArgs e, double len, double centerz)
        {
            int idd = win.rand.Next(0, 100000);

            for (int i = 0; i < 6; i++)
            {
                MeshGeometry3D meshgeometry = new MeshGeometry3D();
                meshgeometry.TriangleIndices = win.trianglerectangleobject;
                meshgeometry.Positions       = win.rectangleobject;
                GeometryModel3D modelgeometry = new GeometryModel3D();
                modelgeometry.Geometry = meshgeometry;
                modelgeometry.Material = new DiffuseMaterial(
                    new SolidColorBrush(Colors.Green));

                meshgeometry.TextureCoordinates = new PointCollection(win.textures);
                ImageBrush texture = new ImageBrush(new BitmapImage(new Uri(@"Images//Венге.jpg", UriKind.Relative)));
                modelgeometry.Material = new DiffuseMaterial(texture);

                ModelUIElement3D modelUI = new ModelUIElement3D();
                modelUI.MouseUp += win.ClickOnModel;
                modelUI.Model    = modelgeometry;
                ElementCabinet tempmodel = new ElementCabinet(modelUI, 0, 0, 0, 0, 0, 0);
                tempmodel.groupel   = gr;
                tempmodel.ingroupel = "Box-" + idd;
                if (i == 0)
                {
                    tempmodel.iningroupel = "WF";
                }
                if (i == 1)
                {
                    tempmodel.iningroupel = "WB";
                }
                if (i == 2)
                {
                    tempmodel.iningroupel = "WR";
                }
                if (i == 3)
                {
                    tempmodel.iningroupel = "WL";
                }
                if (i == 4)
                {
                    tempmodel.iningroupel = "WFF";
                }
                if (i == 5)
                {
                    tempmodel.iningroupel = "WD";
                }
                if (i == 5)
                {
                    tempmodel.thickness = 0.003;
                }
                else
                {
                    tempmodel.thickness = 0.015;
                }
                tempmodel.otsx   = 0.02;
                tempmodel.otsy   = 0.02;
                tempmodel.otsz   = 0.02;
                tempmodel.lenbox = len;
                tempmodel.select = win.CreatedElements[win.selectedobject.GetHashCode()] as ElementCabinet;
                if (win.twoselectedobject != null)
                {
                    tempmodel.twoselect = win.CreatedElements[win.twoselectedobject.GetHashCode()] as ElementCabinet;
                }
                if (type == "L")
                {
                    tempmodel.napr = 1;
                }
                if (type == "R")
                {
                    tempmodel.napr = -1;
                }
                tempmodel.hashtable = win.CreatedElements;
                tempmodel.center    = centerz - tempmodel.select.AxisZ;
                _3DObject        tempmodel1 = win.CreatedElements[win.selectedobject.GetHashCode()] as _3DObject;
                Transform3DGroup group3d    = tempmodel1.thismodel.Transform as Transform3DGroup;
                ScaleTransform3D tln        = group3d.Children.OfType <ScaleTransform3D>().FirstOrDefault();
                tempmodel.changeObject(0, tln.ScaleY, 0, 0, 0, 0);
                win.CreatedElements.Add(modelUI.GetHashCode(), tempmodel);
                win.container.Children.Add(modelUI);
                if (i == 5)
                {
                    tempmodel.changeTexture(win.soureseDefaultB, win.iddefaultB);
                }
                else
                {
                    tempmodel.changeTexture(win.soureseDefault, win.iddefault);
                }
            }
        }