/// <summary> /// machine post part /// </summary> /// <returns></returns> private Model3DGroup CreateMachinePostPart() { try { double toppoint = 10.5; double bottompoint = -4; SquareModel squaremodel = new SquareModel(); Model3DGroup machinepostgroup = new Model3DGroup(); Model3DGroup machinepostlinegroup = new Model3DGroup(); Point3D[] machinepost1 = new Point3D[8]; Point3D[] machinepost2 = new Point3D[8]; Point3D[] machinepost3 = new Point3D[8]; Point3D[] machinepost4 = new Point3D[8]; double x1 = 12.89; double x2 = 8.37; double z1 = 3.95; double z2 = 6; machinepost1[0] = new Point3D(-x1, bottompoint, z1); machinepost1[1] = new Point3D(-x2 - .1, bottompoint, z1); machinepost1[2] = new Point3D(-x2 - .1, bottompoint, z2); machinepost1[3] = new Point3D(-x1, bottompoint, z2); machinepost1[4] = new Point3D(-x1, toppoint + _UpDownToppartPosition, z1); machinepost1[5] = new Point3D(-x2 - .1, toppoint + _UpDownToppartPosition, z1); machinepost1[6] = new Point3D(-x2 - .1, toppoint + _UpDownToppartPosition, z2); machinepost1[7] = new Point3D(-x1, toppoint + _UpDownToppartPosition, z2); machinepost2[0] = new Point3D(-x1, bottompoint, -z2); machinepost2[1] = new Point3D(-x2 - .1, bottompoint, -z2); machinepost2[2] = new Point3D(-x2 - .1, bottompoint, -z1); machinepost2[3] = new Point3D(-x1, bottompoint, -z1); machinepost2[4] = new Point3D(-x1, toppoint + _UpDownToppartPosition, -z2); machinepost2[5] = new Point3D(-x2 - .1, toppoint + _UpDownToppartPosition, -z2); machinepost2[6] = new Point3D(-x2 - .1, toppoint + _UpDownToppartPosition, -z1); machinepost2[7] = new Point3D(-x1, toppoint + _UpDownToppartPosition, -z1); machinepost3[0] = new Point3D(x2 + .1, bottompoint, -z2); machinepost3[1] = new Point3D(x1, bottompoint, -z2); machinepost3[2] = new Point3D(x1, bottompoint, -z1); machinepost3[3] = new Point3D(x2 + .1, bottompoint, -z1); machinepost3[4] = new Point3D(x2 + .1, toppoint + _UpDownToppartPosition, -z2); machinepost3[5] = new Point3D(x1, toppoint + _UpDownToppartPosition, -z2); machinepost3[6] = new Point3D(x1, toppoint + _UpDownToppartPosition, -z1); machinepost3[7] = new Point3D(x2 + .1, toppoint + _UpDownToppartPosition, -z1); machinepost4[0] = new Point3D(x2 - .1, bottompoint, z1); machinepost4[1] = new Point3D(x1, bottompoint, z1); machinepost4[2] = new Point3D(x1, bottompoint, z2); machinepost4[3] = new Point3D(x2 - .1, bottompoint, z2); machinepost4[4] = new Point3D(x2 - .1, toppoint + _UpDownToppartPosition, z1); machinepost4[5] = new Point3D(x1, toppoint + _UpDownToppartPosition, z1); machinepost4[6] = new Point3D(x1, toppoint + _UpDownToppartPosition, z2); machinepost4[7] = new Point3D(x2 - .1, toppoint + _UpDownToppartPosition, z2); if (!_IsImageTexture) { machinepostgroup.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachinePost], machinepost1)); machinepostgroup.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachinePost], machinepost2)); machinepostgroup.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachinePost], machinepost3)); machinepostgroup.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachinePost], machinepost4)); machinepostgroup.Children.Add(machinepostlinegroup); } else { string[] postpicleft = new string[6]; postpicleft[0] = _ImagePath + "PostLeft_F.png"; postpicleft[1] = _ImagePath + "PostRight_B.png"; postpicleft[2] = _ImagePath + "PostRight_LR.png"; postpicleft[3] = _ImagePath + "PostRight_LR.png"; postpicleft[4] = _ImagePath + "PostLeft_F.png"; postpicleft[5] = _ImagePath + "PostLeft_F.png"; string[] postpicleft2 = new string[6]; postpicleft2[0] = _ImagePath + "PostLeft_F.png"; postpicleft2[1] = _ImagePath + "PostRight_B.png"; postpicleft2[2] = _ImagePath + "PostLeft_LR.png"; postpicleft2[3] = _ImagePath + "PostLeft_LR.png"; postpicleft2[4] = _ImagePath + "PostLeft_F.png"; postpicleft2[5] = _ImagePath + "PostLeft_F.png"; string[] postpicright = new string[6]; postpicright[0] = _ImagePath + "PostRight_F.png"; postpicright[1] = _ImagePath + "PostLeft_B.png"; postpicright[2] = _ImagePath + "PostLeft_LR.png"; postpicright[3] = _ImagePath + "PostLeft_LR.png"; postpicright[4] = _ImagePath + "PostRight_F.png"; postpicright[5] = _ImagePath + "PostRight_F.png"; string[] postpicright2 = new string[6]; postpicright2[0] = _ImagePath + "PostRight_F.png"; postpicright2[1] = _ImagePath + "PostLeft_B.png"; postpicright2[2] = _ImagePath + "PostRight_LR.png"; postpicright2[3] = _ImagePath + "PostRight_LR.png"; postpicright2[4] = _ImagePath + "PostRight_F.png"; postpicright2[5] = _ImagePath + "PostRight_F.png"; //machinepostgroup.Children.Add(squaremodel.CreatePosts(machinetexture, machinepost1, false, ptexture0, ptexture1)); //machinepostgroup.Children.Add(squaremodel.CreatePosts(machinetexture, machinepost2, false, ptexture0, ptexture1)); //machinepostgroup.Children.Add(squaremodel.CreatePosts(machinetexture, machinepost3, false, ptexture0, ptexture1)); //machinepostgroup.Children.Add(squaremodel.CreatePosts(machinetexture, machinepost4, false, ptexture0, ptexture1)); machinepostgroup.Children.Add(squaremodel.Create(postpicleft, machinepost1, false)); machinepostgroup.Children.Add(squaremodel.Create(postpicleft2, machinepost2, false)); machinepostgroup.Children.Add(squaremodel.Create(postpicright2, machinepost3, false)); machinepostgroup.Children.Add(squaremodel.Create(postpicright, machinepost4, false)); machinepostgroup.Children.Add(machinepostlinegroup); } machinepostgroup.Transform = new Transform3DGroup(); machinepostlinegroup.Transform = new Transform3DGroup(); _Log4NetClass.ShowInfo("Create MachinePostPart Model3D Success", "CreateMachinePostPart"); return machinepostgroup; } catch (Exception ex) { _Log4NetClass.ShowError(ex.ToString(), "CreateMachinePostPart"); throw ex; } }
/// <summary> /// create top part model /// </summary> /// <returns></returns> private Model3DGroup CreateTopPart() { try { SquareModel squaremodel = new SquareModel(); EllipseModel ellipsemodel = new EllipseModel(); Model3DGroup toppartgroup = new Model3DGroup(); Model3DGroup topplatemodel = new Model3DGroup(); Model3DGroup topshaftgroup = new Model3DGroup(); Transform3DGroup topplatetran = new Transform3DGroup(); Transform3DGroup topparttran = new Transform3DGroup(); double ramwidth = 8.5; double ramdeep = 4; double mechwidth = 7.5; double mechdeep = 3.5; double platewidth = 6.5; double platedeep = 2.8; Point3D[] topmechpoint = new Point3D[8]; Point3D[] topplatepoint = new Point3D[8]; Point3D[] toprampoint = new Point3D[8]; Point3D[] topstripperpoint = new Point3D[8]; toprampoint[0] = new Point3D(-ramwidth, 8 + _UpDownToppartPosition, -ramdeep); toprampoint[1] = new Point3D(ramwidth, 8 + _UpDownToppartPosition, -ramdeep); toprampoint[2] = new Point3D(ramwidth, 8 + _UpDownToppartPosition, ramdeep); toprampoint[3] = new Point3D(-ramwidth, 8 + _UpDownToppartPosition, ramdeep); toprampoint[4] = new Point3D(-ramwidth, 9.5 + _UpDownToppartPosition, -ramdeep); toprampoint[5] = new Point3D(ramwidth, 9.5 + _UpDownToppartPosition, -ramdeep); toprampoint[6] = new Point3D(ramwidth, 9.5 + _UpDownToppartPosition, ramdeep); toprampoint[7] = new Point3D(-ramwidth, 9.5 + _UpDownToppartPosition, ramdeep); topmechpoint[0] = new Point3D(-mechwidth, 7 + _UpDownToppartPosition, -mechdeep); topmechpoint[1] = new Point3D(mechwidth, 7 + _UpDownToppartPosition, -mechdeep); topmechpoint[2] = new Point3D(mechwidth, 7 + _UpDownToppartPosition, mechdeep); topmechpoint[3] = new Point3D(-mechwidth, 7 + _UpDownToppartPosition, mechdeep); topmechpoint[4] = new Point3D(-mechwidth, 8 + _UpDownToppartPosition, -mechdeep); topmechpoint[5] = new Point3D(mechwidth, 8 + _UpDownToppartPosition, -mechdeep); topmechpoint[6] = new Point3D(mechwidth, 8 + _UpDownToppartPosition, mechdeep); topmechpoint[7] = new Point3D(-mechwidth, 8 + _UpDownToppartPosition, mechdeep); topplatepoint[0] = new Point3D(-platewidth, 6 + _UpDownToppartPosition, -platedeep); topplatepoint[1] = new Point3D(platewidth, 6 + _UpDownToppartPosition, -platedeep); topplatepoint[2] = new Point3D(platewidth, 6 + _UpDownToppartPosition, platedeep); topplatepoint[3] = new Point3D(-platewidth, 6 + _UpDownToppartPosition, platedeep); topplatepoint[4] = new Point3D(-platewidth, 7 + _UpDownToppartPosition, -platedeep); topplatepoint[5] = new Point3D(platewidth, 7 + _UpDownToppartPosition, -platedeep); topplatepoint[6] = new Point3D(platewidth, 7 + _UpDownToppartPosition, platedeep); topplatepoint[7] = new Point3D(-platewidth, 7 + _UpDownToppartPosition, platedeep); topstripperpoint[0] = new Point3D(-platewidth, 5.5 + _UpDownToppartPosition, -platedeep); topstripperpoint[1] = new Point3D(platewidth, 5.5 + _UpDownToppartPosition, -platedeep); topstripperpoint[2] = new Point3D(platewidth, 5.5 + _UpDownToppartPosition, platedeep); topstripperpoint[3] = new Point3D(-platewidth, 5.5 + _UpDownToppartPosition, platedeep); topstripperpoint[4] = new Point3D(-platewidth, 6 + _UpDownToppartPosition, -platedeep); topstripperpoint[5] = new Point3D(platewidth, 6 + _UpDownToppartPosition, -platedeep); topstripperpoint[6] = new Point3D(platewidth, 6 + _UpDownToppartPosition, platedeep); topstripperpoint[7] = new Point3D(-platewidth, 6 + _UpDownToppartPosition, platedeep); topplatemodel.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.Ram], toprampoint)); topplatemodel.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachinePlate], topmechpoint)); topplatemodel.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.UpperPress], topplatepoint)); topplatemodel.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.Stripper], topstripperpoint)); topplatemodel.Children[0].Transform = CreateTranform3DGroup(); topplatemodel.Children[1].Transform = CreateTranform3DGroup(); topplatemodel.Children[2].Transform = CreateTranform3DGroup(); topplatemodel.Children[3].Transform = CreateTranform3DGroup(); topplatetran.Children.Add(new ScaleTransform3D()); topplatemodel.Transform = topplatetran; //if (!_IsImageTexture) //{ topshaftgroup.Children.Add(ellipsemodel.Create(_PartColors[(int)MachinePart.Shaft], new Point3D(0, 8.5 + _UpDownToppartPosition, 0), 5)); //} //else //{ // topshaftgroup.Children.Add(ellipsemodel.Create(_PartColors[(int)MachinePart.Shaft], @".\\Images\\Shaft.jpg", new Point3D(0, 9.5 + _UpDownToppartPosition, 0), 10)); //} topshaftgroup.Transform = new Transform3DGroup(); toppartgroup.Children.Add(topplatemodel); toppartgroup.Children.Add(topshaftgroup); topparttran.Children.Add(new TranslateTransform3D()); toppartgroup.Children[1].Transform = topparttran; //toppartgroup.Transform = topparttran; _Log4NetClass.ShowInfo("Create Top Part Model3D Success", "CreateTopPart"); return toppartgroup; } catch (Exception ex) { _Log4NetClass.ShowError(ex.ToString(), "CreateTopPart"); throw ex; } }
/// <summary> /// create bottom part model /// </summary> /// <returns></returns> private Model3DGroup CreateBottomPart() { try { double rampos_y = -4; double mechpos_y = -2.5; double platepos_y = -1.5; double ramwidth = 8.5; double ramdeep = 4; double mechwidth = 7.5; double mechdeep = 3.5; double platewidth = 6.5; double platedeep = 2.8; SquareModel squaremodel = new SquareModel(); Model3DGroup bottompartgroup = new Model3DGroup(); Model3DGroup bottomplatemodel = new Model3DGroup(); Model3DGroup bottomshaftgroup = new Model3DGroup(); Point3D[] bottommechpoint = new Point3D[8]; Point3D[] bottomplatepoint = new Point3D[8]; Point3D[] bottomrampoint = new Point3D[8]; Point3D[] labelfront = new Point3D[4]; Point3D[] labelback = new Point3D[4]; Point3D[] labelleft = new Point3D[4]; Point3D[] labelright = new Point3D[4]; bottomrampoint[0] = new Point3D(-ramwidth, rampos_y, -ramdeep); bottomrampoint[1] = new Point3D(ramwidth, rampos_y, -ramdeep); bottomrampoint[2] = new Point3D(ramwidth, rampos_y, ramdeep); bottomrampoint[3] = new Point3D(-ramwidth, rampos_y, ramdeep); bottomrampoint[4] = new Point3D(-ramwidth, rampos_y + 1.5, -ramdeep); bottomrampoint[5] = new Point3D(ramwidth, rampos_y + 1.5, -ramdeep); bottomrampoint[6] = new Point3D(ramwidth, rampos_y + 1.5, ramdeep); bottomrampoint[7] = new Point3D(-ramwidth, rampos_y + 1.5, ramdeep); bottommechpoint[0] = new Point3D(-mechwidth, mechpos_y, -mechdeep); bottommechpoint[1] = new Point3D(mechwidth, mechpos_y, -mechdeep); bottommechpoint[2] = new Point3D(mechwidth, mechpos_y, mechdeep); bottommechpoint[3] = new Point3D(-mechwidth, mechpos_y, mechdeep); bottommechpoint[4] = new Point3D(-mechwidth, mechpos_y + 1, -mechdeep); bottommechpoint[5] = new Point3D(mechwidth, mechpos_y + 1, -mechdeep); bottommechpoint[6] = new Point3D(mechwidth, mechpos_y + 1, mechdeep); bottommechpoint[7] = new Point3D(-mechwidth, mechpos_y + 1, mechdeep); bottomplatepoint[0] = new Point3D(-platewidth, platepos_y, -platedeep); bottomplatepoint[1] = new Point3D(platewidth, platepos_y, -platedeep); bottomplatepoint[2] = new Point3D(platewidth, platepos_y, platedeep); bottomplatepoint[3] = new Point3D(-platewidth, platepos_y, platedeep); bottomplatepoint[4] = new Point3D(-platewidth, platepos_y + 1, -platedeep); bottomplatepoint[5] = new Point3D(platewidth, platepos_y + 1, -platedeep); bottomplatepoint[6] = new Point3D(platewidth, platepos_y + 1, platedeep); bottomplatepoint[7] = new Point3D(-platewidth, platepos_y + 1, platedeep); labelfront[0] = new Point3D(-0.5, rampos_y + 1, ramdeep + .001); labelfront[1] = new Point3D(0.5, rampos_y + 1, ramdeep + .001); labelfront[2] = new Point3D(0.5, rampos_y, ramdeep + .001); labelfront[3] = new Point3D(-0.5, rampos_y, ramdeep + .001); labelback[1] = new Point3D(-0.5, 1 + rampos_y, -(ramdeep + .001)); labelback[0] = new Point3D(0.5, 1 + rampos_y, -(ramdeep + .001)); labelback[3] = new Point3D(0.5, rampos_y, -(ramdeep + .001)); labelback[2] = new Point3D(-0.5, rampos_y, -(ramdeep + .001)); labelleft[0] = new Point3D(-(ramwidth + .001), 1 + rampos_y, -0.5); labelleft[1] = new Point3D(-(ramwidth + .001), 1 + rampos_y, 0.5); labelleft[2] = new Point3D(-(ramwidth + .001), rampos_y, 0.5); labelleft[3] = new Point3D(-(ramwidth + .001), rampos_y, -0.5); labelright[1] = new Point3D(ramwidth + .001, 1 + rampos_y, -0.5); labelright[0] = new Point3D(ramwidth + .001, 1 + rampos_y, 0.5); labelright[3] = new Point3D(ramwidth + .001, rampos_y, 0.5); labelright[2] = new Point3D(ramwidth + .001, rampos_y, -0.5); //if (!_IsImageTexture) //if (true) //{ bottomplatemodel.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.Ram], bottomrampoint)); bottomplatemodel.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachinePlate], bottommechpoint)); bottomplatemodel.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.LowerPress], bottomplatepoint)); //} //else //{ // bottomplatemodel.Children.Add(squaremodel.Create(@".\\Images\\BottomRam.jpg", bottomrampoint)); // bottomplatemodel.Children.Add(squaremodel.Create(@".\\Images\\BottomPlate.jpg", bottommechpoint)); // bottomplatemodel.Children.Add(squaremodel.Create(@".\\Images\\BottomPress.jpg", bottomplatepoint)); //} bottomplatemodel.Children.Add(squaremodel.CreatePictureLabel(_ImagePath + "F.gif", labelfront)); bottomplatemodel.Children.Add(squaremodel.CreatePictureLabel(_ImagePath + "B.gif", labelback)); bottomplatemodel.Children.Add(squaremodel.CreatePictureLabel(_ImagePath + "L.gif", labelleft)); bottomplatemodel.Children.Add(squaremodel.CreatePictureLabel(_ImagePath + "R.gif", labelright)); bottomplatemodel.Children[1].Transform = new Transform3DGroup(); bottomplatemodel.Transform = new Transform3DGroup(); bottomplatemodel.Children[1].Transform = CreateTranform3DGroup(); bottomplatemodel.Children[2].Transform = CreateTranform3DGroup(); bottompartgroup.Children.Add(bottomplatemodel); _Log4NetClass.ShowInfo("Create Bottom part Model3D Success", "CreateBottomPart"); return bottompartgroup; } catch (Exception ex) { _Log4NetClass.ShowError(ex.ToString(), "CreateBottomPart"); throw ex; } }
/// <summary> /// machine top bottom part /// </summary> /// <returns></returns> private Model3DGroup CreateMachineTopBottomPart() { try { SquareModel squaremodel = new SquareModel(); Model3DGroup machinegroup = new Model3DGroup(); Point3D[] machinetoppoint = new Point3D[8]; Point3D[] machinebottompoint = new Point3D[8]; double width = 12.89; double deep = 6; machinetoppoint[0] = new Point3D(-width, 10.5 + _UpDownToppartPosition, -deep); machinetoppoint[1] = new Point3D(width, 10.5 + _UpDownToppartPosition, -deep); machinetoppoint[2] = new Point3D(width, 10.5 + _UpDownToppartPosition, deep); machinetoppoint[3] = new Point3D(-width, 10.5 + _UpDownToppartPosition, deep); machinetoppoint[4] = new Point3D(-width, 15.8 + _UpDownToppartPosition, -deep); machinetoppoint[5] = new Point3D(width, 15.8 + _UpDownToppartPosition, -deep); machinetoppoint[6] = new Point3D(width, 15.8 + _UpDownToppartPosition, deep); machinetoppoint[7] = new Point3D(-width, 15.8 + _UpDownToppartPosition, deep); machinebottompoint[0] = new Point3D(-width, -10.5, -deep); machinebottompoint[1] = new Point3D(width, -10.5, -deep); machinebottompoint[2] = new Point3D(width, -10.5, deep); machinebottompoint[3] = new Point3D(-width, -10.5, deep); machinebottompoint[4] = new Point3D(-width, -4, -deep); machinebottompoint[5] = new Point3D(width, -4, -deep); machinebottompoint[6] = new Point3D(width, -4, deep); machinebottompoint[7] = new Point3D(-width, -4, deep); if (!_IsImageTexture) { machinegroup.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachineTopBottom], machinetoppoint)); machinegroup.Children.Add(squaremodel.Create(_PartColors[(int)MachinePart.MachineTopBottom], machinebottompoint)); } else { string[] toppicnames = new string[6]; toppicnames[0] = _ImagePath + "MechTop_F.png"; toppicnames[1] = _ImagePath + "MechTop_B.png"; toppicnames[2] = _ImagePath + "MechTop_L.png"; toppicnames[3] = _ImagePath + "MechTop_R.png"; toppicnames[4] = _ImagePath + "PostLeft_LR.png"; toppicnames[5] = _ImagePath + "PostLeft_LR.png"; string[] botpicnames = new string[6]; botpicnames[0] = _ImagePath + "MechBottom_F.png"; botpicnames[1] = _ImagePath + "MechBottom_B.png"; botpicnames[2] = _ImagePath + "MechBottom_L.png"; botpicnames[3] = _ImagePath + "MechBottom_R.png"; botpicnames[4] = _ImagePath + "PostLeft_LR.png"; botpicnames[5] = _ImagePath + "PostLeft_LR.png"; machinegroup.Children.Add(squaremodel.Create(toppicnames, machinetoppoint, false)); machinegroup.Children.Add(squaremodel.Create(botpicnames, machinebottompoint, false)); } machinegroup.Children[1].Transform = new Transform3DGroup(); _Log4NetClass.ShowInfo("Create MachinePart Model3D Success", "CreateMachineTopBottomPart"); return machinegroup; } catch (Exception ex) { _Log4NetClass.ShowError(ex.ToString(), "CreateMachineTopBottomPart"); throw ex; } }