private void SaveDoc(string name)
 {
     //Сохранение
     SolidWorksDocument         = SolidWorksAdapter.AcativeteDoc("10-4");
     SolidWorksDocument.Visible = true;
     SolidWorksDocument.SaveAs2(base.NewPartPath + @"\" + name + ".SLDASM", (int)swSaveAsVersion_e.swSaveAsCurrentVersion, false, true);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Удаляет лишние компоненты для каждого типа.
        /// </summary>
        /// <param name="type"></param>
        protected override void DeleteComponents(int type)
        {
            const int deleteOption = (int)swDeleteSelectionOptions_e.swDelete_Absorbed + (int)swDeleteSelectionOptions_e.swDelete_Children;

            if ((SpigotType_e)type == SpigotType_e.Twenty_mm)
            {
                SolidWorksDocument.Extension.SelectByID2("12-30-001-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-30-001-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-30-002-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-30-002-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-3@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-4@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-30-001-3@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-30-001-4@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-30-002-3@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-30-002-4@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-5@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-6@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-7@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.002-8@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-003-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Клей-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Клей-2@12-00", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
            }
            if ((SpigotType_e)type == SpigotType_e.Thirty_mm)
            {
                SolidWorksDocument.Extension.SelectByID2("12-20-001-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-20-001-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-20-002-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-20-002-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-2@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-3@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-4@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-20-001-3@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-20-001-4@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-20-002-3@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-20-002-4@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-5@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-6@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-7@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ВНС-96.61.001-8@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("12-003-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Клей-1@12-00", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
            }

            SolidWorksDocument.Extension.SelectByID2("30", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
            SolidWorksDocument.EditDelete();
            SolidWorksDocument.Extension.SelectByID2("20", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
            SolidWorksDocument.EditDelete();
        }
Exemplo n.º 3
0
        public void Build2()
        {
            AssemblyName       = "02-11-40-1";
            NewPartPath        = Path.Combine(RootFolder, SourceFolder, AssemblyName + ".SLDASM");
            SolidWorksDocument = SolidWorksAdapter.OpenDocument(NewPartPath, swDocumentTypes_e.swDocASSEMBLY);


            InputHolesWrapper.StringValue(XYZ.X.ToString());

            #region  02-11-01-40-

            PartPrototypeName = "02-11-01-40-";
            base.PartName     = "02-0" + (int)p.PanelType + "-01-" + 13131313;
            base.NewPartPath  = Path.Combine(RootFolder, SubjectDestinationFolder, base.PartName);



            //типДвойнойРазрез


            // Габариты
            base.parameters.Add("D1@Эскиз1", p.SizePanel.X);
            base.parameters.Add("D2@Эскиз1", p.SizePanel.Y);
            base.parameters.Add("D1@3-4", p.Screws.ByHeight); //отверстия под болты справа
            base.parameters.Add("D1@1-4", p.Screws.ByHeight); //...слева
            base.parameters.Add("D1@2-4", p.Screws.ByWidth);
            base.parameters.Add("D2@2-2", осьСаморезВинт);
            base.parameters.Add("D4@Эскиз47", p.widthHandle); // расстояние между ручками
            base.parameters.Add("D1@Эскиз50", диамСаморезВинт);
            base.parameters.Add("D1@2-3-1", диамСаморезВинт);
            base.parameters.Add("D1@Эскиз52", d1Эскиз52);              // расстояние от края до края панели по ширине для |.....|
            base.parameters.Add("D2@Эскиз52", осьПоперечныеОтверстия); // константа
            //         base.parameters.Add("D1@Кривая3", d1Кривая3);
            base.parameters.Add("D3@1-1-1", string.IsNullOrEmpty(типТорцевой) || p.PanelType == PanelType_e.BlankPanel ? 35 : 158.1);
            base.parameters.Add("D2@3-1-1", string.IsNullOrEmpty(типТорцевой) || p.PanelType == PanelType_e.BlankPanel ? 35 : 158.1);
            base.parameters.Add("D3@2-1-1", диамЗаглушкаВинт);
            base.parameters.Add("D1@Эскиз49", диамЗаглушкаВинт);
            base.parameters.Add("D1@Кривая1", zaklByWidth);
            base.parameters.Add("D1@Кривая2", zaklByHeight);
            base.parameters.Add("D7@Ребро-кромка1", (ThermoStrip_e)FramelessBlock.ThermoStrip == ThermoStrip_e.ThermoScotch ? 17.7 : 19.2);
            //         base.parameters.Add("Толщина@Листовой металл", materialP1[1].Replace('.', ',');
            //         base.parameters.Add("D1@CrvPatternW", колЗаклепокКронштейнаДвойнойПанели);
            //         base.parameters.Add("D1@CrvPatternH", колЗаклепокКронштейнаДвойнойПанели);
            EditPartParameters(PartPrototypeName, base.NewPartPath, 0);
            #endregion

            SolidWorksDocument.EditRebuild3();
        }
Exemplo n.º 4
0
        //Profile for FrontPanel
        public void FrameProfil(double lenght, ProfilType_e type, bool flange30, string partName)
        {
            var    width  = framelessPanel.ThermoStrip == ThermoStrip_e.ThermoScotch ? 38.5 : 40.0;
            string config = "00";

            switch (type)
            {
            case ProfilType_e.HorisontalProfil:
                config = "00";
                break;

            case ProfilType_e.VerticalProfil:
                config = "01";
                break;
            }
            NewPartPath = System.IO.Path.Combine(base.RootFolder, SubjectDestinationFolder, partName + ".SLDPRT");

            SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("02-11-11-40-.SLDPRT");
            SolidWorksDocument.ShowConfiguration2(config);

            string[] configs = SolidWorksDocument.GetConfigurationNames();
            foreach (var s in configs)
            {
                if (!s.Equals(config))
                {
                    SolidWorksDocument.DeleteConfiguration2(s);
                }
            }
            // rename current configuration.
            SolidWorksDocument.ConfigurationManager.ActiveConfiguration.Name = "00";

            lenght = type == ProfilType_e.HorisontalProfil ? lenght - 60 : lenght;
            double rivetStep = Math.Truncate(lenght / 100) * 1000;

            parameters.Add("D2@Эскиз1", lenght);
            parameters.Add("D1@Кривая1", rivetStep == 1000 ? 2000 : rivetStep);
            parameters.Add("D2@Эскиз23", (!flange30) ? 10.0 : 15.0);
            parameters.Add("D3@Эскиз23", (!flange30) ? 10.0 : 15.0);
            EditPartParameters("02-11-11-40-", NewPartPath, 0);
        }
Exemplo n.º 5
0
        protected virtual void EditPartParameters(string partName, string newPath, int materialID)
        {
            foreach (var eachParameter in parameters)
            {
                try
                {
                    Dimension myDimension = (SolidWorksDocument.Parameter(eachParameter.Key + "@" + partName + ".SLDPRT")) as Dimension;
                    myDimension.SystemValue = eachParameter.Value / 1000;
                }
                catch (Exception ex)
                {
                    //System.Windows.Forms.MessageBox.Show(eachParameter.Key + "@" + partName);
                    MessageObserver.Instance.SetMessage(ex.ToString(), MessageType.Error);
                }
            }
            this.parameters.Clear();

            SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(partName);
            if (SolidWorksDocument != null)
            {
                SolidWorksDocument.ForceRebuild3(true);

                toSQL.AddCustomProperty("", materialID, SolidWorksAdapter.SldWoksAppExemplare);
                SolidWorksDocument.Extension.SaveAs(newPath + ".SLDPRT", (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, newPath);
                SolidWorksAdapter.CloseDocument(SolidWorksDocument);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Не удалось преобразовать деталь " + partName);
            }

            SolidWorksAdapter.SldWoksAppExemplare.DocumentVisible(false, 2);
            SolidWorksAdapter.SldWoksAppExemplare.DocumentVisible(false, 1);
        }
Exemplo n.º 6
0
 protected virtual void EditPartParameters(string partName, string newPath)
 {
     //Console.WriteLine(newPath);
     foreach (var eachParameter in parameters)
     {
         try
         {
             Console.WriteLine(eachParameter.Key + "@" + partName + " val: " + eachParameter.Value);
             Dimension myDimension = (SolidWorksDocument.Parameter(eachParameter.Key + "@" + partName + ".SLDPRT")) as Dimension;
             myDimension.SystemValue = eachParameter.Value / 1000;
         }
         catch (Exception ex)
         {
             Console.WriteLine(eachParameter.Key + " " + ex);
         }
     }
     SolidWorksDocument.ForceRebuild3(true);
     SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(partName);
     SolidWorksDocument.Extension.SaveAs(newPath + ".SLDPRT", (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, newPath);
     this.parameters.Clear();
     SolidWorksAdapter.SldWoksAppExemplare.CloseDoc(partName);
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        protected override void DeleteComponents(int type)
        {
            const int deleteOption = (int)swDeleteSelectionOptions_e.swDelete_Absorbed + (int)swDeleteSelectionOptions_e.swDelete_Children;

            if ((RoofType_e)type == RoofType_e.One || (RoofType_e)type == RoofType_e.Five)
            {
                //15-001-1

                SolidWorksDocument.Extension.SelectByID2("Эскиз26@15-001-1@15-000", "SKETCH", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Hole-M8@15-001-1@15-000", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть3@15-001-1@15-000", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть4@15-001-1@15-000", "BODYFEATURE", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.DeleteSelection2(deleteOption);

                //COMPONENT
                SolidWorksDocument.Extension.SelectByID2("Rivet Bralo-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Rivet Bralo-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Fasteners - M8", "FTRFOLDER", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Fasteners - M8", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Washer 11371_gost-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Hex Bolt 7805_gost-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Washer 11371_gost-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Hex Bolt 7805_gost-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Hex Bolt 7805_gost-2@15-000", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("ЗеркальныйКомпонент2", "COMPPATTERN", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
            }
            else if ((RoofType_e)type == RoofType_e.Two || (RoofType_e)type == RoofType_e.Six)
            {
                SolidWorksDocument.Extension.SelectByID2("Rivet Bralo-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Rivet Bralo-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.EditUnsuppress2();
                SolidWorksDocument.ClearSelection2(true);

                SolidWorksDocument.Extension.SelectByID2("ЗеркальныйКомпонент2", "COMPPATTERN", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditUnsuppress2();
                SolidWorksDocument.ClearSelection2(true);

                SolidWorksDocument.Extension.SelectByID2("DerivedCrvPattern2", "COMPPATTERN", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditUnsuppress2();
                SolidWorksDocument.ClearSelection2(true);

                SolidWorksDocument.Extension.SelectByID2("Симметричный1", "MATE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditSuppress2();
                SolidWorksDocument.ClearSelection2(true);

                SolidWorksDocument.Extension.SelectByID2("Расстояние1", "MATE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditUnsuppress2();
                SolidWorksDocument.ClearSelection2(true);

                SolidWorksDocument.Extension.SelectByID2("Fasteners - M8", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Washer 11371_gost-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Hex Bolt 7805_gost-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Washer 11371_gost-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Hex Bolt 7805_gost-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Зеркальное отражение1@15-001-1@15-000", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Зеркальное отражение1@15-002-1@15-000", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
            }
            else if ((RoofType_e)type == RoofType_e.Three || (RoofType_e)type == RoofType_e.Four)
            {
                SolidWorksDocument.Extension.SelectByID2("Винт самосверл 6-гр.гол с шайбой-33@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0); SolidWorksDocument.EditDelete();

                SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть3@15-001-1@15-000", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                SolidWorksDocument.Extension.SelectByID2("Эскиз26@15-001-1@15-000", "SKETCH", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Hole-M8@15-001-1@15-000", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditUnsuppress2();
                SolidWorksDocument.Extension.SelectByID2("Эскиз23@15-001-1@15-000", "SKETCH", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditSuppress2();

                SolidWorksDocument.Extension.SelectByID2("Винт самосверл 6-гр.гол с шайбой-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Rivet Bralo-1@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.Extension.SelectByID2("Rivet Bralo-2@15-000", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("ЗеркальныйКомпонент2", "COMPPATTERN", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Fasteners - M8", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditUnsuppress2();
                SolidWorksDocument.ClearSelection2(true);

                SolidWorksDocument.Extension.SelectByID2("MirrorFasteners - M8", "COMPPATTERN", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditUnsuppress2();
            }
            SolidWorksDocument.ForceRebuild3(false);
        }
Exemplo n.º 10
0
        protected override void DeleteComponents(int type)
        {
            PanelType_e eType        = (PanelType_e)type;
            int         deleteOption = (int)swDeleteSelectionOptions_e.swDelete_Absorbed + (int)swDeleteSelectionOptions_e.swDelete_Children;

            if (eType == PanelType_e.BlankPanel)
            {
                SolidWorksDocument.Extension.SelectByID2("Ручка MLA 120-1@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-1@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-2@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-5@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-6@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть7@02-01-001-1@02-01", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                SolidWorksDocument.Extension.SelectByID2("Ручка MLA 120-5@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-9@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-10@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-13@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-14@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.EditDelete();
                SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть8@02-01-001-1@02-01", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
            }


            if (eType == PanelType_e.RemovablePanel)
            {
                if (!isOneHandle)
                {
                    SolidWorksDocument.Extension.SelectByID2("Ручка MLA 120-1@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-1@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-2@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-5@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-6@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть7@02-01-001-1@02-01", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                }
                else
                {
                    SolidWorksDocument.Extension.SelectByID2("Ручка MLA 120-5@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-9@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-10@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-13@02-01", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-14@02-01", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть8@02-01-001-1@02-01", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                }

                if (isDoublePanal)
                {
                    SolidWorksDocument.Extension.SelectByID2("Ручка MLA 120-1@02-104-50", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-1@02-104-50", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("SC GOST 17475_gost-2@02-104-50", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-1@02-104-50", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets-2@02-104-50", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть11@02-01-101-50-1@02-104-50", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                }
            }
        }
        public void BuildMountageFrame(bool cheched, int width, int lenght, int thikness, int FrameType, int offset, int materialID)
        {
            string assemblyName          = "10-4";
            string modelMontageFramePath = $@"{base.RootFolder}\{base.SourceFolder}\{assemblyName}.SLDASM";

            SolidWorksDocument = SolidWorksAdapter.OpenDocument(modelMontageFramePath, swDocumentTypes_e.swDocASSEMBLY, "");
            tbAssemblyNameDataContext bildFrame = new tbAssemblyNameDataContext();

            SolidWorksAdapter.ToAssemblyDocument(SolidWorksDocument);
            int?ID = 0;

            ID = bildFrame.AirVents_AddAssemblyFrame(FrameType, width, lenght, thikness, offset, 0, ref ID);
            string assmblName = ID?.ToString();

            if (cheched)
            {
                width = width - 20;
            }

            tempOffset = offset;
            if (offset > (lenght - 125) * 10)
            {
                offset = (lenght - 250) * 10;
                MessageBox.Show("Смещение превышает допустимое значение! Программой установлено - " + (offset / 10));
            }
            else
            {
                SetBends = GetSetBends;                                          //получаем значения KFactor, BendRadius из SWPlusBD Materials.BendTable

                GetFrameType((MontageFrameType_e)FrameType, lenght, out offset); //определяем по типу рамы, какие балки удалять

                SetBends?.Invoke((decimal)thikness, out KFactor, out BendRadius);

                if (lenght > 1000)
                {
                    SolidWorksDocument.Extension.SelectByID2("Middle@10-01-01-4-1@10-4", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditUnsuppress2();
                    SolidWorksDocument.Extension.SelectByID2("Middle", "FTRFOLDER", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditUnsuppress2();
                }

                #region Удаление поперечной балки
                //Тип рамы 2
                if (internalCrossbeam == false)
                {
                    SolidWorksDocument.Extension.SelectByID2("10-03-01-4-1@10-4", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-39@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-40@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-23@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Гайка DIN 934-19@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Болт DIN 933-22@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-41@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-42@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-24@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Гайка DIN 934-20@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Болт DIN 933-23@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-43@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-44@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-25@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Гайка DIN 934-21@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Болт DIN 933-24@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-45@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-46@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-26@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Гайка DIN 934-22@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Болт DIN 933-25@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();

                    // Удаление ненужных элементов продольной балки
                    SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть8@10-01-01-4-1@10-4", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditSuppress2();
                }

                #endregion

                #region Удаление продольной балки

                // Погашение внутренней продольной балки
                if (internalLongitudinalBeam == false)
                {
                    foreach (var s in new[] { "5", "6", "7", "8" })
                    {
                        SolidWorksDocument.Extension.SelectByID2("Болт DIN 933-" + s + "@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                        SolidWorksDocument.EditDelete();
                    }
                    foreach (var s in new[] { "6", "7", "8", "9", "37", "38", "39", "40" })
                    {
                        SolidWorksDocument.Extension.SelectByID2("Washer 6402_gost-" + s + "@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                        SolidWorksDocument.EditDelete();
                    }
                    foreach (var s in new[] { "17", "18", "19", "20", "21", "22", "23", "24", "57", "58", "59", "60" })
                    {
                        SolidWorksDocument.Extension.SelectByID2("Шайба DIN 125-" + s + "@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                        SolidWorksDocument.EditDelete();
                    }
                    SolidWorksDocument.Extension.SelectByID2("10-04-4-2@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.EditDelete();

                    //// Удаление ненужных элементов поперечной балки
                    SolidWorksDocument.Extension.SelectByID2("Регулируемая ножка-10@10-4", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Регулируемая ножка-11@10-4", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                    SolidWorksDocument.Extension.SelectByID2("Регулируемая ножка-002@10-4", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();

                    foreach (var s in new[] { "10", "11", "12", "13", "40", "41", "42", "43" })
                    {
                        SolidWorksDocument.Extension.SelectByID2("Гайка DIN 934-" + s + "@10-4", "COMPONENT", 0, 0, 0, true, 0, null, 0);
                        SolidWorksDocument.EditDelete();
                    }

                    int deleteOption = (int)swDeleteSelectionOptions_e.swDelete_Absorbed + (int)swDeleteSelectionOptions_e.swDelete_Children;
                    SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть5@10-03-01-4@10-4", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                    SolidWorksDocument.Extension.SelectByID2("Вырез-Вытянуть4@10-03-01-4@10-4", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.Extension.DeleteSelection2(deleteOption);
                }
                else
                {
                    //Продольные балки (Длина установки)
                    ID = 0;
                    ID = bildFrame.AirVents_AddAssemblyFrame(FrameType, width, 0, thikness, 0, 4, ref ID);

                    SolidWorksDocument.Extension.SelectByID2("10-04-4-2@10-4", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditUnsuppress2();

                    base.parameters.Add("D1@Эскиз1", lenght - 140);
                    base.parameters.Add("D1@Листовой металл", (double)BendRadius);
                    base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000);
                    base.parameters.Add("Толщина@Листовой металл", thikness);

                    EditPartParameters("10-04-4", base.NewPartPath + @"\10-" + ID, materialID);
                }

                #endregion
            }

            #region Изменение параметров
            if (internalCrossbeam == true)
            {
                ID = 0;
                ID = bildFrame.AirVents_AddAssemblyFrame(FrameType, width, 0, thikness, offset, 2, ref ID);
                bildFrame.SubmitChanges();

                SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("10-01-01-4");

                SolidWorksDocument.Extension.SaveAs(base.NewPartPath + @"\10-" + ID + ".SLDPRT", (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent
                                                    + (int)swSaveAsOptions_e.swSaveAsOptions_Copy, null, ref errors, warnings);
                SolidWorksAdapter.CloseDocument(SolidWorksDocument);

                SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("10-4");


                SolidWorksDocument.Extension.SelectByID2("10-01-01-4-2@10-4", "COMPONENT", 0, 0, 0, false, 0, null, 0);
                AssemblyDocument.ReplaceComponents(base.NewPartPath + @"\10-" + ID + ".SLDPRT", "", false, true);

                base.parameters.Add("D1@Эскиз1", lenght);
                base.parameters.Add("D3@Эскиз25", lenght - offset);
                base.parameters.Add("D1@Листовой металл", (double)BendRadius);
                base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000);
                base.parameters.Add("Толщина@Листовой металл", thikness);
                EditPartParameters(@"10-" + ID, base.NewPartPath + @"\10 -" + ID, materialID);
            }

            //Продольные балки (Длина установки)
            ID = 0;
            ID = bildFrame.AirVents_AddAssemblyFrame(FrameType, lenght, 0, thikness, offset, 1, ref ID);
            bildFrame.SubmitChanges();

            base.parameters.Add("D1@Эскиз1", lenght);
            base.parameters.Add("D3@Эскиз25", offset);
            base.parameters.Add("D1@Листовой металл", (double)BendRadius);
            base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000);
            base.parameters.Add("Толщина@Листовой металл", thikness);
            EditPartParameters("10-01-01-4", base.NewPartPath + @"\10-" + ID, materialID);

            // Поперечная балка (Ширина установки)
            ID = 0;
            ID = bildFrame.AirVents_AddAssemblyFrame(FrameType, Convert.ToInt32(width - 0.12), 0, thikness, 0, 3, ref ID);
            bildFrame.SubmitChanges();


            SolidWorksDocument = SolidWorksAdapter.AcativeteDoc("10-4");
            SolidWorksDocument.Extension.SelectByID2("10-03-01-4-1@10-4", "COMPONENT", 0, 0, 0, false, 0, null, 0);
            SolidWorksDocument.EditUnsuppress2();

            base.parameters.Add("D2@Эскиз1", width - 0.12);
            base.parameters.Add("D1@Листовой металл", (double)BendRadius);
            base.parameters.Add("D2@Листовой металл", (double)KFactor * 1000);
            base.parameters.Add("Толщина@Листовой металл", thikness);
            EditPartParameters("10-03-01-4", base.NewPartPath + @"\10-" + ID, materialID);
            #endregion

            SaveDoc(assmblName);
        }