材料类
Наследование: Item
Пример #1
0
        //Screw screw;//нужен ли он здесь?
        public Dowel(DowelType type,
		              float max_avulsion_force,
		              float max_cut_force,
		              bool is_throughwall,
		              bool is_selfdrill,
		              float d,
		              float lenght,
		              Materials[] accepted_material,
		              float max_a,
		              float max_s,
		              float[] accepted_screw_d)
        {
            this.max_cut_force = max_cut_force;//To screws...
            this.type = type;
            this.max_avulsion_force = max_avulsion_force;
            this.is_throughwall = is_throughwall;
            this.is_selfdrill = is_selfdrill;
            this.d = d;
            this.lenght = lenght;
            this.accepted_material = accepted_material;
            this.max_a = max_a;
            this.max_s = max_s;
            this.accepted_screw_d = accepted_screw_d;
            switch (this.type) {
            case DowelType.Butterfly:
                this.img_name = "Summer_work.Imgs.Dowels.butterfly.png";
                break;
            case DowelType.Nail:
                this.img_name = "Summer_work.Imgs.Dowels.nail.png";
                break;
            case DowelType.Standart:
                this.img_name = "Summer_work.Imgs.Dowels.standart.png";
                break;
            }
        }
Пример #2
0
 public Watches(string name, string description, double price, string maker, int yearsOld, Materials material)
     : base(name, description, price)
 {
     this.maker = maker;
     this.yearsOld = yearsOld;
     this.material = material;
 }
Пример #3
0
 public Piece(Materials piece, char startFile, int startRank)
 {
     this.StartFile = startFile;
     this.StartRank = startRank;
     this.SetMaterial(piece);
     this.Square = This.Board[StartFile][startRank];
 }
Пример #4
0
 public Step14(List<Materials> selectedMaterials, Materials shlak)
 {
     _selectedMaterials = selectedMaterials;
     _shlak = shlak;
     Tube.Шлакообразующий = shlak;
     InitializeComponent();
     Loaded += OnLoaded;
 }
Пример #5
0
        public Anchor(AnchorType type, 
		               float max_avulsion_force,
		               float max_cut_force,
		               bool is_throughwall,
		               float d,
		               float lenght,
		               Materials[] accepted_material,
		               float max_a,
		               float max_s,
		               float bolt_d)
        {
            this.type = type;
            this.max_avulsion_force = max_avulsion_force;
            this.max_cut_force = max_cut_force;
            this.is_throughwall = is_throughwall;
            this.is_selfdrill = false;
            this.d = d;
            this.lenght = lenght;
            this.accepted_material = accepted_material;
            this.max_a = max_a;
            this.max_s = max_s;
            switch (this.type) {
            case AnchorType.Driven:
                this.img_name = "Summer_work.Imgs.Anchors.drivein.png";
                break;
            case AnchorType.Frame:
                this.img_name = "Summer_work.Imgs.Anchors.frame.png";
                break;
            case AnchorType.Sleeve:
                this.img_name = "Summer_work.Imgs.Anchors.sleeve.png";
                break;
            case AnchorType.Wedged:
                this.img_name = "Summer_work.Imgs.Anchors.wedgedt2.png";
                break;
            }
            if (this.type == AnchorType.Driven) {
                this.bolt_d = bolt_d;
                this.bolt_class = this.max_cut_force/100;
                if(this.bolt_class<=4.8)//it's bad...
                    this.bolt_class = (float)4.8;
                else if(this.bolt_class<=5.8)
                        this.bolt_class = (float)5.8;
                else if(this.bolt_class <= 8.8)
                        this.bolt_class = (float)8.8;
                else if(this.bolt_class <=9.8)
                    this.bolt_class = (float)9.8;
                else this.bolt_class = (float)12.9;

            } else {
                this.bolt_class = 0;
                this.bolt_d = 0;
            }
        }
Пример #6
0
        public override void SelfRender(int lod, Materials.Material mat = null)
        {
            mat.Apply(0,0);
            switch (RenderPipeline.instancingTechnique)
            {
                case InstancingTechnique.HardwareInstancing:
                    DrawModelHardwareInstancing();
                    break;

                case InstancingTechnique.NoInstancing:
                    DrawModelNoInstancing();
                    break;
            }
        }
Пример #7
0
 public Screw(ScrewType type,
     float max_avulsion_force,
     float max_cut_force,
     bool is_throughwall,
     bool is_selfdrill,
     float d,
     float lenght,
     Materials[] accepted_material,
     float max_a,
     float max_s)
 {
     this.type = type;
     this.max_avulsion_force = max_avulsion_force;
     this.max_cut_force = max_cut_force;
     this.is_throughwall = is_throughwall;
     this.is_selfdrill = is_selfdrill;
     this.d = d;
     this.lenght = lenght;
     this.accepted_material = accepted_material;
     this.max_a = max_a;
     this.max_s = max_s;
     switch (this.type) {
     case ScrewType.Capercaillie:
         this.img_name = "Summer_work.Imgs.Screws.capercaillie.png";
         break;
     case ScrewType.Metal:
         this.img_name = "Summer_work.Imgs.Screws.metal.png";
         break;
     case ScrewType.PO:
         this.img_name = "Summer_work.Imgs.Screws.PO.png";
         break;
     case ScrewType.PS:
         this.img_name = "Summer_work.Imgs.Screws.PS.png";
         break;
     case ScrewType.Roof:
         this.img_name = "Summer_work.Imgs.Screws.roofs.png";
         break;
     case ScrewType.Tree:
         this.img_name = "Summer_work.Imgs.Screws.tree.png";
         break;
     case ScrewType.Uni:
         this.img_name = "Summer_work.Imgs.Screws.uni.png";
         break;
     case ScrewType.Concerete:
         this.img_name = "Summer_work.Imgs.Screws.concrete.png";
         break;
     }
 }
Пример #8
0
        //        public void Add_Screw(ScrewType type, float d, float lenght, bool is_throughwall,
        //                              bool is_selfdrill, float max_avulsion_force, float max_cut_force)
        //        {
        //            this.screw = new Screw(type, max_avulsion_force, max_cut_force, is_throughwall,
        //                                   is_selfdrill, d, lenght, this.accepted_material, this.max_a, this.max_s);
        //        }
        public override bool CanPassByForce(int vector, float force, float objLenght, Materials what)
        {
            float gamma_F = 1.4f;
            float gamma_M_avulsion = 1.5f * 1.2f * 1.4f;//2.52
            float gamma_M_cut = 1f / 0.8f;//5.8*10 (5.8 - class of...)
            float gamma_F_force = 1.4f;
            float R_r_cut = ((max_cut_force/7) / gamma_M_cut) / gamma_F;
            float R_r_avulsion = (max_avulsion_force / gamma_M_avulsion) / gamma_F;
            float force_r = force * gamma_F_force;

            float S_cont;
            if(this.type == DowelType.Nail)
                S_cont = (float)((this.lenght - objLenght) * Math.PI * this.d)/2.8f;//half of S!!!!
            else
                S_cont = (float)((this.lenght) * Math.PI * this.d)/2.8f;//half of S!!!!
            float F_cont = force * 1.4f / S_cont;
            switch (what) {
                case Materials.Concrete:
                if (F_cont > 20)//20 N/mm^2
                    return false;
                break;
                case Materials.FoamBlock:
                if (F_cont > 3)
                    return false;
                break;
                case Materials.Brick:
                if (F_cont > 12.5)
                    return false;
                break;
                case Materials.Tree:
                if (F_cont > 40)
                    return false;
                break;
                case Materials.GKL:
                if (F_cont > 2.1)
                    return false;
                break;
            }
            switch (vector) {
            case -1:
                return true;
            case 0:
                return force_r <= R_r_avulsion && force_r <= R_r_cut;
            case 1:
                return force_r <= R_r_avulsion;
            }
            return false;
        }
Пример #9
0
    public PriestRenderer(int id, Vector3 pos, Materials mats, IMoveStrategy moveStrategy, MainSceneController globalController, Configs configs)
    {
        this.gameObj = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        MeshRenderer meshRenderer = this.gameObj.GetComponent <MeshRenderer>();

        meshRenderer.material = mats.Priest;
        Transform transform = this.gameObj.GetComponent <Transform>();

        transform.position   = pos;
        transform.localScale = configs.CharScale;
        PriestController localController = this.gameObj.AddComponent <PriestController>();

        localController.Inject(id, this, globalController, configs);
        this.moveStrategy     = moveStrategy;
        this.globalController = globalController;
    }
Пример #10
0
        /// <summary>
        /// Runs every time, and immediately prior to, a mesh being processed (OnPolymesh).
        /// It supplies the material for the mesh, and we use this to create a new material
        /// in our material container, or switch the current material if it already exists.
        /// </summary>
        /// <param name="node"></param>
        public void OnMaterial(MaterialNode node)
        {
            string       matName;
            ElementId    id     = node.MaterialId;
            glTFMaterial gl_mat = new glTFMaterial();

            if (id != ElementId.InvalidElementId)
            {
                // construct a material from the node
                Element m = _doc.GetElement(node.MaterialId);
                matName = m.Name;

                // construct the material
                gl_mat.name = matName;
                glTFPBR pbr = new glTFPBR();
                pbr.baseColorFactor = new List <float>()
                {
                    node.Color.Red / 255f, node.Color.Green / 255f, node.Color.Blue / 255f, 1f
                };
                pbr.metallicFactor          = 0f;
                pbr.roughnessFactor         = 1f;
                gl_mat.pbrMetallicRoughness = pbr;

                Materials.AddOrUpdateCurrent(m.UniqueId, gl_mat);
            }
            else
            {
                // I'm really not sure what situation this gets triggered in?
                // make your own damn material!
                // (currently this is equivalent to above until I understand BlinnPhong/PBR conversion better)
                string uuid = string.Format("r{0}g{1}b{2}", node.Color.Red.ToString(), node.Color.Green.ToString(), node.Color.Blue.ToString());
                // construct the material
                matName     = string.Format("MaterialNode_{0}_{1}", Util.ColorToInt(node.Color), Util.RealString(node.Transparency * 100));
                gl_mat.name = matName;
                glTFPBR pbr = new glTFPBR();
                pbr.baseColorFactor = new List <float>()
                {
                    node.Color.Red / 255f, node.Color.Green / 255f, node.Color.Blue / 255f, 1f
                };
                pbr.metallicFactor          = 0f;
                pbr.roughnessFactor         = 1f;
                gl_mat.pbrMetallicRoughness = pbr;

                Materials.AddOrUpdateCurrent(uuid, gl_mat);
            }
            Debug.WriteLine(string.Format("    OnMaterial: {0}", matName));
        }
Пример #11
0
        public string SaveWorksheet()
        {
            // Save worksheet in Database
            worksheetRepository.Update(GetWorksheet());

            //After saving to the database, create a PDF and return its path to view.
            BuildPDF buildPDF = new BuildPDF();

            buildPDF.InsertNewLine(24f, BuildPDF.TextAlignment.Center, "Arbejdsseddel nr.: " + WorksheetID);
            buildPDF.InsertNewLine(16f, "  ");
            buildPDF.InsertNewLine(16f, "Kundeinformationer: ");
            buildPDF.InsertNewSplitLine(14f, Customer.Name.FullName, "Startdato: " + StartDate.ToShortDateString());
            buildPDF.InsertNewSplitLine(14f, Customer.Address.Street, "Starttid: " + StartTime);
            buildPDF.InsertNewSplitLine(14f, Customer.Address.ZIPcode + " " + Customer.Address.City, "Slutdato: " + EndDate.ToShortDateString());
            buildPDF.InsertNewSplitLine(14f, "Tel. nr.: " + Customer.PhoneNumber, "Sluttid: " + EndTime);
            buildPDF.InsertNewSplitLine(14f, "Email: " + Customer.Email, "");
            buildPDF.InsertNewSplitLine(14f, "Kundenr.: " + Customer.ID, "Arbejdssted: " + Workplace);
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Ønskes udført: ");
            buildPDF.InsertNewTextBlock(14f, BuildPDF.TextAlignment.Left, WorkDescription);
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Tilknyttede montører: ");
            buildPDF.InsertNewTable(14f, 2,
                                    new List <string> {
                "MedarbejderID", "Navn", "Kvalifikation"
            },
                                    AssignedEmployees.AsEnumerable()
                                    );
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Udførte arbejdstimer: ");
            buildPDF.InsertNewTable(14f, 2,
                                    new List <string> {
                "MedarbejderID", "Navn", "Antal timer", "Type", "Dato"
            },
                                    WorkHours.AsEnumerable()
                                    );
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Brugte materialer: ");
            buildPDF.InsertNewTable(14f, 2,
                                    new List <string> {
                "Varenummer", "Type", "Beskrivelse"
            },
                                    Materials.AsEnumerable()
                                    );

            return(buildPDF.Save("Arbejdsseddel_" + WorksheetID + ".pdf"));
        }
        public IActionResult Edit(Guid?Id)
        {
            List <MaterialsCategory> categories = materialsService.GetAllMaterialsCategories();

            ViewData["CategoryList"] = categories.Select(x => new SelectListItem {
                Text = x.Title, Value = x.Id.ToString()
            });
            //List<SelectListItem> CategoryList = new List<SelectListItem>();
            //CategoryList.Add(new SelectListItem { Value = "", Text = "分类" });
            //foreach (var item in categories)
            //{
            //    CategoryList.Add(new SelectListItem { Value = item.Id.ToString(), Text = item.Title });
            //}
            //ViewData["CategoryList"] = CategoryList;


            //List<SelectListItem> MaterialsTypeList = new List<SelectListItem>();
            //MaterialsTypeList.Add(new SelectListItem { Value = "", Text = "资料类型" });
            //MaterialsTypeList.Add(new SelectListItem { Value = "0", Text = "视屏" });
            //MaterialsTypeList.Add(new SelectListItem { Value = "1", Text = "电子书" });
            //MaterialsTypeList.Add(new SelectListItem { Value = "2", Text = "文档资料" });
            //MaterialsTypeList.Add(new SelectListItem { Value = "3", Text = "博客" });
            //MaterialsTypeList.Add(new SelectListItem { Value = "4", Text = "项目" });
            //ViewData["MaterialsTypeList"] = MaterialsTypeList;

            //List<SelectListItem> SourceTypeList = new List<SelectListItem>();
            //SourceTypeList.Add(new SelectListItem { Value = "", Text = "来源类型" });
            //SourceTypeList.Add(new SelectListItem { Value = "0", Text = "原创" });
            //SourceTypeList.Add(new SelectListItem { Value = "1", Text = "转载" });
            //ViewData["SourceTypeList"] = SourceTypeList;

            MaterialsViewModel model = null;

            if (Id.HasValue)
            {
                Materials Materials = materialsService.GetMaterialsById(Id);
                model       = new MaterialsViewModel(Materials);
                model.IsNew = false;
            }
            else
            {
                model       = new MaterialsViewModel();
                model.IsNew = true;
            }

            return(View(model));
        }
Пример #13
0
        /// <summary>
        /// 修改物料
        /// </summary>
        public bool UpdateMaterials(Materials model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Materials set ");
            strSql.Append("MaterialName=@MaterialName,");
            strSql.Append("Specs=@Specs,");
            strSql.Append("MaterialClassID=@MaterialClassID,");
            strSql.Append("MaterialTypeID=@MaterialTypeID,");
            strSql.Append("PrimaryUnitID=@PrimaryUnitID,");
            strSql.Append("Price=@Price,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("WasterRate=@WasterRate");
            strSql.Append(" where MaterialID=@MaterialID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MaterialName",    SqlDbType.VarChar, 1024),
                new SqlParameter("@Specs",           SqlDbType.VarChar, 1024),
                new SqlParameter("@MaterialClassID", SqlDbType.VarChar,   36),
                new SqlParameter("@MaterialTypeID",  SqlDbType.VarChar,   36),
                new SqlParameter("@PrimaryUnitID",   SqlDbType.VarChar,   36),
                new SqlParameter("@Price",           SqlDbType.Decimal,   13),
                new SqlParameter("@Remark",          SqlDbType.VarChar,  256),
                new SqlParameter("@WasterRate",      SqlDbType.Decimal,   13),
                new SqlParameter("@MaterialID",      SqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.MaterialName;
            parameters[1].Value = model.Specs;
            parameters[2].Value = model.MaterialClassID;
            parameters[3].Value = model.MaterialTypeID;
            parameters[4].Value = model.PrimaryUnitID;
            parameters[5].Value = model.Price;
            parameters[6].Value = model.Remark;
            parameters[7].Value = model.WasterRate;
            parameters[8].Value = model.MaterialID;

            int rows = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #14
0
        public void AddPoly(Vertex[] vertex1, OpenGL gl, Material material)
        {
            DepthBufferAttributes depthBufferAttributes = new DepthBufferAttributes();

            depthBufferAttributes.DepthFunction   = DepthFunction.LessThanOrEqual;
            depthBufferAttributes.EnableDepthTest = true;

            // ==== Fill polygon ====
            PolygonAttributes polygonFillAttributes = new PolygonAttributes();

            polygonFillAttributes.PolygonMode = PolygonMode.Filled;

            polygonFillAttributes.OffsetFactor     = -.5f;
            polygonFillAttributes.OffsetBias       = -.5f;
            polygonFillAttributes.EnableOffsetFill = true;

            OpenGLAttributesEffect polyFillEffect = new OpenGLAttributesEffect();

            polyFillEffect.PolygonAttributes = polygonFillAttributes;
            //polyFillEffect.DepthBufferAttributes = depthBufferAttributes;

            SharpGL.SceneGraph.Primitives.Polygon polyFill = new Polygon(this.Name, vertex1);
            polyFill.Material = material;
            polyFill.AddEffect(polyFillEffect);
            Children.Add(polyFill);

            // ==== Border polygon ====
            PolygonAttributes polygonBorderAttributes = new PolygonAttributes();

            polygonBorderAttributes.PolygonMode = PolygonMode.Lines;

            polygonBorderAttributes.EnableOffsetLine = true;
            polygonBorderAttributes.OffsetFactor     = -.9f;
            polygonBorderAttributes.OffsetBias       = -.9f;

            OpenGLAttributesEffect polyBorderEffect = new OpenGLAttributesEffect();

            polyBorderEffect.PolygonAttributes = polygonBorderAttributes;
            //polyBorderEffect.DepthBufferAttributes = depthBufferAttributes;

            SharpGL.SceneGraph.Primitives.Polygon polyBorder = new Polygon(this.Name, vertex1);
            polyBorder.Material = Materials.DarkGrey(gl);
            polyBorder.AddEffect(polyBorderEffect);
            Children.Add(polyBorder);

            this.polyOnWall = polyFill;
        }
Пример #15
0
        private vdPolyface AddMeshToEntities(vdEntities entities, MeshData mesh)
        {
            vdPolyface onepolyface = new vdPolyface();

            onepolyface.SetUnRegisterDocument(vDraw.ActiveDocument);
            onepolyface.setDocumentDefaults();

            // 顶点数组输入
            foreach (PointData point in mesh.Vertexes)
            {
                onepolyface.VertexList.Add(point.X * Tools.Ft2MmScale, point.Y * Tools.Ft2MmScale, point.Z * Tools.Ft2MmScale);
            }

            // 面片索引输入
            foreach (TriangleIndexData index in mesh.TriangleIndexes)
            {
                onepolyface.AddFaceItem(index.V1 + 1, index.V2 + 1, index.V3 + 1, index.V1 + 1, -1);
            }

            onepolyface.SmoothAngle = 45;
            onepolyface.Layer       = vDraw.ActiveDocument.Layers.FindName(mesh.MaterialName);
            entities.Add(onepolyface);

            if (ExportSetting.SystemSetting.IsExportTextureFile)
            {
                var material = Materials.Find(m => m.Name == mesh.MaterialName);
                if (material != null && !string.IsNullOrEmpty(material.GetValidMapFile()))
                {
                    var img = vDraw.ActiveDocument.Images.FindName(Path.GetFileNameWithoutExtension(material.GetValidMapFile()));
                    if (img != null)
                    {
                        onepolyface.PenColor.SystemColor   = Color.Gray;
                        onepolyface.PenColor.MaterialImage = img;

                        Matrix mtx = new Matrix();
                        mtx.IdentityMatrix();
                        mtx.ScaleMatrix(0.001, 0.001, 1);
                        onepolyface.PenColor.MaterialMatrix = mtx;
                    }
                }
            }

            onepolyface.Invalidate();
            onepolyface.Update();

            return(onepolyface);
        }
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            node.Add(EnabledName, GetEnabled(container.Version));
            node.Add(CastShadowsName, (byte)GetCastShadows(container.Version));
            node.Add(ReceiveShadowsName, GetReceiveShadows(container.Version));
            node.Add(DynamicOccludeeName, GetDynamicOccludee(container.Version));
            node.Add(MotionVectorsName, (byte)GetMotionVectors(container.Version));
            node.Add(LightProbeUsageName, (byte)LightProbeUsage);
            node.Add(ReflectionProbeUsageName, (byte)GetReflectionProbeUsage(container.Version));
            if (HasRayTracingMode(container.ExportVersion))
            {
                node.Add(RayTracingModeName, (byte)RayTracingMode);
            }
            if (HasRenderingLayerMask(container.ExportVersion))
            {
                node.Add(RenderingLayerMaskName, GetRenderingLayerMask(container.Version));
            }
            if (HasRendererPriority(container.ExportVersion))
            {
                node.Add(RendererPriorityName, RendererPriority);
            }
            node.Add(MaterialsName, Materials.ExportYAML(container));
            node.Add(StaticBatchInfoName, GetStaticBatchInfo(container.Version).ExportYAML(container));
            node.Add(StaticBatchRootName, StaticBatchRoot.ExportYAML(container));
            node.Add(ProbeAnchorName, ProbeAnchor.ExportYAML(container));
            node.Add(LightProbeVolumeOverrideName, LightProbeVolumeOverride.ExportYAML(container));
            node.Add(ScaleInLightmapName, GetScaleInLightmap(container.Version, container.Flags));
            if (HasReceiveGI(container.ExportVersion, container.ExportFlags))
            {
                node.Add(ReceiveGIName, (int)GetReceiveGI(container.Version, container.Flags));
            }
            node.Add(PreserveUVsName, GetPreserveUVs(container.Version, container.Flags));
            node.Add(IgnoreNormalsForChartDetectionName, GetIgnoreNormalsForChartDetection(container.Version, container.Flags));
            node.Add(ImportantGIName, GetImportantGI(container.Version, container.Flags));
            node.Add(StitchLightmapSeamsName, GetStitchLightmapSeams(container.Version, container.Flags));
            node.Add(SelectedEditorRenderStateName, (int)GetSelectedEditorRenderState(container.Version, container.Flags));
            node.Add(MinimumChartSizeName, GetMinimumChartSize(container.Version, container.Flags));
            node.Add(AutoUVMaxDistanceName, GetAutoUVMaxDistance(container.Version, container.Flags));
            node.Add(AutoUVMaxAngleName, GetAutoUVMaxAngle(container.Version, container.Flags));
            node.Add(LightmapParametersName, GetLightmapParameters().ExportYAML(container));
            node.Add(SortingLayerIDName, SortingLayerID);
            node.Add(SortingLayerName, SortingLayer);
            node.Add(SortingOrderName, SortingOrder);
            return(node);
        }
 /// <summary>
 /// Initialize the list of materials.
 /// </summary>
 /// <param name="moduleID">The module identifier for the
 /// initial list of materials or 0 if it should be initially empty.</param>
 public void initList(int moduleID)
 {
     if (moduleID == 0)
     {
         MaterialsEditor.DataList = new System.Collections.ArrayList();
         MaterialsEditor.DataBind();
     }
     else if (moduleID > 0)
     {
         MaterialsEditor.DataList = Materials.getAll(moduleID);
         MaterialsEditor.DataBind();
     }
     else
     {
         throw new ArgumentException("Invalid module identifier.", "moduleID");
     }
 }
Пример #18
0
 public override bool CanByMaterial(Materials what, Materials wher)
 {
     //if Dowel || (what && wher)
     if((Array.IndexOf(this.accepted_material, wher)>-1) && (Array.IndexOf(this.accepted_material, what)>-1))
             return true;
     else{
         if((Array.IndexOf(this.accepted_material, Materials.Dowel)>-1) && (Array.IndexOf(this.accepted_material, what)>-1)){
             Dowel dw = Calculator.DowelToScrew(this, what, wher);
             if(dw != null){
                 this.dwl = dw;
             this.is_doweled = dw != null;
             }
             return this.is_doweled;
         }
     }
     return false;
 }
Пример #19
0
        private void SetDefault()
        {
            Time = (double)Helper.Time(Work, Diff);
            // Vaqtni bir soatga to'langan pulga hamma vaqtni ko'paytirib
            if (Diff == 1)
            {
                Work.PricePay *= Time;
            }
            Diffucult = Helper.Diffucults[Diff - 1];
            //if (Diff > 1)
            //{
            using (var db = new SmetaApplication.DbContexts.SmetaDbAppContext())
            {
                // Read Material group
                List <MaterialGroup> list = db.MaterialGroups.ToList().Where(x => x.WorkId == Work.Id).ToList();
                Work.PriceMaterial = 0;
                list.ForEach(x =>
                {
                    var current         = db.Materials.ToList().Where(y => y.Id == x.MaterialId).First();
                    double d            = (double)Helper.Count(x, Diff);
                    Work.PriceMaterial += d * current.Price;
                    Materials.Add(new MaterialMainView()
                    {
                        Count    = d,
                        Material = current,
                        Status   = true
                    });
                });

                // Read Pribor group
                List <PriborGroup> list1 = db.PriborGroups.ToList().Where(x => x.WorkId == Work.Id).ToList();
                Work.PricePribor = 0;
                list1.ForEach(x =>
                {
                    var current       = db.Pribors.ToList().Where(y => y.Id == x.PriborId).First();
                    Work.PricePribor += current.Price * x.Count * current.Percent / 100 / 12 / 30 / 24;
                    //Pribors.Add(new PriborGroupView()
                    //{
                    //    Count = x.Count,
                    //    Pribor = current,
                    //    Status = true
                    //});
                });
            }
            //}
        }
Пример #20
0
        protected virtual void FromGameObjectMaterialsAndTextures(glTF gltf, GameObject go, int bufferIndex)
        {
            Materials = Nodes.SelectMany(x => x.GetSharedMaterials()).Where(x => x != null).Distinct().ToList();
            var unityTextures = Materials.SelectMany(x => TextureIO.GetTextures(x)).Where(x => x.Texture != null).Distinct().ToList();

            TextureManager = new TextureExportManager(unityTextures.Select(x => x.Texture));

            var materialExporter = CreateMaterialExporter();

            gltf.materials = Materials.Select(x => materialExporter.ExportMaterial(x, TextureManager)).ToList();

            for (int i = 0; i < unityTextures.Count; ++i)
            {
                var unityTexture = unityTextures[i];
                TextureIO.ExportTexture(gltf, bufferIndex, TextureManager.GetExportTexture(i), unityTexture.TextureType);
            }
        }
Пример #21
0
        /// <summary>
        /// 修改资料
        /// </summary>
        /// <param name="materials"></param>
        public void Update(Materials materials)
        {
            Materials old = db.Materialses.Where(x => x.Id == materials.Id).FirstOrDefault();

            old.CategoryId    = materials.CategoryId;
            old.Description   = materials.Description;
            old.MaterialsType = materials.MaterialsType;
            old.Source        = materials.Source;
            old.SourceType    = materials.SourceType;
            old.Title         = materials.Title;
            old.Browses       = materials.Browses;

            bool result = db.SaveChanges() > 0;

            base.IsSuccess = result;
            base.ReturnMsg = result ? "修改成功" : "修改失败";
        }
Пример #22
0
        public static void Clear()
        {
            // Clear Resource Directories
            ModelDirectories.Clear();
            ResourceDirectories.Clear();

            // Clear Viewport Models/Instances
            Viewport.SelectedInstances.Clear();
            DefaultCube.Instances.Clear();
            DefaultTerrainGroup.Clear();
            TerrainGroups.Clear();
            Objects.Clear();

            // Clear Resources
            Materials.Clear();
            Textures.Clear();
        }
Пример #23
0
        private void SearchMaterials()
        {
            var searchText = txtSearch.Text.FullTrim().ToLower();

            MaterialsList = Materials.Where(material =>
                                            material.Name.ToLower().Contains(searchText) || material.Code.ToLower().Contains(searchText))
                            .Select(material => new MaterialVm
            {
                Id         = material.Id,
                Code       = material.Code,
                Name       = material.Name,
                Price      = material.Price,
                Quantity   = material.Quantity,
                IsArchived = material.IsArchived
            }).ToList();
            SortMaterials();
        }
Пример #24
0
        // rush fee array

        /*private int[,] RUSH_FEE = new int[3, 3]
         *  {
         *      { 60, 70, 80 },
         *      { 40, 50, 60 },
         *      { 30, 35, 40 }
         *  };*/
        #endregion

        // constructor creates new quote
        public DeskQuote(string name, int width, int depth, int drawers, Materials finish, int rushDays, int quotePrice, DateTime date)
        {
            // save name and date to quote
            CustomerName = name;
            QuoteDate    = date;
            // save inputs to desk object
            Desk.Width   = width;
            Desk.Depth   = depth;
            Desk.Drawers = drawers;
            TurnAround   = rushDays;
            //Desk.Finish = (Materials)Enum.Parse(typeof(Materials), finish);
            Desk.Finish = finish;
            // calculate desk area.
            Desk.Area = width * depth;

            QuotePrice = quotePrice;
        }
Пример #25
0
        private void LoadMaterials()
        {
            var materials = BdoDataService.GetRecipeMatsByRecipeID(Item.Id);

            foreach (var material in materials)
            {
                if (material.IsItem)
                {
                    material.Item = BdoDataService.GetItemById(material.ItemId.Value);
                    Materials.Add(new RecipeMaterialModel
                    {
                        Name   = material.Item.Name,
                        Img    = material.Item.Img,
                        Grade  = material.Item.Grade,
                        IsItem = true,
                        Id     = material.Item.Id,
                        Amount = material.Amount
                    });
                }
                else
                {
                    //Item Group
                    material.ItemGroup = BdoDataService.GetItemGroupById(material.ItemGroupId.Value);
                    BdoItem item = BdoDataService.FirstItemFromItemGroup(material.ItemGroupId.Value);
                    Materials.Add(new RecipeMaterialModel
                    {
                        Name   = material.ItemGroup.Name,
                        Img    = material.ItemGroup.Items[0].Img,
                        Grade  = ItemGrade.White,
                        IsItem = false,
                        Id     = material.ItemGroup.Id,
                        Amount = material.Amount
                    });
                }
            }

            BdoItem result0 = BdoDataService.GetItemById(Item.Item1Id.Value);

            Results.Add(result0);

            if (Item.Item2Id.HasValue)
            {
                BdoItem result1 = BdoDataService.GetItemById(Item.Item2Id.Value);
                Results.Add(result1);
            }
        }
        /// <summary>
        /// Gets a Hashtable of materials by materialID before placing the
        /// keys and values into the DropDownList.
        /// </summary>
        protected void Bind_MatsDDL(Object sender, EventArgs e)
        {
            Hashtable materials = Materials.getAll();

            if (materials != null)
            {
                MatsDDL = (DropDownList)sender;

                if (MatsDDL.Items.Count == 0)
                {
                    foreach (DictionaryEntry pair in materials)
                    {
                        MatsDDL.Items.Add(new ListItem(Convert.ToString(pair.Key), Convert.ToString(pair.Value)));
                    }
                }
            }
        }
Пример #27
0
        public static string ToName(this Materials materials)
        {
            switch (materials)
            {
            case Materials.ИзвестковоМагнитныйФлюс:
                return("ИМФ");

            case Materials.ВлажныйДоломит:
                return("Вл доломит");

            case Materials.ПлавиковыйШпат:
                return("П шпат");

            default:
                return(materials.ToString());
            }
        }
Пример #28
0
 public bool TryAddShader(Shader shader)
 {
     if ((shader == null) || string.IsNullOrEmpty(shader.Name) || Shaders.ContainsKey(shader.Name))
     {
         return(false);
     }
     if (string.IsNullOrEmpty(shader.Material) || !Materials.ContainsKey(shader.Material))
     {
         return(false);
     }
     if (!string.IsNullOrEmpty(shader.Texture) && !Textures.ContainsKey(shader.Texture))
     {
         return(false);
     }
     Shaders.Add(shader.Name, shader);
     return(true);
 }
 public override void RegisterEntities()
 {
     this.RegisterBlock("GeniusIsme.PowerStorageMK1", p => new PowerStorageBlock(p));
     this.RegisterBlock("GeniusIsme.PowerStorageMK2", p => new PowerStorageBlock(p));
     this.RegisterBlock("GeniusIsme.PowerStorageMK3", p => new PowerStorageBlock(p));
     this.RegisterBlock("GeniusIsme.OrganicPowerStorage", p => new PowerStorageBlock(p));
     InductionCharger = this.RegisterBoxMultiblock(
         "GeniusIsme.InductionCharger",
         new Position(5, 1, 5),
         p => new InductionCharger(p),
         p => new PowerStorageFiller <InductionCharger>(p)
         );
     BatteryMk5 = this.RegisterBoxMultiblock(
         "GeniusIsme.BatteryMK5",
         new Position(5, 9, 5),
         p => new BatteryMk5(p),
         p => new PowerStorageFiller <BatteryMk5>(p)
         );
     BatteryMk4 = this.RegisterBoxMultiblock(
         "GeniusIsme.BatteryMK4",
         new Position(3, 3, 3),
         p => new BatteryMk4(p),
         p => new PowerStorageFiller <BatteryMk4>(p)
         );
     Conduit = this.RegisterMultiblock(
         "GeniusIsme.Conduit",
         new List <string> {
         "Placement"
     },
         p => new Conduit(p),
         p => new PowerStorageFiller <Conduit>(p),
         new ConduitBuilder()
         );
     SolarMk2 = this.RegisterBoxMultiblock(
         "GeniusIsme.SolarMk2",
         new Position(3, 1, 3),
         p => new SolarMk2(p),
         p => new Filler <SolarMk2>(p)
         );
     OrganicSolarMk2 = this.RegisterBoxMultiblock(
         "GeniusIsme.OrganicSolarMk2",
         new Position(3, 1, 3),
         p => new OrganicSolarMk2(p),
         p => new Filler <OrganicSolarMk2>(p)
         );
 }
Пример #30
0
        public async Task <Materials> UpdatetMaterials(String material)
        {
            try
            {
                Materials materials = await this.FindMaterialById(material);

                materials.Material = material;
                await this.context.SaveChangesAsync();

                return(materials);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                return(null);
            }
        }
Пример #31
0
        /// <summary>
        /// Imports information into this scene from an IO Model
        /// </summary>
        public override void FromIOModel(IOModel iomodel)
        {
            // copy skeleton
            Skeleton = iomodel.Skeleton;

            // make temp material
            UltimateMaterial material = new UltimateMaterial();

            material.Name  = "SFX_PBS_0100080008008269_opaque";
            material.Label = "skin_sonic_001";

            //TODO more elegant material management
            Materials.Add(material);

            // convert meshes
            SBUltimateModel model = new SBUltimateModel();

            foreach (var iomesh in iomodel.Meshes)
            {
                SBUltimateMesh <UltimateVertex> mesh = new SBUltimateMesh <UltimateVertex>();
                mesh.Name       = iomesh.Name;
                mesh.ParentBone = "";
                mesh.Material   = material;

                model.Meshes.Add(mesh);

                mesh.Indices = iomesh.Indices;

                iomesh.GenerateTangentsAndBitangents();

                foreach (var vertex in iomesh.Vertices)
                {
                    mesh.Vertices.Add(IOToUltimateVertex(vertex));
                }

                //TODO: make more customizable through import settings
                mesh.ExportAttributes.Add(SSBHLib.Tools.MESHAttribute.Position0);
                mesh.ExportAttributes.Add(SSBHLib.Tools.MESHAttribute.Normal0);
                mesh.ExportAttributes.Add(SSBHLib.Tools.MESHAttribute.Tangent0);
                mesh.ExportAttributes.Add(SSBHLib.Tools.MESHAttribute.map1);
                mesh.ExportAttributes.Add(SSBHLib.Tools.MESHAttribute.colorSet1);
            }

            Model = model;
        }
        /// <summary>
        /// Constructor. Initialize all objects.
        /// </summary>
        public GameProcess()
        {
            audioDevice           = new SharpAudioDevice();
            renderForm            = new RenderForm("SharpDX");
            renderForm.ClientSize = new Size(1500, 800);

            renderForm.UserResized += RenderFormResizedCallback;
            renderForm.Activated   += RenderFormActivatedCallback;
            renderForm.Deactivate  += RenderFormDeactivateCallback;
            directX3DGraphics       = new DirectX3DGraphics(renderForm);
            renderer = new Renderer(directX3DGraphics);
            renderer.CreateConstantBuffers();
            directX2DGraphics = new DirectX2DGraphics(directX3DGraphics);
            Loader loader = new Loader(directX3DGraphics, directX2DGraphics, renderer, directX2DGraphics.ImagingFactory);

            samplerStates = new SamplerStates(directX3DGraphics);
            timeHelper    = new TimeHelper();

            InitializeTextures(loader);
            renderer.SetWhiteTexture(textures["white.bmp"]);
            loader.StubTexture = textures["white.bmp"];
            materials          = loader.LoadMaterials("Resources\\materials.txt", textures);

            Vector3 initial = new Vector3(105f, 0, -105f);
            Vector4 pos     = new Vector4(0, 0, 0, 0);

            InitHUDResources();
            InitializeLight();

            inputController = new InputController(renderForm);

            mainCharacterService = new MainCharacterService("some", inputController, loader, materials[3], audioDevice);
            Queue <string> files = new Queue <string>();

            files.Enqueue("Resources\\Description\\map1.txt");
            files.Enqueue("Resources\\Description\\map1.txt");
            levelService = new LevelService(files, mainCharacterService, loader, materials[2], inputController, audioDevice);

            cameraService = new CameraService(new Camera(new Vector4(-119.0f, 144.0f, 129.0f, 1.0f)), inputController);

            Vector4 initialPosition = new Vector4(20.5f, 1f, 20.5f, 1);
            Vector4 position        = initialPosition;

            loader = null;
        }
Пример #33
0
        protected override void Parse(string keyword, string data)
        {
            switch (keyword.ToLower())
            {
            case "v":
                Vertices.Add(ParseVertex(data));
                break;

            case "vp":
                throw new NotImplementedException();
                break;

            case "vn":
                Normals.Add(ParseNormal(data));
                break;

            case "vt":
                TextureVertices.Add(ParseTextureVertex(data));
                break;

            case "g":

                break;

            case "f":
                Faces.Add(ParseFace(data));
                break;

            case "usemtl":
                Materials.Add(_currentMaterial = LoadedMaterials.First(m => m.Name == data));
                break;

            case "mtllib":
                using (var stream = FileSource.Get(data))
                {
                    MaterialFiles.Add(new MATFile(stream, FileSource));
                }
                break;

            default:
                throw new Exception(keyword);
                break;
                //
            }
        }
Пример #34
0
        void OnWizardUpdate()
        {
            if (!Exists(sphere))
            {
                return;
            }

            radius = (radius <= 0) ? 0.001f : radius;
            stacks = (stacks < 3) ? 3 : stacks;
            slices = (slices < 3) ? 3 : slices;

            int verts = (stacks + 1) * (slices + 1);
            int tris  = stacks * slices * 2;

            helpString = string.Format("{0} verts, {1} tris", verts, tris);
            if (verts > 65000)
            {
                errorString = "Mesh.vertices is too large. A mesh may not have more than 65000 vertices.";
                isValid     = false;
                return;
            }
            else
            {
                errorString = "";
                isValid     = true;
            }

            sphere.GetComponent <MeshFilter> ().mesh = GenerateMesh();

            if (material == previousMaterial)
            {
                return;
            }
            switch (material)
            {
            case Materials.DefaultMaterial:
                sphere.GetComponent <Renderer> ().material = AssetDatabase.GetBuiltinExtraResource <Material> ("Default-Material.mat");
                break;

            case Materials.TestMaterial:
                sphere.GetComponent <Renderer> ().material = AssetDatabase.LoadAssetAtPath <Material> ("Assets/ProceduralSphere/Test-Material.mat");
                break;
            }
            previousMaterial = material;
        }
Пример #35
0
 private void buttonX3_Click(object sender, EventArgs e)
 {
     if (superTabControl1.SelectedPanel != null)
     {
         Materials materials = superTabControl1.SelectedTab.Tag as Materials;
         if (materials != null)
         {
             if (materials.status == 0)
             {
                 if (MessageBox.Show("是否已完成当前批次备货?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     materials.SaveMaterialsStatus();
                     superTabControl1.SelectedTab.Image = global::MonitorMain.Properties.Resources.ball_green;
                 }
             }
         }
     }
 }
Пример #36
0
        private void UpdateResources(Materials materials)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(() => UpdateResources(materials));
                return;
            }

            var combos = new FlatComboBox[] {
                this.comboResources1,
                this.comboResources2
            };

            foreach (var combo in combos)
            {
                combo.Refresh();
            }
        }
Пример #37
0
        /// <summary>
        /// Create a new Gcmf object from the given .OBJ / .MTL object.
        /// </summary>
        /// <param name="modelObject">The object from which to create the Gcmf object.</param>
        /// <param name="textureIndexMapping">Correspondence between the textures defined in the model materials and .TPL texture indices.</param>
        public Gcmf(ObjMtlObject modelObject, Dictionary <Bitmap, int> modelTextureMapping)
            : this()
        {
            Dictionary <ObjMtlMaterial, int> modelMaterialMapping = new Dictionary <ObjMtlMaterial, int>();

            foreach (ObjMtlMaterial mat in modelObject.Meshes.Select(m => m.Material))
            {
                modelMaterialMapping.Add(mat, Materials.Count);
                Materials.Add(new GcmfMaterial(mat, modelTextureMapping));
            }

            foreach (ObjMtlMesh mesh in modelObject.Meshes)
            {
                Meshes.Add(new GcmfMesh(mesh, modelMaterialMapping));
            }

            UpdateBoundingSphere();
        }
Пример #38
0
 public List <DeskQuote> GetFiltered(string materialDescr)
 {
     if (materialDescr.Equals("All"))
     {
         return(quotes);
     }
     else
     {
         Materials material = Program.SurfaceMaterialId(materialDescr);
         return(quotes.FindAll
                (
                    delegate(DeskQuote quote)
         {
             return quote.QuotedDesk.SurfaceMaterial == material;
         }
                ));
     }
 }
Пример #39
0
        public override string ToString()
        {
            var str = $"{Name}\r\n    {Description}\r\n需要等级:{Level}\r\n";

            if (!Materials.IsNullOrEmpty())
            {
                str += $"需要材料:{string.Join(",", Materials.Select(m => $"{m.Key}×{m.Value}"))}\r\n";
            }

            if (!Flavorings.IsNullOrEmpty())
            {
                str += $"需要调味料:{string.Join(",", Flavorings.Select(m => $"{m.Key}×{m.Value}"))}\r\n";
            }

            str += $"可提供经验值:{Exp}\r\n特性:{string.Join(",", Attributes)}";
            str += $"\r\n可使用【{ExchangeHonor}】兑换";
            return(str);
        }
Пример #40
0
        public Step14Presenter(ContentControl groupBox)
        {
            _groupBox = groupBox;

            _material = _groupBox.Material();
            _table = _looseMdb.Reader.FetchTable(_material.ToTableName());

            _boxes = _groupBox.FindVisualChild<TextBox>().ToList();
            _comboBox = _groupBox.FindVisualChild<ComboBox>().SingleOrDefault();

            try
            {
                ValidateData();
                InitializeVariants();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Exception", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #41
0
        private static void LooseMass(Materials material)
        {
            var result = false;
            var mass = 0.0;

            while (!result)
            {
                var dialog = new InputBox
                {
                    Caption = string.Format("Введите массу {0} в килограммах:", material.ToGenitive()),
                    ShowInTaskbar = false,
                    Topmost = true
                };

                var showDialog = dialog.ShowDialog();
                if (!showDialog.HasValue || !showDialog.Value) return;

                result = double.TryParse(dialog.ResponseText, NumberStyles.Number, CultureInfo.InstalledUICulture, out mass);
            }

            var substance = Tube.FindSubstance<Навеска>(material);
            substance.G = mass / 1000.0;
        }
Пример #42
0
 public static Dowel DowelToScrew(Screw scr, Materials what, Materials wher)
 {
     foreach(Dowel dwl in Storage.dowelsDB)
     {
         switch (dwl.type) {
         case DowelType.Nail:
             //don't used this way...
             break;
         case DowelType.Butterfly:
             if (wher == Materials.GKL)
             if ((scr.lenght < (dwl.lenght / 0.8)) && (scr.lenght > (dwl.lenght * 0.8)))
             if (scr.d >= dwl.accepted_screw_d [0] && scr.d <= dwl.accepted_screw_d [dwl.accepted_screw_d.Length - 1])
                 return dwl;
             break;
         case DowelType.Standart:
             if ((scr.lenght < (dwl.lenght / 0.8)) && (scr.lenght > (dwl.lenght * 0.8)))
             if (scr.d >= dwl.accepted_screw_d [0] && scr.d <= dwl.accepted_screw_d [dwl.accepted_screw_d.Length - 1])
                 return dwl;
             break;
         }
     }
     return null;
 }
Пример #43
0
 public void SetMaterial(Materials material)
 {
     if (material == Materials.Empty)
     {
         this.Image = null;
         this.Material = Materials.Empty;
     }
     else if (material == Materials.BlackBishop)
     {
         this.Image = This.Images.BlackBishop;
         this.Material = Materials.BlackBishop;
     }
     else if (material == Materials.BlackKing)
     {
         this.Image = This.Images.BlackKing;
         this.Material = Materials.BlackKing;
     }
     else if (material == Materials.BlackKnight)
     {
         this.Image = This.Images.BlackKnight;
         this.Material = Materials.BlackKnight;
     }
     else if (material == Materials.BlackPawn)
     {
         this.Image = This.Images.BlackPawn;
         this.Material = Materials.BlackPawn;
     }
     else if (material == Materials.BlackQueen)
     {
         this.Image = This.Images.BlackQueen;
         this.Material = Materials.BlackQueen;
     }
     else if (material == Materials.BlackRook)
     {
         this.Image = This.Images.BlackRook;
         this.Material = Materials.BlackRook;
     }
     else if (material == Materials.WhiteBishop)
     {
         this.Image = This.Images.WhiteBishop;
         this.Material = Materials.WhiteBishop;
     }
     else if (material == Materials.WhiteKing)
     {
         this.Image = This.Images.WhiteKing;
         this.Material = Materials.WhiteKing;
     }
     else if (material == Materials.WhiteKnight)
     {
         this.Image = This.Images.WhiteKnight;
         this.Material = Materials.WhiteKnight;
     }
     else if (material == Materials.WhitePawn)
     {
         this.Image = This.Images.WhitePawn;
         this.Material = Materials.WhitePawn;
     }
     else if (material == Materials.WhiteQueen)
     {
         this.Image = This.Images.WhiteQueen;
         this.Material = Materials.WhiteQueen;
     }
     else if (material == Materials.WhiteRook)
     {
         this.Image = This.Images.WhiteRook;
         this.Material = Materials.WhiteRook;
     }
 }
Пример #44
0
 public override bool CanByMaterial(Materials what, Materials wher)
 {
     return Array.IndexOf (this.accepted_material, wher) > -1;
 }
Пример #45
0
 public void ReadMaterials(byte[] memory)
 {
     TreeNode res = new TreeNode("Materials pos: 0x" + readerpos.ToString("X4"));
     Materials m = new Materials();
     Mesh.InternalVersion = BitConverter.ToInt32(memory, readerpos);
     m.LodCount = BitConverter.ToInt32(memory, readerpos + 4);
     res.Nodes.Add("LodCount : " + m.LodCount);
     TreeNode t1 = new TreeNode("Lods");
     readerpos += 8;
     m.Lods = new List<Lod>();
     m.MatInst = new List<MaterialInstanceConstant>();
     for (int i = 0; i < m.LodCount; i++)
     {
         Lod l = new Lod();
         l.Guid = new byte[16];
         string t = "Guid: ";
         for (int j = 0; j < 16; j++)
         {
             l.Guid[j] = memory[readerpos];
             t += l.Guid[j].ToString("X2") + " ";
             readerpos++;
         }
         t1.Nodes.Add(new TreeNode(t));
         l.SectionCount = BitConverter.ToInt32(memory, readerpos);
         t1.Nodes.Add(new TreeNode("Section Count : " + l.SectionCount.ToString()));
         l.Sections = new List<Section>();
         readerpos += 4;
         TreeNode t2 = new TreeNode("Sections");
         for (int j = 0; j < l.SectionCount; j++)
         {
             Section s = new Section();
             string q = "Section [" + j.ToString() + "] : {(Name)";
             //s.Name = BitConverter.ToInt32(memory, readerpos);
             //if (s.Name > 0)
             //    m.MatInst.Add(new MaterialInstanceConstant(pcc, s.Name - 1));
             //    q += pcc.getObjectName(s.Name) + " ; ";
             //else
             q += s.Name.ToString() + " ; ";
             s.Unk1 = BitConverter.ToInt32(memory, readerpos + 4);
             q += s.Unk1.ToString() + " ; ";
             s.Unk2 = BitConverter.ToInt32(memory, readerpos + 8);
             q += s.Unk2.ToString() + " ; ";
             s.Unk3 = BitConverter.ToInt32(memory, readerpos + 12);
             q += s.Unk3.ToString() + " ; (FirstIdx)";
             s.FirstIdx1 = BitConverter.ToInt32(memory, readerpos + 16);
             q += s.FirstIdx1.ToString() + " ; (NumFaces)";
             s.NumFaces1 = BitConverter.ToInt32(memory, readerpos + 20);
             q += s.NumFaces1.ToString() + " ; (VertexMin)";
             s.MatEff1 = BitConverter.ToInt32(memory, readerpos + 24);
             q += s.MatEff1.ToString() + " ; (VertexMax)";
             s.MatEff2 = BitConverter.ToInt32(memory, readerpos + 28);
             q += s.MatEff2.ToString() + " ; ";
             s.Unk4 = BitConverter.ToInt32(memory, readerpos + 32);
             q += s.Unk4.ToString() + " ; ";
             s.Unk5 = BitConverter.ToInt32(memory, readerpos + 36);
             q += s.Unk5.ToString() + " ; (FirstIdx)";
             if (s.Unk5 == 1)
             {
                 s.FirstIdx2 = BitConverter.ToInt32(memory, readerpos + 40);
                 q += s.FirstIdx2.ToString() + " ; (NumFaces)";
                 s.NumFaces2 = BitConverter.ToInt32(memory, readerpos + 44);
                 q += s.NumFaces2.ToString() + " ; ";
                 s.Unk6 = memory[readerpos + 48];
                 q += s.Unk6.ToString() + "}";
             }
             else
             {
                 s.Unk6 = memory[readerpos + 40];
                 s.FirstIdx2 = BitConverter.ToInt32(memory, readerpos + 41);
                 q += s.FirstIdx2.ToString() + " ; (NumFaces)";
                 s.NumFaces2 = BitConverter.ToInt32(memory, readerpos + 45);
                 q += s.NumFaces2.ToString() + " ; ";                        
                 q += s.Unk6.ToString() + "}";
             }
             t2.Nodes.Add(q);
             readerpos += 49;
             l.Sections.Add(s);
         }
         t1.Nodes.Add(t2);
         l.SizeVert = BitConverter.ToInt32(memory, readerpos);
         t1.Nodes.Add(new TreeNode("Size Verts : " + l.SizeVert.ToString()));
         l.NumVert = BitConverter.ToInt32(memory, readerpos + 4);
         t1.Nodes.Add(new TreeNode("Num Vert : " + l.NumVert.ToString()));
         l.LodCount = BitConverter.ToInt32(memory, readerpos + 8);
         t1.Nodes.Add(new TreeNode("Lod Count : " + l.LodCount.ToString()));
         if(l.Sections[0].Unk5 == 1)
             readerpos += 12;
         else
             readerpos += 4;
         m.Lods.Add(l);
     }
     res.Nodes.Add(t1);
     TreeNode t3 = new TreeNode("Materials");
     for (int i = 0; i < m.MatInst.Count(); i++)
         t3.Nodes.Add(m.MatInst[i].ToTree());
     res.Nodes.Add(t3);
     m.t = res;
     Mesh.Mat = m;
 }
Пример #46
0
 private void SetMaterialToCustom()
 {
     material = Materials.Custom;
 }
Пример #47
0
 public abstract bool CanPassByForce(int vector, float force, float objLenght, Materials wher);
Пример #48
0
        /// <summary>
        /// Add or modify material group
        /// <para>If there are no material with selected name, material would be created</para>
        /// <para>If material with selected name exist, it would be updated</para>
        /// </summary>
        /// <param name="Model">editor model(universal model for data exchange)</param>
        /// <returns>true- operation has done successful</returns>
        public bool AddOrModifyMaterial(EditorModel Model)
        {
            bool ret = true;
            var foundedMaterialGroup = DBBase.Context.MaterialGroups.SingleOrDefault(p => p.Name == Model.SelectedMaterialGroup);
            int DetectedMaterialGroupID;
            int DetectedUserID = GetUserIDByName(User.Identity.Name);
            if (foundedMaterialGroup != null)
            {
                DetectedMaterialGroupID = foundedMaterialGroup.MaterialGroupID;
                var foundedMaterial = DBBase.Context.Materials.SingleOrDefault(p => p.Name == Model.SelectedMaterial && p.MaterialGroupID == DetectedMaterialGroupID); //Выбираем материал по Имени и ID мат.групппы
                if (foundedMaterial == null)
                {
                    Materials creation = new Materials { MaterialGroupID = DetectedMaterialGroupID, Name = Model.NewMaterialName, HTML = Model.HTML, FirstCreatorID = DetectedUserID, LastModifierID = DetectedUserID, LastChange = DateTime.Now, isPublished = Model.isPublished };
                    DBBase.Context.Materials.Add(creation);
                    DBBase.Context.SaveChanges();
                }
                else { // Founded material
                    Materials Modification = DBBase.Context.Materials.SingleOrDefault(p => p.Name == Model.SelectedMaterial && p.MaterialGroupID == DetectedMaterialGroupID);
                    Modification.HTML = Model.HTML;
                    Modification.LastModifierID = DetectedUserID;
                    Modification.LastChange = DateTime.Now;
                    Modification.isPublished = Model.isPublished;
                    DBBase.Context.Entry(Modification).State = EntityState.Modified;
                    DBBase.Context.SaveChanges();
                }

            }
            return ret;
        }
Пример #49
0
 public static Mount FromString(string s)
 {
     string[] attribs = s.Split (' ');
     if (attribs [0] == "Driven" || attribs [0] == "Frame" || attribs [0] == "Sleeve" || attribs [0] == "Wedged") {
         //this is anchor
         AnchorType type;
         float max_avlution_force, max_cut_force, max_a, max_s;
         float d, lenght, bolt_d;
         bool is_trughwall;
         string[] accepted_m = attribs [6].Split (',');
         Materials[] accepted_materials = new Materials[accepted_m.Length];
         Enum.TryParse (attribs [0], out type);
         float.TryParse (attribs [1], out max_avlution_force);
         float.TryParse (attribs [2], out max_cut_force);
         bool.TryParse (attribs [3], out is_trughwall);
         float.TryParse (attribs [4], out d);
         float.TryParse (attribs [5], out lenght);
         float.TryParse (attribs [7], out max_a);
         float.TryParse (attribs [8], out max_s);
         float.TryParse (attribs [9], out bolt_d);
         for (int i = 0; i < accepted_m.Length; i++)
             Enum.TryParse (accepted_m [i], out accepted_materials [i]);
         return new Anchor (type, max_avlution_force, max_cut_force, is_trughwall, d, lenght, accepted_materials, max_a, max_s, bolt_d);
     } else if (attribs [0] == "Standart" || attribs [0] == "Butterfly" || attribs [0] == "Nail") {
         //this is dowel
         DowelType type;
         float max_avlusion_force, max_cut_force, max_a, max_s;
         float[] accepted_d;
         int d, lenght;
         bool is_troughwall, is_selfdrill;
         Materials[] accepted_materials;
         Enum.TryParse (attribs [0], out type);
         float.TryParse (attribs [1], out max_avlusion_force);
         float.TryParse (attribs [2],out  max_cut_force);
         bool.TryParse (attribs [3], out is_troughwall);
         bool.TryParse (attribs [4],out  is_selfdrill);
         int.TryParse (attribs [5], out d);
         int.TryParse (attribs [6], out lenght);
         string[] accepted_m = attribs [7].Split (',');
         accepted_materials = new Materials[accepted_m.Length];
         for (int i = 0; i < accepted_m.Length; i++)
             Enum.TryParse (accepted_m [i], out accepted_materials [i]);
         float.TryParse (attribs [8], out max_a);
         float.TryParse (attribs [9], out max_s);
         accepted_m = attribs [10].Split (';');
         accepted_d = new float[accepted_m.Length];
         for (int i = 0; i < accepted_m.Length; i++)
             float.TryParse (accepted_m [i], out accepted_d [i]);
         return new Dowel (type, max_avlusion_force, max_cut_force, is_troughwall, is_selfdrill, d, lenght, accepted_materials, max_a, max_s, accepted_d);
     } else if (attribs [0] == "Tree" || attribs [0] == "Metal" || attribs [0] == "PO" || attribs [0] == "PS" || attribs [0] == "Roof" || attribs [0] == "Uni" || attribs [0] == "Capercaillie" || attribs [0] == "Concerete") {
         //This is Screw
         ScrewType type;
         float max_avlusion_force, max_cut_force, max_a, max_s;
         float d, lenght;
         bool is_troughwall, is_selfdrill;
         Materials[] accepted_materials;
         Enum.TryParse (attribs [0], out type);
         float.TryParse (attribs [1], out max_avlusion_force);
         float.TryParse(attribs[2], out max_cut_force);
         bool.TryParse (attribs [3], out is_troughwall);
         bool.TryParse (attribs [4], out is_selfdrill);
         float.TryParse (attribs [5], out d);
         float.TryParse (attribs [6], out lenght);
         string[] accepted_m = attribs [7].Split (',');
         accepted_materials = new Materials[accepted_m.Length];
         for (int i = 0; i < accepted_m.Length; i++)
             Enum.TryParse (accepted_m [i], out accepted_materials [i]);
         float.TryParse (attribs [8], out max_a);
         float.TryParse (attribs [9], out max_s);
         return new Screw (type, max_avlusion_force, max_cut_force, is_troughwall, is_selfdrill, d, lenght, accepted_materials, max_a, max_s);
     } else {
         //we have some error oO
         throw new Exception ("Can't parse string!");
     }
 }
Пример #50
0
 public void SetSoundMaterial(Materials t)
 {
     material = t;
     Play();
 }
Пример #51
0
		public static void ConvertDB (string filename)
		{
			StreamReader reader = new StreamReader (filename);
			StreamWriter writer1 = new StreamWriter("Anchors.dat");
			StreamWriter writer2 = new StreamWriter("Dowels.dat");
			StreamWriter writer3 = new StreamWriter("Screw.dat");

            string s;
            while ((s = reader.ReadLine()) != null)
            {
				AnchorType ant;
				DowelType dwl;
				ScrewType scrw;
                float max_avulsion_force;
		        float max_cut_force;
		        bool is_selfdrill;
                bool is_throughwall;
		        float d;
		        float lenght;
		        Materials[] accepted_material;
		        float max_a;
		        float max_s;
				float[] accepted_screw_d;
				string[] srs = s.Split (' ');
				string[] srs1;
				switch (srs [0]) {
				case "Анкер/болтсгайкой":
					ant = AnchorType.Wedged;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Brick, Materials.Concrete, Materials.FoamBlock};
					anchorsDB.Add (new Anchor (ant, max_avulsion_force, max_cut_force, is_throughwall, d, lenght, accepted_material, max_a, max_s, 0));
					break;
				case "Клиновойанкер":
					ant = AnchorType.Sleeve;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Brick, Materials.Concrete, Materials.FoamBlock};
					anchorsDB.Add (new Anchor (ant, max_avulsion_force, max_cut_force, is_throughwall, d, lenght, accepted_material, max_a, max_s, 0));
					break;
				case "Забивнойанкер":
					ant = AnchorType.Driven;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in KGS, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Brick, Materials.Concrete, Materials.FoamBlock};
					anchorsDB.Add (new Anchor (ant, max_avulsion_force, max_cut_force, is_throughwall, d, lenght, accepted_material, max_a, max_s, d));
					break;
				case "БолтDIN933":
					//
					break;
				case "ГлухарьDIN571":
					scrw = ScrewType.Capercaillie;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Tree, Materials.Dowel};
					screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
					break;
				case "Дюбель\"бабочка\"":
					dwl = DowelType.Butterfly;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow(d/2, 2));//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = true;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.GKL, Materials.Tree};
					accepted_screw_d = new float[3];
					accepted_screw_d [0] = (float)4.2;
					accepted_screw_d [1] = (float)4.5;
					accepted_screw_d [2] = 5;
					max_cut_force = accepted_screw_d[2] * 5 * 100;
					dowelsDB.Add(new Dowel(dwl, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s,accepted_screw_d));
					break;
				case "Дюбельсшурупом":
					dwl = DowelType.Nail;
					srs1 = srs [srs.Length - 2].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1.5)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (float)((0.07f*4f*Math.PI*Math.Pow(d/2, 2))/0.13f);
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Brick, Materials.FoamBlock, Materials.Concrete};
					accepted_screw_d = new float[3];
					accepted_screw_d[0] = (float)(d-2.5);
					accepted_screw_d[1] = d-2;
					accepted_screw_d[2] = (float)(d-1.5);
					max_cut_force = accepted_screw_d[2] * 5 * 100;
					dowelsDB.Add(new Dowel(dwl, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s,accepted_screw_d));
					break;
				case "Дюбельполипр.":
					dwl = DowelType.Standart;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.GKL, Materials.Tree};
					accepted_screw_d = new float[3];
					accepted_screw_d[0] = (float)(d-2.5);
					accepted_screw_d[1] = d-2;
					accepted_screw_d[2] = (float)(d-1.5);
					max_cut_force = accepted_screw_d[2] * 5 * 100;
					dowelsDB.Add(new Dowel(dwl, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s,accepted_screw_d));
					break;
				case "Рамныйанкер":
					ant = AnchorType.Frame;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Brick, Materials.Concrete, Materials.FoamBlock};
					anchorsDB.Add (new Anchor (ant, max_avulsion_force, max_cut_force, is_throughwall, d, lenght, accepted_material, max_a, max_s, 0));
					break;
				case "Саморезскруп.рез./по":
					scrw = ScrewType.Tree;
					srs1 = srs [srs.Length - 2].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.GKL, Materials.Tree, Materials.Dowel};
					screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
					break;
				case "Саморезсчаст.рез./по":
					scrw = ScrewType.Metal;
					srs1 = srs [srs.Length - 2].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Tree, Materials.Metal, Materials.GKL, Materials.Dowel};
					screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
					break;
				case "Саморезспрессшайбой":
					switch(srs[2])
					{
					case "острый":
						scrw = ScrewType.PO;
						srs1 = srs [srs.Length - 3].Split ('х');
						d = float.Parse (srs1 [0]);
						lenght = float.Parse (srs1 [1]);
						max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
						max_avulsion_force = (0.07f*max_cut_force)/0.13f;
						is_selfdrill = false;
						is_throughwall = false;
						max_a = lenght * (float)1.5;
						max_s = lenght * 3;
						accepted_material = new Materials[]{Materials.Tree, Materials.Metal, Materials.GKL, Materials.Dowel};
						screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
						break;
					case "сверло":
						scrw = ScrewType.PS;
						srs1 = srs [srs.Length - 3].Split ('х');
						d = float.Parse (srs1 [0]);
						lenght = float.Parse (srs1 [1]);
						max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
						max_avulsion_force = (0.07f*max_cut_force)/0.13f;
						is_selfdrill = true;
						is_throughwall = false;
						max_a = lenght * (float)1.5;
						max_s = lenght * 3;
						accepted_material = new Materials[]{Materials.Tree, Materials.Metal, Materials.GKL};
						screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
						break;
					}
					break;
				case "Саморезпо":
					scrw = ScrewType.Concerete;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Concrete, Materials.Brick, Materials.FoamBlock};
					screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
					break;
				case "Саморез":
					scrw = ScrewType.Roof;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = true;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Tree, Materials.Metal};
					screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
					break;
				case "Шуруп":
					scrw = ScrewType.Uni;
					srs1 = srs [srs.Length - 1].Split ('х');
					d = float.Parse (srs1 [0]);
					lenght = float.Parse (srs1 [1]);
					max_cut_force = (float)(300f*Math.PI*Math.Pow((d-1)/2, 2)/2);//in Newtons, http://rostfrei.ru/edelstahl.nsf/pages/grade
					max_avulsion_force = (0.07f*max_cut_force)/0.13f;
					is_selfdrill = false;
					is_throughwall = false;
					max_a = lenght * (float)1.5;
					max_s = lenght * 3;
					accepted_material = new Materials[]{Materials.Tree, Materials.Metal, Materials.GKL, Materials.Dowel};
					screwDB.Add (new Screw (scrw, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s));
					break;
				}
            }
			foreach (Anchor anch in anchorsDB)
				writer1.WriteLine (anch.ToString ());
			foreach (Dowel dwl in dowelsDB)
				writer2.WriteLine (dwl.ToString ());
			foreach (Screw scrw in screwDB)
				writer3.WriteLine (scrw.ToString ());
			reader.Close ();
			writer1.Close ();
			writer2.Close ();
			writer3.Close ();
		}
Пример #52
0
 public abstract bool CanByMaterial(Materials what, Materials wher);
Пример #53
0
		public static void ReadDataResoursesDowels ()
		{
			DowelType type;
			float max_avulsion_force;
			float max_cut_force;
			bool is_throughwall;
			bool is_selfdrill;
			float d;
			float lenght;
			Materials[] accepted_material;
			float max_a;
			float max_s;
			float[] accepted_screw_d;

			string s;
			StreamReader strr = new StreamReader(GetStreamFromResource("Summer_work.Data.Dowels.dat"));
			while ((s = strr.ReadLine()) != null) {
				if(s[0] == '#')
					while ((s = strr.ReadLine ()) != null && (s[0] == '#'));
				if(s == null)
					return;
				string t;
				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);
				Summer_work.DowelType.TryParse<Summer_work.DowelType> (t, out type);
				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);
				max_avulsion_force = float.Parse (t);
				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);
				max_cut_force = float.Parse (t);
				if (s [0] == '1')
					is_throughwall = true;
				else
					is_throughwall = false;
				s = s.Remove (0, 2);
				if (s [0] == '1')
					is_selfdrill = true;
				else
					is_selfdrill = false;
				s = s.Remove (0, 2);
				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);
				d = float.Parse (t);
				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);
				lenght = float.Parse (t);
				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);

				//Используя регулярные выражения (pattern - что ищем, source - где ищем):
				int sizeOfMat = new Regex (",").Matches (t).Count;
				accepted_material = new Materials[sizeOfMat+1];
				for (int i = 0; i < sizeOfMat; i++) {
					string t1 = t.Substring (0, t.IndexOf (","));
					t = t.Remove (0, t.IndexOf (",") + 1);
					Materials.TryParse<Summer_work.Materials> (t1, out accepted_material [i]);

				}
				Materials.TryParse<Summer_work.Materials> (t, out accepted_material [sizeOfMat]);

				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);
				max_a = float.Parse (t);
				t = s.Substring (0, s.IndexOf (" "));
				s = s.Remove (0, s.IndexOf (" ") + 1);
				max_s = float.Parse (t);

				int sizeOfScr = new Regex(";").Matches(s).Count;

				accepted_screw_d = new float[sizeOfScr+1];
				for(int i = 0; i < sizeOfScr; i++)
				{
					string t1 = s.Substring(0, s.IndexOf(";"));
					s =s.Remove(0, s.IndexOf(";")+1);
					accepted_screw_d[i] = float.Parse(t1);
				}
				accepted_screw_d[sizeOfScr] = float.Parse(s);
				max_cut_force = accepted_screw_d [sizeOfScr - 1] * 5 * 100;
				Dowel dw = new Dowel (type, max_avulsion_force, max_cut_force, is_throughwall, is_selfdrill, d, lenght, accepted_material, max_a, max_s, accepted_screw_d);

				Storage.dowelsDB.Add (dw);
			}
		}
Пример #54
0
 public override void SetMaterial(Materials.Material mm)
 {
     m.SetMaterial(mm);
 }
 private void ChangeMaterial(ModelUIElement3D model, Materials material)
 {
     GeometryModel3D geometry = (model.Model as Model3DGroup).Children.Last() as GeometryModel3D;
     geometry.Material = geometry.BackMaterial = _ViewPort.Style.Resources[material.ToString()] as MaterialGroup;
 }
Пример #56
0
    private void ShowBuildingBlocksUI()
    {
        float overallHeight = 0f;

        contentPanel.sizeDelta = new Vector2(GetComponent<RectTransform>().sizeDelta.x, 0);
        for (int i = 0; i < buildingBlocks.Length; i++)
        {
            RectTransform tmpRect = Instantiate(buildBlockUIPrefab).GetComponent<RectTransform>();
            BuildingBlockGUIInfo tmpGUIInfo = tmpRect.GetComponent<BuildingBlockGUIInfo>();

            blockInfo[i] = buildingBlocks[i].GetComponent<BuildingBlockInfo>();
            guiInfos[i] = tmpGUIInfo;

            tmpGUIInfo.icon.sprite = blockInfo[i].woodIcon;
            //tmpGUIInfo.title.text = buildingBlocks[i].name;
            tmpGUIInfo.prefab = buildingBlocks[i];
            tmpRect.SetParent(contentPanel);
            overallHeight += tmpRect.sizeDelta.y;

            tmpGUIInfo.icon.SetNativeSize();
            //tmpGUIInfo.icon.rectTransform.

            //We need to distinguish between enemy objects and blocks. Therefore we give each button the respective drag behaviour
            DragBuildingBlock tmpDrag = tmpRect.gameObject.AddComponent<DragBuildingBlock>();
            tmpDrag.info = tmpRect.GetComponent<BuildingBlockGUIInfo>();
        }
        currentMaterial = Materials.Wood;
        contentPanel.sizeDelta = new Vector2(contentPanel.sizeDelta.x, overallHeight);
    }
Пример #57
0
    private static void ProcessOneRow2(ExcelClass xls, int iRow, ref string message, List<Position> positions, GroupElement group, string fileName, int posType)
    {
        string name = xls.GetCellStringValue(_nameColName, iRow);
        string title = xls.GetCellStringValue(_titleColName, iRow);
        if (string.IsNullOrEmpty(title))
        {
            message +=
                fileName + " - в " + iRow +
                " строке позиция без обозначения!" + Environment.NewLine;
            _userLog.WriteLine("*** Ошибка! *** " + message);
            _logger.WriteError(message);
            return;
        }

        string doc, year = "";
        if (_docColName == _yearColName)
        {
            doc = xls.GetCellStringValue(_docColName, iRow);
            string[] split = doc.Split('-');
            if (split.Length > 0)
            {
                doc = "";
                for (int i = 0; i < split.Length - 1; i++)
                {
                    doc += split[i];
                }
                year = split[split.Length - 1];
            }

        }
        else if (string.IsNullOrEmpty(_yearColName.Trim()))
        {
            doc = xls.GetCellStringValue(_docColName, iRow);
            year = "";
        }
        else
        {
            doc = xls.GetCellStringValue(_docColName, iRow);
            year = xls.GetCellStringValue(_yearColName, iRow);
        }

        Position pos = null;
        switch (posType)
        {
                case 2:
                    pos = new Materials(name, title, group,
                                                             GetPositionParams(xls, iRow),
                                                             doc,
                                                             year);
                break;
                case 1:
                    pos = new BuyInstrument(name, title, group,
                                                         GetPositionParams(xls, iRow),
                                                         doc,
                                                         year);
                    break;
                case 0:
                    pos = new Machine(name, title, group,
                                                         GetPositionParams(xls, iRow),
                                                         doc,
                                                         year);
                    break;
                case 3:
                    pos = new AssembleInstrument(name, title, group,
                                                         GetPositionParams(xls, iRow),
                                                         doc,
                                                         year);
                    break;
                case 4:
                    pos = new MeasureInstrument(name, title, group,
                                                         GetPositionParams(xls, iRow),
                                                         doc,
                                                         year);
                break;
        }

        positions.Add(pos);
    }
Пример #58
0
    private void ChangeMaterial(Materials m)
    {
        for (int i = 0; i < guiInfos.Length; i++)
        {
            switch (m)
            {
                case Materials.Wood:
                    if (blockInfo[i].woodIcon)
                    {
                        guiInfos[i].icon.sprite = blockInfo[i].woodIcon;
                        switchButtonIcon.sprite = woodToIce;
                    }
                    break;
                case Materials.Ice:
                    if (blockInfo[i].iceIcon)
                    {
                        guiInfos[i].icon.sprite = blockInfo[i].iceIcon;
                        switchButtonIcon.sprite = IceToStone;
                    }
                    break;
                case Materials.Stone:
                    if (blockInfo[i].stoneIcon)
                    {
                        guiInfos[i].icon.sprite = blockInfo[i].stoneIcon;
                        switchButtonIcon.sprite = StoneToWood;
                    }
                    break;
            }
            TurnVisible(guiInfos[i].icon, blockInfo[i]);
        }

        currentMaterial = m;
    }
Пример #59
0
 public Blueprint()
 {
     _materials = new Materials(new List<Material>(),this);
 }
Пример #60
0
 public override bool CanByMaterial(Materials what, Materials wher)
 {
     return (what != Materials.GKL) && (Array.IndexOf(this.accepted_material, wher)>-1);
 }