private void DoublePanel(PanelType_e panelType, Materials_e OuterMaterial, Materials_e InnerMaterial, PanelProfile_e profile) { base.PartName = "02-" + (int)panelType + "-01-" + sizePanel.X + "-" + sizePanel.Y + "-" + OuterMaterial + "-" + InnerMaterial + "-" + (int)profile; if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } if (IsPartExist) { SolidWorksDocument.Extension.SelectByID2("02-01-101-50-1@02-104-50", "COMPONENT", 0, 0, 0, false, 0, null, 0); AssemblyDocument.ReplaceComponents(base.NewPartPath, "", false, true); } else { base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); if (SetBends != null) { SetBends((decimal)outThickness, out KFactor, out BendRadius); } base.parameters.Add("D1@Эскиз1", sizePanel.Y); base.parameters.Add("D2@Эскиз1", sizePanel.X / 2); base.parameters.Add("D1@Кривая4", rivetH); base.parameters.Add("D1@Кривая3", rivetWd); base.parameters.Add("D1@Кривая5", rivetH); base.parameters.Add("D7@Ребро-кромка2", lenght); base.parameters.Add("D2@Эскиз47", widthHandle / 2); base.parameters.Add("Толщина@Листовой металл", outThickness); base.parameters.Add("D1@Листовой металл", (double)BendRadius); base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000); EditPartParameters("02-01-101-50", base.NewPartPath); } base.PartName = "02-" + (int)panelType + "-02-" + sizePanel.X + "-" + sizePanel.Y + "-" + OuterMaterial + "-" + InnerMaterial + "-" + (int)profile; if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } if (IsPartExist) { SolidWorksDocument.Extension.SelectByID2("02-01-102-50-1@02-104-50", "COMPONENT", 0, 0, 0, false, 0, null, 0); AssemblyDocument.ReplaceComponents(base.NewPartPath, "", false, true); } else { base.NewPartPath = base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); if (SetBends != null) { SetBends((decimal)outThickness, out KFactor, out BendRadius); } base.parameters.Add("D1@Эскиз1", sizePanel.Y - 10); base.parameters.Add("D2@Эскиз1", (sizePanel.X - 10) / 2); base.parameters.Add("D1@Кривая3", rivetH); base.parameters.Add("D1@Кривая2", rivetH); base.parameters.Add("D1@Кривая1", rivetWd); base.parameters.Add("Толщина@Листовой металл", outThickness); base.parameters.Add("D1@Листовой металл", (double)BendRadius); base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000); EditPartParameters("02-01-102-50", base.NewPartPath); } base.PartName = "02-" + (int)panelType + "-03-" + sizePanel.X + "-" + sizePanel.Y + "-" + OuterMaterial + "-" + InnerMaterial + "-" + (int)profile; if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } if (false) { SolidWorksDocument.Extension.SelectByID2("02-01-103-50-1@02-104-50", "COMPONENT", 0, 0, 0, false, 0, null, 0); AssemblyDocument.ReplaceComponents(base.NewPartPath, "", false, true); } else { base.NewPartPath = base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); if (SetBends != null) { SetBends((decimal)outThickness, out KFactor, out BendRadius); } base.parameters.Add("D1@Эскиз1", sizePanel.Y - 15); base.parameters.Add("D1@Кривая1", rivetH); base.parameters.Add("D2@Эскиз1", lenght - innerThickness - outThickness - 1); base.parameters.Add("Толщина@Листовой металл", outThickness); base.parameters.Add("D1@Листовой металл", (double)BendRadius); base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000); EditPartParameters("02-01-103-50", base.NewPartPath); } }
public void Build(PanelType_e panelType, PanelProfile_e profile, Vector2 sizePanel, Materials_e OuterMaterial, Materials_e InnerMaterial, double outThickness, double innerThickness) { this.sizePanel = sizePanel; this.innerThickness = innerThickness; this.outThickness = outThickness; this.isDoublePanal = CutPanel.IsCut(sizePanel); #region calculate panel dimention by profile switch (profile) { case PanelProfile_e.Profile_3_0: innerHeight = sizePanel.X - 7; innerWeidht = sizePanel.Y - 7; lenght = 27; deepInsulation = 20; break; case PanelProfile_e.Profile_5_0: innerHeight = sizePanel.X - 10; innerWeidht = sizePanel.Y - 10; lenght = 48; deepInsulation = 45; break; case PanelProfile_e.Profile_7_0: innerHeight = sizePanel.X - 10; innerWeidht = sizePanel.Y - 10; lenght = 50; deepInsulation = 45; break; } #endregion #region calculate distance between the handles widthHandle = sizePanel.X / 2; if (sizePanel.X < 1000) { widthHandle = sizePanel.X * 0.5; } if (sizePanel.X >= 1000) { widthHandle = sizePanel.X * 0.45; } if (sizePanel.X >= 1300) { widthHandle = sizePanel.X * 0.4; } if (sizePanel.X >= 1700) { widthHandle = sizePanel.X * 0.35; } isOneHandle = sizePanel.X > 750 ? false : true; #endregion OpenTemplate(panelType); DeleteComponents((int)panelType); CalculateRivetStep(); if (isDoublePanal) { DoublePanel(panelType, OuterMaterial, InnerMaterial, profile); } else { SinglePanel(panelType, OuterMaterial, InnerMaterial, profile); } Insulation(profile); AssemblyName = "02-" + (int)panelType + sizePanel.X + "-" + sizePanel.Y + "-" + OuterMaterial + "-" + InnerMaterial + "-" + (int)profile; ModelDoc2 asm = AssemblyDocument as ModelDoc2; base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, AssemblyName + ".SLDASM"); asm.ForceRebuild3(false); asm.Extension.SaveAs(base.NewPartPath, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, /* (int)swSaveAsOptions_e.swSaveAsOptions_Silent +*/ (int)swSaveAsOptions_e.swSaveAsOptions_SaveReferenced + (int)swSaveAsOptions_e.swSaveAsOptions_UpdateInactiveViews, null, ref errors, warnings); InitiatorSaveExeption(errors, warnings, base.NewPartPath); }
private void SinglePanel(PanelType_e panelType, Materials_e OuterMaterial, Materials_e InnerMaterial, PanelProfile_e profile) { base.PartName = "02-" + (int)panelType + "-01-" + sizePanel.X + "-" + sizePanel.Y + "-" + OuterMaterial + "-" + InnerMaterial + "-" + (int)profile; if (CheckExistPart != null) { CheckExistPart(base.PartName, out IsPartExist, out NewPartPath); } if (IsPartExist) { SolidWorksDocument.Extension.SelectByID2("02-01-001-1@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0); AssemblyDocument.ReplaceComponents(base.NewPartPath, "", false, true); } else { base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); // outer panel if (SetBends != null) { SetBends((decimal)outThickness, out KFactor, out BendRadius); } base.parameters.Add("D1@Эскиз1", sizePanel.Y); base.parameters.Add("D2@Эскиз1", sizePanel.X); base.parameters.Add("D1@Кривая2", rivetH); base.parameters.Add("D1@Кривая1", rivetW); base.parameters.Add("D7@Ребро-кромка1", lenght); base.parameters.Add("Толщина@Листовой металл", outThickness); base.parameters.Add("D1@Листовой металл", (double)BendRadius); base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000); if (panelType == PanelType_e.RemovablePanel && !isOneHandle) { base.parameters.Add("D4@Эскиз30", widthHandle); } EditPartParameters("02-01-001", base.NewPartPath); } base.PartName = "02-" + (int)panelType + "-02-" + sizePanel.X + "-" + sizePanel.Y + "-" + OuterMaterial + "-" + InnerMaterial + "-" + (int)profile; if (CheckExistPart != null) { CheckExistPart(base.PartName, out IsPartExist, out NewPartPath); } if (IsPartExist) { SolidWorksDocument.Extension.SelectByID2("02-01-002-1@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0); AssemblyDocument.ReplaceComponents(base.NewPartPath, "", false, true); } else { base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); if (SetBends != null) { SetBends((decimal)innerThickness, out KFactor, out BendRadius); } base.parameters.Add("D1@Эскиз1", innerWeidht); base.parameters.Add("D2@Эскиз1", innerHeight); base.parameters.Add("D1@Кривая2", rivetW); base.parameters.Add("D1@Кривая1", rivetH); base.parameters.Add("Толщина@Листовой металл", innerThickness); base.parameters.Add("D1@Листовой металл", (double)BendRadius); base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000); EditPartParameters("02-01-002", base.NewPartPath); } }