Example #1
0
        public void Build(Vector3 frameSize, int profileType, ServiceSide serviceSide)
        {
            string caseAssemblyPath = Path.Combine(RootFolder, SourceFolder, modelName);

            Patterns.Observer.MessageObserver.Instance.SetMessage("\n" + caseAssemblyPath + "\n");
            ModelDoc2 SolidWorksDocument = SolidWorksAdapter.OpenDocument(caseAssemblyPath, swDocumentTypes_e.swDocASSEMBLY);// SolidWorksDocumentumentTypes_e.SolidWorksDocumentASSEMBLY);

            Patterns.Observer.MessageObserver.Instance.SetMessage("открылась сборка");
            //AssemblyDocument = SolidWorksAdapter.ToAssemblyDocument( SolidWorksDocument);
            double rivetL;
            string newName     = "01-P150-45-" + (frameSize.Z - 140);
            string newPartPath = GetFrameCasePath(newName);


            if (File.Exists(new FileInfo(newPartPath).FullName))
            {
                SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(modelName);
                SolidWorksDocument.Extension.SelectByID2("01-P150-45-1640-27@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, false, 0, null, 0);
                AssemblyDocument.ReplaceComponents(newPartPath, "", true, true);
                SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("01-P150-45-1640.SLDPRT");
            }
            else if (File.Exists(newPartPath) != true) // TO DO delegate
            {
                rivetL = (Math.Truncate((frameSize.Z - 170) / step) + 1) * 1000;
                parameters.Add("D1@Вытянуть1", frameSize.Z - 140);
                parameters.Add("D1@Кривая1", rivetL);
                EditPartParameters("01-P150-45-1640", newPartPath, 0);

                //frameSize.X

                newName     = "01-P150-45-" + (frameSize.X - 140);
                newPartPath = GetFrameCasePath(newName);
                if (File.Exists(new FileInfo(newPartPath).FullName))
                {
                    SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(modelName);
                    SolidWorksDocument.Extension.SelectByID2("01-003-50-22@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    AssemblyDocument.ReplaceComponents(newPartPath, "", true, true);
                    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("01-003-50.SLDPRT");
                }
                else
                {
                    rivetL = (Math.Truncate((frameSize.X - 170) / step) + 1) * 1000;
                    parameters.Add("D1@Вытянуть1", frameSize.X - 140);
                    parameters.Add("D1@Кривая1", rivetL);
                    EditPartParameters("01-P150-45-1640", newPartPath, 0);
                }

                //01-P252-45-770
                newName     = "01-P252-45-" + (frameSize.X - 100);
                newPartPath = newPartPath = GetFrameCasePath(newName);
                if (File.Exists(new FileInfo(newPartPath).FullName))
                {
                    SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(modelName);
                    SolidWorksDocument.Extension.SelectByID2("01-P252-45-770-6@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    AssemblyDocument.ReplaceComponents(newPartPath, "", true, true);
                    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("01-P252-45-770.SLDPRT");
                }
                else
                {
                    parameters.Add("D1@Вытянуть1", frameSize.X - 100);
                    EditPartParameters("01-P150-45-1640", newPartPath, 0);
                }

                //frameSize.Y

                newName     = "01-P150-45-" + (frameSize.Y - 140);
                newPartPath = newPartPath = GetFrameCasePath(newName);
                if (File.Exists(new FileInfo(newPartPath).FullName))
                {
                    SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(modelName);
                    SolidWorksDocument.Extension.SelectByID2("01-P150-45-510-23@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    AssemblyDocument.ReplaceComponents(newPartPath, "", true, true);
                    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("01-P150-45-510.SLDPRT");
                }
                else
                {
                    rivetL = (Math.Truncate((frameSize.Y - 170) / step) + 1) * 1000;

                    parameters.Add("D1@Вытянуть1", (frameSize.Y - 140));
                    parameters.Add("D1@Кривая1", rivetL);
                    EditPartParameters("01-P150-45-1640", newPartPath, 0);
                }

                //  01-P252-45-550
                newName     = "01-P252-45-" + (frameSize.Y - 100);
                newPartPath = newPartPath = GetFrameCasePath(newName);
                if (File.Exists(new FileInfo(newPartPath).FullName))
                {
                    SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(modelName);
                    SolidWorksDocument.Extension.SelectByID2("01-P252-45-550-10@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    AssemblyDocument.ReplaceComponents(newPartPath, "", true, true);
                    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("01-P252-45-550.SLDPRT");
                }
                else
                {
                    parameters.Add("D1@Вытянуть1", frameSize.Y - 100);
                    EditPartParameters("01-P252-45-550", newPartPath, 0);
                }

                SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(modelName);
                SolidWorksDocument.EditRebuild3();
                SolidWorksDocument.ForceRebuild3(true);
                //   AssemblyDocument = (AssemblyDoc)SolidWorksDocument;

                if (serviceSide == ServiceSide.Left)
                {
                    SolidWorksDocument.Extension.SelectByID2("M8-Panel block-one side-1@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("M8-Panel block-one side-6@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("M8-Panel block-one side-7@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets с насечкой-10@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets с насечкой-4@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets с насечкой-12@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets с насечкой-12@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                }
                else if (serviceSide == ServiceSide.Right)
                {
                    SolidWorksDocument.Extension.SelectByID2("M8-Panel block-one side-16@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets с насечкой-21@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets с насечкой-22@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("M8-Panel block-one side-17@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("Threaded Rivets с насечкой-23@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("M8-Panel block-one side-18@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, true, 0, null, 0);
                    SolidWorksDocument.Extension.SelectByID2("M8-Panel block-one side-18@" + modelName.Replace(".SLDASM", ""), "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    SolidWorksDocument.EditDelete();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Build Insulation
        /// </summary>
        private void Insulation(PanelProfile_e profile)
        {
            string MaterialsFolder = "Materials";

            PartName = "02-03-" + (profile == PanelProfile_e.Profile_5_0 ? string.Empty : ((int)profile).ToString()) + sizePanel.X + "-" + sizePanel.Y;

            string tapeMaterialName = string.Empty, insulationMaterialName = string.Empty;

            switch (profile)
            {
            case PanelProfile_e.Profile_3_0:
                tapeMaterialName       = "Лента 30";
                insulationMaterialName = "";
                break;

            case PanelProfile_e.Profile_5_0:
                tapeMaterialName       = "Лента 50";
                insulationMaterialName = "";
                break;

            case PanelProfile_e.Profile_7_0:
                tapeMaterialName       = "Лента 50";
                insulationMaterialName = "";
                break;
            }

            SolidWorksDocument.Extension.CustomPropertyManager["00"].Add3("Наименование", (int)swCustomInfoType_e.swCustomInfoText, tapeMaterialName, (int)swCustomPropertyAddOption_e.swCustomPropertyReplaceValue);
            SolidWorksDocument.Extension.CustomPropertyManager["00"].Add3("Наименование", (int)swCustomInfoType_e.swCustomInfoText, insulationMaterialName, (int)swCustomPropertyAddOption_e.swCustomPropertyReplaceValue);

            if (CheckExistPart != null)
            {
                CheckExistPart(PartName, out IsPartExist, out NewPartPath);
            }
            if (IsPartExist)
            {
                SolidWorksDocument.Extension.SelectByID2("02-01-003@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                AssemblyDocument.ReplaceComponents(base.NewPartPath, "", false, true);
            }
            else
            {
                base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, MaterialsFolder, PartName);
                base.parameters.Add("D1@Эскиз1", innerWeidht);
                base.parameters.Add("D2@Эскиз1", innerHeight);
                base.parameters.Add("D1@Бобышка-Вытянуть1", deepInsulation);
                // TO DO change lenght by profile, propertis
                EditPartParameters("02-01-003", base.NewPartPath);
            }

            PartName = "02-04-" + (profile == PanelProfile_e.Profile_5_0 ? string.Empty : ((int)profile).ToString()) + sizePanel.X + "-" + sizePanel.Y;
            if (CheckExistPart != null)
            {
                CheckExistPart(PartName, out IsPartExist, out NewPartPath);
            }
            if (IsPartExist)
            {
                SolidWorksDocument.Extension.SelectByID2("02-01-004@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                AssemblyDocument.ReplaceComponents(base.NewPartPath, "", false, true);
            }
            else
            {
                base.NewPartPath = Path.Combine(RootFolder, SubjectDestinationFolder, MaterialsFolder, PartName);
                base.parameters.Add("D6@Эскиз1", innerWeidht);
                base.parameters.Add("D3@Эскиз1", innerHeight);
                EditPartParameters("02-01-004", base.NewPartPath);
            }
        }
Example #3
0
        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);
            }
        }
Example #4
0
        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);
            }
        }
        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);
        }
Example #6
0
        //Profiles for reinforcing panel
        #region Усиливающие рамки
        public void ReinforcingProfile(string testName)
        {
            const double thiknessF = 1;
            //var bendParams = sbSqlBaseData.BendTable(thiknessF);
            //var bendRadius = Convert.ToDouble(bendParams[0]);
            //var kFactor = Convert.ToDouble(bendParams[1]);
            const double heightF = 38.0; // Артурчик сказал не надо. 06.03.2017 16:45

            #region  Усиливающая рамка по ширине
            //newName = усиливающаяРамкаПоШирине.NewName;
            //newName = modelName + "-06-" + width + "-" + "40-" + materialP2[0] + скотч;
            //newPartPath = $@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}.SLDPRT";



            SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(testName);// "02-11-07-40-"); // horisontal up

            if (false)
            {
            }
            else
            {
                parameters.Add("D2@Эскиз1", framelessPanel.PanelType == PanelType_e.RemovablePanel ? framelessPanel.SizePanel.X - 49.2 : framelessPanel.SizePanel.X - 47.2);
                //parameters.Add("D1@Эскиз1", heightF);
                parameters.Add("D1@Кривая3", ScrewsByWidthInner);
                parameters.Add("D1@Кривая2", колСаморезВинтШирина);
                //Размеры для отверсти под клепальные гайки под съемные панели
                parameters.Add("G0@Эскиз32", OutputHolesWrapper.G0 - 3.6);
                parameters.Add("G1@Эскиз32", OutputHolesWrapper.G1);
                parameters.Add("G2@Эскиз32", OutputHolesWrapper.G2);
                parameters.Add("G3@Эскиз32", OutputHolesWrapper.G0);
                //Convert.ToString(количествоВинтов)
                parameters.Add("L1@Эскиз32", OutputHolesWrapper.L1);
                parameters.Add("D1@Кривая4", OutputHolesWrapper.D1);
                parameters.Add("L2@Эскиз32", OutputHolesWrapper.L2);
                parameters.Add("D1@Кривая5", OutputHolesWrapper.D2);
                parameters.Add("L3@Эскиз32", OutputHolesWrapper.L3);
                parameters.Add("D1@Кривая6", OutputHolesWrapper.D3);
                parameters.Add("Толщина@Листовой металл", thiknessF);
                parameters.Add("D1@Листовой металл", (double)BendRadius);
                parameters.Add("D2@Листовой металл", (double)KFactor * 1000);
                EditPartParameters("02-11-06-40-", "", 0);
                //    $@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}",
            }

            #endregion

            #region  Усиливающая рамка по ширине 2

            if (framelessPanel.PanelType == PanelType_e.BlankPanel)
            {
                SolidWorksDocument = ((ModelDoc2)(SolidWorksAdapter.SldWoksAppExemplare.ActivateDoc2(AssemblyName + ".SLDASM", true, 0)));
                DocumentExtension.SelectByID2("02-11-06_2-40--4@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                //  AssemblyDocument.ReplaceComponents(System.IO.Path.Combine(RootFolder, SubjectDestinationFolder, усиливающаяРамкаПоШирине.NewName + "SLDPRT"), String.Empty, true, true);
                //($@"{RootFolder}\{SubjectDestinationFolder}\{усиливающаяРамкаПоШирине.NewName}.SLDPRT", "", true, true);

                SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("02-11-06_2-40-.SLDPRT");
            }
            else
            {
                //newName = усиливающаяРамкаПоШирине2.NewName;
                //newName = modelName + "-06-" + width + "-" + "40-" + materialP2[0] + скотч;
                //newPartPath = $@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}.SLDPRT";

                if (false)
                {
                    SolidWorksDocument = ((ModelDoc2)(SolidWorksAdapter.SldWoksAppExemplare.ActivateDoc2(AssemblyName + ".SLDASM", true, 0)));
                    DocumentExtension.SelectByID2("02-11-06_2-40--4@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    AssemblyDocument.ReplaceComponents(base.NewPartPath, "", true, true);
                    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("02-11-06_2-40-.SLDPRT");
                }
                else
                {
                    parameters.Add("D2@Эскиз1", framelessPanel.PanelType == PanelType_e.RemovablePanel ? framelessPanel.SizePanel.X - 49.2 : framelessPanel.SizePanel.X - 47.2);
                    parameters.Add("D1@Эскиз1", heightF);
                    parameters.Add("D1@Кривая3", ScrewsByWidthInner);
                    parameters.Add("D1@Кривая2", колСаморезВинтШирина);
                    parameters.Add("G0@Эскиз32", OutputHolesWrapper.G0 - 3.6);
                    parameters.Add("G1@Эскиз32", OutputHolesWrapper.G1);
                    parameters.Add("G2@Эскиз32", OutputHolesWrapper.G2);
                    parameters.Add("G3@Эскиз32", OutputHolesWrapper.G0);
                    parameters.Add("L1@Эскиз32", OutputHolesWrapper.L1);
                    parameters.Add("D1@Кривая4", OutputHolesWrapper.D1);
                    parameters.Add("L2@Эскиз32", OutputHolesWrapper.L2);
                    parameters.Add("D1@Кривая5", OutputHolesWrapper.D2);
                    parameters.Add("L3@Эскиз32", OutputHolesWrapper.L3);
                    parameters.Add("D1@Кривая6", OutputHolesWrapper.D3);
                    parameters.Add("Толщина@Листовой металл", thiknessF);
                    parameters.Add("D1@Листовой металл", (double)base.BendRadius);
                    parameters.Add("D2@Листовой металл", (double)base.KFactor * 1000);
                    EditPartParameters("02-11-06_2-40-", NewPartPath, 0);
                }
            }

            #endregion

            #region  Усиливающая рамка по высоте

            // PartName = усиливающаяРамкаПоВысоте.NewName;

            NewPartPath = "";                                                                                   // newName = modelName + "-07-" + lenght + "-" + "40-" + materialP2[0] + скотч;
            NewPartPath = System.IO.Path.Combine(RootFolder, SubjectDestinationFolder, NewPartPath + "SLDPRT"); //$@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}.SLDPRT";

            //if (GetExistingFile(Path.GetFileNameWithoutExtension(NewPartPath), 1)) {
            //    SolidWorksDocument = ((ModelDoc2)(SolidWorksAdapter.SldWoksAppExemplare.ActivateDoc2(AssemblyName + ".SLDASM", true, 0)));
            //    DocumentExtension.SelectByID2("02-11-07-40--1@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
            //    AssemblyDocument.ReplaceComponents(newPartPath, "", true, true);
            //    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("02-11-07-40-.SLDPRT");
            if (false)
            {
                ;
            }

            else
            {
                parameters.Add("D3@Эскиз1", framelessPanel.PanelType == PanelType_e.RemovablePanel ? framelessPanel.SizePanel.Y - 2 : framelessPanel.SizePanel.Y);
                parameters.Add("D1@Эскиз1", heightF);
                parameters.Add("D1@Эскиз23", framelessPanel.PanelType == PanelType_e.BlankPanel ? 44.4 : 125);
                parameters.Add("D1@Кривая2", ScrewsByHeightInner);
                parameters.Add("D1@Кривая1", колЗаклепокВысота);
                parameters.Add("Толщина@Листовой металл", thiknessF);
                parameters.Add("D1@Листовой металл", (double)base.BendRadius);
                parameters.Add("D2@Листовой металл", (double)base.KFactor * 1000);

                EditPartParameters("02-11-07-40-", NewPartPath, 0);
                #endregion
            }

            #endregion
        }