public string Build(int type, Vector2 spigotSize, int materialID) // должен возвращать лист с путями к файлам { Dictionary <string, string> dictionary = new Dictionary <string, string>(); long tempId = 0; List <long> idObjWithNewPath = new List <long>(); DataSet ds = null; //DataTable dt = ipsModuleObject.GetIMBASETable((long)IMBASE_TablesID.Spigot, out ds, out dictionary); base.PartPrototypeName = GetPrototypeName((SpigotType_e)type); string drawingNameWithExt = "12-00.SLDDRW"; int addDimH = base.PartPrototypeName == "12-30" ? 10 : 1; string drawingSpigotPath = Path.Combine(RootFolder, SourceFolder, drawingNameWithExt); SolidWorksAdapter.OpenDocument(drawingSpigotPath, swDocumentTypes_e.swDocDRAWING); SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(base.AssemblyName + ".SLDASM"); SolidWorksAdapter.ToAssemblyDocument(SolidWorksDocument); DeleteEquations(base.PartPrototypeName); DeleteComponents(type); SolidWorksDocument.ForceRebuild3(true); #region formuls double w = spigotSize.X; double h = spigotSize.Y - addDimH; const double step = 50; double weldWidth = Math.Truncate(spigotSize.X / step) * 1000 + 1; double weldHeight = Math.Truncate(spigotSize.Y / step) * 1000 + 1; #endregion if (base.PartPrototypeName == "12-20") { #region 12-20 base.PartName = $"12-20-{spigotSize.Y}"; //if (ipsModuleObject.CheckForSimilarRows(base.PartName, dt, dictionary))// добавить out filePath //{ // // открывать детальку // SolidWorksDocument.Extension.SelectByID2("12-20-001-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); // AssemblyDocument.ReplaceComponents(base.NewPartPath, "", true, true); //} //else //{ base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); base.parameters.Add("D1@Вытянуть1", h - 31); base.parameters.Add("D1@Кривая1", weldHeight); EditPartParameters("12-20-001", base.NewPartPath, materialID); //tempId = op.WriteIntoIMBASE_Spigot_Table(dt, base.NewPartPath + ".SLDPRT", "Обозначениеttt", base.PartName, spigotSize.X.ToString(), spigotSize.Y.ToString(), type.ToString(), 1); //ComponentsPathList.Add(base.NewPartPath); idObjWithNewPath.Add(tempId); //} //12-20-002 base.PartName = $"12-20-{spigotSize.X}"; //if (ipsModuleObject.CheckForSimilarRows(base.PartName, dt, dictionary)) //{ // //открывать детальку //} //else //{ base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); base.parameters.Add("D1@Вытянуть1", w - 31); base.parameters.Add("D1@Кривая1", weldWidth); EditPartParameters("12-20-002", base.NewPartPath, materialID); // tempId = op.WriteIntoIMBASE_Spigot_Table(dt, base.NewPartPath + ".SLDPRT", "Обозначениеttt", base.PartName, spigotSize.X.ToString(), spigotSize.Y.ToString(), type.ToString(), 1); //ComponentsPathList.Add(base.NewPartPath); //Part=1296 //Изделие=1052 idObjWithNewPath.Add(tempId); //} //12-003 base.PartName = $"12-03-{spigotSize.X}-{spigotSize.Y}"; //if (ipsModuleObject.CheckForSimilarRows(base.PartName, dt, dictionary)) //{ // //открывать детальку //} //else //{ base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); base.parameters.Add("D3@Эскиз1", w); base.parameters.Add("D2@Эскиз1", h); EditPartParameters("12-003", base.NewPartPath, materialID); // tempId = op.WriteIntoIMBASE_Spigot_Table(dt, base.NewPartPath + ".SLDPRT", "Обозначениеttt", base.PartName, spigotSize.X.ToString(), spigotSize.Y.ToString(), type.ToString(), 1); //ComponentsPathList.Add(base.NewPartPath); idObjWithNewPath.Add(tempId); //} #endregion } else if (base.PartPrototypeName == "12-30") { #region 12-30 //12-30-001 base.PartName = $"12-30-{spigotSize.Y}"; //if (CheckExistPart != null) //{ // CheckExistPart(base.PartName, RootFolder, out base.NewPartPath); //} //else //{ // MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); //} //if (NewPartPath != string.Empty && NewPartPath != null) //{ // SolidWorksDocument.Extension.SelectByID2("12-30-001-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); // AssemblyDocument.ReplaceComponents(base.NewPartPath, "", true, true); //} //else //{ base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); base.parameters.Add("D1@Вытянуть1", h - 31); base.parameters.Add("D1@Кривая1", weldHeight); //base.parameters.Add("D5@Эскиз1", weldHeight); EditPartParameters("12-30-001", base.NewPartPath, materialID); ComponentsPathList.Add(base.NewPartPath); //} //12-30-002 base.PartName = $"12-30-{spigotSize.X}"; //if (CheckExistPart != null) //{ // CheckExistPart(base.PartName, RootFolder, out base.NewPartPath); //} //else //{ // MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); //} //if (NewPartPath != string.Empty && NewPartPath != null) //{ // SolidWorksDocument.Extension.SelectByID2("12-30-002-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); // AssemblyDocument.ReplaceComponents(base.NewPartPath, "", true, true); //} //else //{ base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); base.parameters.Add("D1@Вытянуть1", w - 31); base.parameters.Add("D1@Кривая1", weldHeight); EditPartParameters("12-30-002", base.NewPartPath, materialID); ComponentsPathList.Add(base.NewPartPath); //} //12-003 base.PartName = $"12-03-{spigotSize.X}-{spigotSize.Y}"; //if (CheckExistPart != null) //{ // CheckExistPart(base.PartName, RootFolder, out base.NewPartPath); //} //else //{ // MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); //} //if (NewPartPath != string.Empty && NewPartPath != null) //{ // SolidWorksDocument.Extension.SelectByID2("12-003-2@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); // AssemblyDocument.ReplaceComponents(base.NewPartPath, "", true, true); //} //else //{ base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName); base.parameters.Add("D3@Эскиз1", w); base.parameters.Add("D2@Эскиз1", h); EditPartParameters("12-003", base.NewPartPath, materialID); ComponentsPathList.Add(base.NewPartPath); //} #endregion } SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(base.AssemblyName + ".SLDASM"); SolidWorksDocument.ForceRebuild3(true); NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, GetSpigotName((SpigotType_e)type, spigotSize)); SolidWorksDocument.Extension.SaveAs(NewPartPath + ".SLDASM", (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath + ".SLDASM"); SolidWorksAdapter.SldWoksAppExemplare.CloseDoc(base.NewPartPath + ".SLDASM"); //tempId = op.WriteIntoIMBASE_Spigot_Table(dt, base.AssemblyName + ".SLDASM", "ОбозначениеСборка", base.PartName, spigotSize.X.ToString(), spigotSize.Y.ToString(), type.ToString(), 1); SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(drawingNameWithExt); SolidWorksDRW = SolidWorksAdapter.ToDrawingDoc(SolidWorksDocument); base.SolidWorksDRW.ActivateSheet("DRW1"); SolidWorksDRW.SetupSheet5("DRW1", 12, 12, 1, GetDrawingScale(spigotSize), true, @"\\pdmsrv\SolidWorks Admin\Templates\Основные надписи\A3-A-1.slddrt", 0.42, 0.297, "По умолчанию", false); SolidWorksDocument.Extension.SaveAs(NewPartPath + ".SLDDRW", (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath + ".SLDDRW"); // create relations between docs //ipsModuleObject.MakeRelationsBtwnDocs(idObjWithNewPath, tempId); SolidWorksAdapter.CloseAllDocumentsAndExit(); return(NewPartPath); }
public string Build(SpigotType_e type, int width, int height) { string modelName = GetModelName(type); NewSpigotName = GetSpigotName(type, width, height); Dimension dimension; int addDimH = modelName == "12-30" ? 10 : 1; string newSpigotPath = $@"{RootFolder}{SubjectDestinationFolder}\{NewSpigotName}"; string drawingName = modelName == "12-30" ? modelName : "12-00"; var modelSpigotDrw = $@"{RootFolder}{SourceFolder}\{drawingName}.SLDDRW"; ModelDoc2 swDrawingSpigot = SolidWorksAdapter.OpenDocument(modelSpigotDrw, swDocumentTypes_e.swDocDRAWING); solidWorksDocument = SolidWorksAdapter.AcativeteDoc("12-00"); AssemblyDoc assemblyDocument = (AssemblyDoc)solidWorksDocument; assemblyDocument.ResolveAllLightWeightComponents(false); DeleteEquations(modelName); solidWorksDocument.ForceRebuild3(true); #region formuls var w = (Convert.ToDouble(width) - 1) / 1000; // ???????????? var h = Convert.ToDouble((Convert.ToDouble(height) + addDimH) / 1000); // ???????????? const double step = 50; var weldWidth = Convert.ToDouble((Math.Truncate(Convert.ToDouble(width) / step) + 1)); // ???????????? var weldHeight = Convert.ToDouble((Math.Truncate(Convert.ToDouble(height) / step) + 1)); // ???????????? #endregion DeleteComponents((int)type); if (modelName == "12-20") { PartName = $"12-20-{height}.SLDPRT"; if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } else { MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); } if (IsPartExist) { solidWorksDocument.Extension.SelectByID2("12-20-001-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); assemblyDocument.ReplaceComponents(NewPartPath, "", true, true); } else { NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{NewPartPath}"; solidWorksDocument.Extension.SelectByID2("D1@Вытянуть1@12-20-001-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Вытянуть[email protected]"))); dimension.SystemValue = h - 0.031; solidWorksDocument.Extension.SelectByID2("D1@Кривая1@12-20-001-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Кривая[email protected]"))); dimension.SystemValue = weldHeight; SolidWorksDocument.Extension.SaveAs(NewPartPath, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath); ComponentsPathList.Add(NewPartPath); SolidWorksAdapter.SldWoksAppExemplare.CloseDoc(NewPartPath); } //12-20-002 PartName = $"12-20-{width}.SLDPRT"; MessageObserver.Instance.SetMessage("Check exist part. " + NewPartPath); if (CheckExistPart != null) { MessageObserver.Instance.SetMessage("\tCheckExistPartEvent"); CheckExistPart(PartName, out IsPartExist, out NewPartPath); } else { MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); } if (IsPartExist) { solidWorksDocument.Extension.SelectByID2("12-20-002-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); assemblyDocument.ReplaceComponents(PartName, "", true, true); } else { NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{NewPartPath}"; solidWorksDocument.Extension.SelectByID2("D1@Вытянуть1@12-20-002-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Вытянуть[email protected]"))); dimension.SystemValue = w - 0.031; solidWorksDocument.Extension.SelectByID2("D1@Кривая1@12-20-002-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Кривая[email protected]"))); dimension.SystemValue = weldWidth; SolidWorksDocument.Extension.SaveAs(NewPartPath, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath); ComponentsPathList.Add(NewPartPath); } //12-003 PartName = $"12-03-{width}-{height}.SLDPRT"; if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } else { MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); } if (IsPartExist) { solidWorksDocument.Extension.SelectByID2("12-003-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); assemblyDocument.ReplaceComponents(PartName, "", true, true); } else { NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{NewPartPath}"; solidWorksDocument.Extension.SelectByID2("D3@Эскиз1@12-003-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D3@Эскиз[email protected]"))); dimension.SystemValue = w; solidWorksDocument.Extension.SelectByID2("D2@Эскиз1@12-003-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D2@Эскиз[email protected]"))); dimension.SystemValue = h; solidWorksDocument.EditRebuild3(); SolidWorksDocument.Extension.SaveAs(NewPartPath, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath); ComponentsPathList.Add(NewPartPath); SolidWorksAdapter.SldWoksAppExemplare.CloseDoc(NewPartPath); } } if (modelName == "12-30") { //12-30-001 PartName = $"12-30-{height}.SLDPRT"; MessageObserver.Instance.SetMessage("Check exist part. " + NewPartPath); if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } else { MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); } if (IsPartExist) { solidWorksDocument.Extension.SelectByID2("12-30-001-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); assemblyDocument.ReplaceComponents(PartName, "", true, true); } else { NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{NewPartPath}"; solidWorksDocument.Extension.SelectByID2("D1@Вытянуть1@12-30-001-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Вытянуть[email protected]"))); dimension.SystemValue = h - 0.031; solidWorksDocument.Extension.SelectByID2("D1@Кривая1@12-30-001-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Кривая[email protected]"))); dimension.SystemValue = weldHeight; SolidWorksDocument.Extension.SaveAs(NewPartPath, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath); ComponentsPathList.Add(NewPartPath); } //12-30-002 PartName = $"12-30-{width}.SLDPRT"; if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } else { MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); } if (IsPartExist) { solidWorksDocument.Extension.SelectByID2("12-30-002-1@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); assemblyDocument.ReplaceComponents(PartName, "", true, true); } else { NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{NewPartPath}"; solidWorksDocument.Extension.SelectByID2("D1@Вытянуть1@12-30-002-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Вытянуть[email protected]"))); dimension.SystemValue = w - 0.031; solidWorksDocument.Extension.SelectByID2("D1@Кривая1@12-30-002-1@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D1@Кривая[email protected]"))); dimension.SystemValue = weldHeight; SolidWorksDocument.Extension.SaveAs(NewPartPath, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath); ComponentsPathList.Add(NewPartPath); } //12-003 PartName = $"12-03-{width}-{height}.SLDPRT"; if (CheckExistPart != null) { CheckExistPart(PartName, out IsPartExist, out NewPartPath); } else { MessageObserver.Instance.SetMessage("CheckExistPartEvent can not be null", MessageType.Warning); } if (IsPartExist) { solidWorksDocument.Extension.SelectByID2("12-003-2@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0); assemblyDocument.ReplaceComponents(PartName, "", true, true); } else { NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{NewPartPath}"; solidWorksDocument.Extension.SelectByID2("D3@Эскиз1@12-003-2@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D3@Эскиз[email protected]"))); dimension.SystemValue = w; solidWorksDocument.Extension.SelectByID2("D2@Эскиз1@12-003-2@12-00", "DIMENSION", 0, 0, 0, false, 0, null, 0); dimension = ((Dimension)(solidWorksDocument.Parameter("D2@Эскиз[email protected]"))); dimension.SystemValue = h; solidWorksDocument.EditRebuild3(); SolidWorksDocument.Extension.SaveAs(NewPartPath, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, NewPartPath); ComponentsPathList.Add(NewPartPath); } } solidWorksDocument.ForceRebuild3(true); solidWorksDocument.Extension.SaveAs(newSpigotPath + ".SLDASM", (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, newSpigotPath + ".SLDASM"); SolidWorksAdapter.SldWoksAppExemplare.CloseDoc(NewSpigotName + ".SLDASM"); ComponentsPathList.Add(newSpigotPath + ".SLDASM"); swDrawingSpigot.Extension.SelectByID2("DRW1", "SHEET", 0, 0, 0, false, 0, null, 0); var drw = (DrawingDoc)SolidWorksAdapter.AcativeteDoc(drawingName + ".SLDDRW"); drw.ActivateSheet("DRW1"); drw.SetupSheet5("DRW1", 12, 12, 1, GetDrawingScale(width, height), true, @"\\pdmsrv\SolidWorks Admin\Templates\Основные надписи\A3-A-1.slddrt", 0.42, 0.297, "По умолчанию", false); swDrawingSpigot.Extension.SaveAs(newSpigotPath + ".SLDDRW", (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, ref error, ref warning); InitiatorSaveExeption(error, warning, newSpigotPath + ".SLDDRW"); ComponentsPathList.Add(newSpigotPath + ".SLDDRW"); SolidWorksAdapter.CloseAllDocumentsAndExit(); return(newSpigotPath); }
public string Build(int type, double width, double lenght, bool onlyPath, int materialID) { SolidWorksDocument = null; base.PartName = "15-000"; base.NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{base.PartName}"; string modelRoofPath = $@"{RootFolder}\{SourceFolder}\{base.PartName}.SLDASM"; SolidWorksAdapter.OpenDocument(modelRoofPath, swDocumentTypes_e.swDocASSEMBLY, "00"); SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(base.PartName + ".SLDASM"); DeleteComponents(type); #region Сохранение и изменение элементов var addwidth = 100; var addwidth2 = 75; var type4 = 0; var divwidth = 1; if ((RoofType_e)type == RoofType_e.Two || (RoofType_e)type == RoofType_e.Six) { addwidth = 75; divwidth = 2; } else if ((RoofType_e)type == RoofType_e.Four) { type4 = 170; addwidth2 = 170 + 75; } double widthD = width / divwidth + addwidth; double lengthD = lenght - 28.5; const double step = 200; const double step2 = 150; double weldW = Math.Truncate(lenght / step) + 1; double weldW2 = Math.Truncate(lenght / step2) + 1; //15-001 #region string newPartName = $"15-0{type}-01-{width}-{lenght}"; AssemblyName = $"15-0{type}-01-{width}-{lenght}.SLDASM"; //CheckExistPart(NewPartPath, RootFolder, out NewPartPath); if (base.IsPartExist) { SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("15-000.SLDASM"); SolidWorksDocument.Extension.SelectByID2("15-001-1@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0); base.AssemblyDocument.ReplaceComponents(AssemblyName, "", true, true); SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("15-001.SLDPRT"); } else { base.NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{newPartName}"; base.parameters.Add("D1@Эскиз1", (RoofType_e)type == RoofType_e.Five || (RoofType_e)type == RoofType_e.Six ? (140 + lengthD + type4) : (lengthD + type4)); base.parameters.Add("D2@Эскиз1", widthD); base.parameters.Add("D4@Эскиз27", addwidth2 - 4.62); base.parameters.Add("D1@Эскиз27", 90); base.parameters.Add("D2@Эскиз27", 75 - 4.62); base.parameters.Add("D1@Эскиз24", ((RoofType_e)type == RoofType_e.Five || (RoofType_e)type == RoofType_e.Six) ? 149.53 : 9.53); base.parameters.Add("D1@Кривая2", weldW2 * 1000); base.parameters.Add("D1@Кривая1", weldW * 1000); EditPartParameters("15-001", NewPartPath, materialID); } #endregion //15-002 if type = 6 #region if ((RoofType_e)type == RoofType_e.Six) { newPartName = $"15-06-02-{width}-{lenght}"; //CheckExistPart(NewPartPath, RootFolder, out NewPartPath); if (base.IsPartExist) { SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("15-000.SLDASM"); SolidWorksDocument.Extension.SelectByID2("15-002-1@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0); base.AssemblyDocument.ReplaceComponents(AssemblyName, "", true, true); SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("15-002.SLDPRT"); } else { base.NewPartPath = $@"{RootFolder}\{SubjectDestinationFolder}\{newPartName}"; base.parameters.Add("D1@Эскиз1", 140 + lengthD + type4); base.parameters.Add("D2@Эскиз1", widthD); base.parameters.Add("D4@Эскиз27", addwidth2 - 4.62); base.parameters.Add("D1@Эскиз27", 90); base.parameters.Add("D2@Эскиз27", 75 - 4.62); base.parameters.Add("D2@Эскиз23", 165); base.parameters.Add("D1@Кривая2", weldW2 * 1000); base.parameters.Add("D1@Кривая1", weldW * 1000); EditPartParameters("15-002", NewPartPath, materialID); } SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("15-000.SLDASM"); SolidWorksDocument.Extension.SelectByID2("15-001-3@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0); SolidWorksDocument.Extension.SelectByID2("ЗеркальныйКомпонент2@15-000", "COMPPATTERN", 0, 0, 0, false, 0, null, 0); SolidWorksDocument.EditSuppress2(); } else // если тип не == 6, удаляем деталь 15-002 { SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("15-000.SLDASM"); SolidWorksDocument.Extension.SelectByID2("15-002-1@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0); SolidWorksDocument.EditDelete(); } #endregion switch ((RoofType_e)type) { case RoofType_e.Two: case RoofType_e.Six: SolidWorksDocument.Extension.SelectByID2("Винт самосверл 6-гр.гол с шайбой-33@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0); SolidWorksDocument.EditDelete(); SolidWorksDocument.Extension.SelectByID2("Винт самосверл 6-гр.гол с шайбой-40@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0); SolidWorksDocument.EditDelete(); break; default: SolidWorksDocument.Extension.SelectByID2("Винт самосверл 6-гр.гол с шайбой-26@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0); SolidWorksDocument.EditDelete(); break; } #endregion try { SolidWorksDocument.ForceRebuild3(true); SolidWorksDocument.SaveAs2(AssemblyName, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, false, true); ComponentsPathList.Add(base.NewPartPath); //SolidWorksAdapter.CloseAllDocumentsAndExit(); } catch (Exception ex) { Patterns.Observer.MessageObserver.Instance.SetMessage(ex.ToString()); } if (onlyPath) { return(base.NewPartPath); } return(base.NewPartPath); }