Example #1
0
        public FrmDPCJ330(Drawing drawing, ModuleTree tree) : this()
        {
            objDPCJ330 = (DPCJ330)objDPCJ330Service.GetModelByModuleTreeId(tree.ModuleTreeId.ToString());
            if (objDPCJ330 == null)
            {
                return;
            }
            this.Text = drawing.ODPNo + " / Item: " + drawing.Item + " / Module: " + tree.Module + " - " + tree.CategoryName;
            Category objCategory = objCategoryService.GetCategoryByCategoryId(tree.CategoryId.ToString());

            pbModelImage.Image = objCategory.ModelImage.Length == 0
                ? Image.FromFile("NoPic.png")
                : (Image) new SerializeObjectToString().DeserializeObject(objCategory.ModelImage);
            FillData();
        }
Example #2
0
        public int EditModel(IModel model)
        {
            DPCJ330 objModel = (DPCJ330)model;
            //编写带参数的SQL语句
            StringBuilder sqlBuilder = new StringBuilder();

            sqlBuilder.Append("Update DPCJ330 set Length=@Length,SidePanel=@SidePanel,SuType=@SuType,SuDis=@SuDis,Outlet=@Outlet,");
            sqlBuilder.Append("BackCJSide=@BackCJSide,DPSide=@DPSide,LeftDis=@LeftDis,RightDis=@RightDis,");
            sqlBuilder.Append("LeftBeamType=@LeftBeamType,LeftBeamDis=@LeftBeamDis,RightBeamType=@RightBeamType,RightBeamDis=@RightBeamDis,");
            sqlBuilder.Append("LKSide=@LKSide,GutterSide=@GutterSide,GutterWidth=@GutterWidth where DPCJ330Id=@DPCJ330Id");
            //定义参数数组
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@Length", objModel.Length),
                new SqlParameter("@SidePanel", objModel.SidePanel),
                new SqlParameter("@SuType", objModel.SuType),
                new SqlParameter("@SuDis", objModel.SuDis),
                new SqlParameter("@Outlet", objModel.Outlet),
                new SqlParameter("@BackCJSide", objModel.BackCJSide),
                new SqlParameter("@DPSide", objModel.DPSide),
                new SqlParameter("@LeftDis", objModel.LeftDis),
                new SqlParameter("@RightDis", objModel.RightDis),
                new SqlParameter("@LeftBeamType", objModel.LeftBeamType),
                new SqlParameter("@LeftBeamDis", objModel.LeftBeamDis),
                new SqlParameter("@RightBeamType", objModel.RightBeamType),
                new SqlParameter("@RightBeamDis", objModel.RightBeamDis),
                new SqlParameter("@LKSide", objModel.LKSide),
                new SqlParameter("@GutterSide", objModel.GutterSide),
                new SqlParameter("@GutterWidth", objModel.GutterWidth),
                new SqlParameter("@DPCJ330Id", objModel.DPCJ330Id)
            };
            try
            {
                return(SQLHelper.Update(sqlBuilder.ToString(), param));
            }
            catch (SqlException ex)
            {
                throw new Exception("数据库操作出现异常:" + ex.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public IModel GetModelByWhereSql(string whereSql)
        {
            string sql =
                "select DPCJ330Id,ModuleTreeId,Length,SidePanel,SuType,SuDis,Outlet,BackCJSide,DPSide,LeftDis,RightDis," +
                "LeftBeamType,LeftBeamDis,RightBeamType,RightBeamDis,LKSide,GutterSide,GutterWidth from DPCJ330";

            sql += whereSql;
            SqlDataReader objReader = SQLHelper.GetReader(sql);
            DPCJ330       objModel  = null;

            if (objReader.Read())
            {
                objModel = new DPCJ330()
                {
                    DPCJ330Id    = Convert.ToInt32(objReader["DPCJ330Id"]),
                    ModuleTreeId = Convert.ToInt32(objReader["ModuleTreeId"]),
                    //最好不要用=null去判断,提示类型转换错误
                    Length       = objReader["Length"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["Length"]),
                    SuDis        = objReader["SuDis"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["SuDis"]),
                    LeftDis      = objReader["LeftDis"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["LeftDis"]),
                    RightDis     = objReader["RightDis"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["RightDis"]),
                    LeftBeamDis  = objReader["LeftBeamDis"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["LeftBeamDis"]),
                    RightBeamDis = objReader["RightBeamDis"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["RightBeamDis"]),
                    GutterWidth  = objReader["GutterWidth"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["GutterWidth"]),

                    SidePanel     = objReader["SidePanel"].ToString().Length == 0 ? "" : objReader["SidePanel"].ToString(),
                    SuType        = objReader["SuType"].ToString().Length == 0 ? "" : objReader["SuType"].ToString(),
                    Outlet        = objReader["Outlet"].ToString().Length == 0 ? "" : objReader["Outlet"].ToString(),
                    BackCJSide    = objReader["BackCJSide"].ToString().Length == 0 ? "" : objReader["BackCJSide"].ToString(),
                    DPSide        = objReader["DPSide"].ToString().Length == 0 ? "" : objReader["DPSide"].ToString(),
                    LeftBeamType  = objReader["LeftBeamType"].ToString().Length == 0 ? "" : objReader["LeftBeamType"].ToString(),
                    RightBeamType = objReader["RightBeamType"].ToString().Length == 0 ? "" : objReader["RightBeamType"].ToString(),
                    LKSide        = objReader["LKSide"].ToString().Length == 0 ? "" : objReader["LKSide"].ToString(),
                    GutterSide    = objReader["GutterSide"].ToString().Length == 0 ? "" : objReader["GutterSide"].ToString(),
                };
            }
            objReader.Close();
            return(objModel);
        }
Example #4
0
        public void AutoDrawing(SldWorks swApp, ModuleTree tree, string projectPath)
        {
            //创建项目模型存放地址
            string itemPath = projectPath + @"\" + tree.Module + "-" + tree.CategoryName;

            if (!Directory.Exists(itemPath))
            {
                Directory.CreateDirectory(itemPath);
            }
            else
            {
                DialogResult result =
                    MessageBox.Show("模型文件夹" + itemPath + "存在,如果之前pack已经执行过,将不执行pack过程而是直接修改模型,如果要继续请点击YES,否请点击No中断作图", "提示信息",
                                    MessageBoxButtons.YesNo);
                if (result == DialogResult.No)
                {
                    return;
                }
            }
            //Pack的后缀
            string suffix = tree.Module + "-" + tree.ODPNo.Substring(tree.ODPNo.Length - 6);
            //判断文件是否存在,如果存在将不执行pack,如果不存在则执行pack
            //packango后需要接收打包完成的地址,参数为后缀
            string packedAssyPath = itemPath + @"\" + tree.CategoryName.ToLower() + "_" + suffix + ".sldasm";

            if (!File.Exists(packedAssyPath))
            {
                packedAssyPath = CommonFunc.PackAndGoFunc(suffix, swApp, tree.ModelPath, itemPath);
            }

            //查询参数
            DPCJ330 item = (DPCJ330)objDPCJ330Service.GetModelByModuleTreeId(tree.ModuleTreeId.ToString());

            swApp.CommandInProgress = true; //告诉SolidWorks,现在是用外部程序调用命令
            int warnings = 0;
            int errors   = 0;

            suffix = "_" + suffix;//后缀
            ModelDoc2         swModel    = default(ModelDoc2);
            ModelDoc2         swSubModel = default(ModelDoc2);
            ModelDoc2         swPart     = default(ModelDoc2);
            AssemblyDoc       swAssy     = default(AssemblyDoc);
            AssemblyDoc       swSubAssy  = default(AssemblyDoc);
            Component2        swComp;
            Feature           swFeat           = default(Feature);
            object            configNames      = null;
            ModelDocExtension swModelDocExt    = default(ModelDocExtension);
            ModelDocExtension swSubModelDocExt = default(ModelDocExtension);
            bool   status      = false;
            string compReName  = string.Empty;
            string subAssyName = string.Empty;

            //打开Pack后的模型
            swModel = swApp.OpenDoc6(packedAssyPath, (int)swDocumentTypes_e.swDocASSEMBLY,
                                     (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref errors, ref warnings) as ModelDoc2;
            swAssy = swModel as AssemblyDoc;                                                  //装配体
            string assyName = swModel.GetTitle().Substring(0, swModel.GetTitle().Length - 7); //获取装配体名称

            swModelDocExt = (ModelDocExtension)swModel.Extension;
            //打开装配体后必须重建,使Pack后的零件名都更新到带后缀的状态,否则程序出错
            swModel.ForceRebuild3(true);
            //TopOnly参数设置成true,只重建顶层,不重建零件内部

            /*注意SolidWorks单位是m,计算是应当/1000m
             * 整形与整形运算得出的结果仍然时整形,1640 / 1000m结果为0,因此必须将其中一个转化成decimal型,使用后缀m就可以了
             * (int)不进行四舍五入,Convert.ToInt32会四舍五入
             */
            //-----------计算中间值,----------
            int     cjNo       = (int)((item.Length - 40m) / 30m);//天花烟罩马蹄形CJ孔阵列距离为30
            decimal firstCjDis = (item.Length - 30m * cjNo) / 2;

            if (firstCjDis < 15m)
            {
                cjNo--;
                firstCjDis = firstCjDis + 15m;
            }
            decimal leftSBDis  = item.LeftDis;
            decimal rightSBDis = item.RightDis;

            try
            {
                //----------Top Level----------
                //----------CJ腔----------
                swComp     = swAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "CJ330INDPCJ-1"));
                swSubAssy  = swComp.GetModelDoc2(); //打开零件
                swSubModel = (ModelDoc2)swSubAssy;
                //----------脖颈----------
                if (item.SuType == "UP")
                {
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0010-1"));
                    swComp.SetSuppression2(2); //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "5201990413-1"));
                    swComp.SetSuppression2(0); //2解压缩,0压缩.
                }
                else
                {
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0010-1"));
                    swComp.SetSuppression2(0); //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "5201990413-1"));
                    swComp.SetSuppression2(2); //2解压缩,0压缩.
                }
                //----------侧板----------
                switch (item.SidePanel)
                {
                case "LEFT":
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0025-5"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-3"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0026-1"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-4"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    break;

                case "RIGHT":
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0025-5"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-3"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0026-1"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-4"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    break;

                case "MIDDLE":
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0025-5"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-3"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0026-1"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-4"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    break;

                default:
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0025-5"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-3"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0026-1"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0027-4"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    break;
                }
                //----------CJ腔主体----------
                swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0023-2"));
                swPart = swComp.GetModelDoc2(); //打开零件
                swPart.Parameter("D2@Skizze1").SystemValue   = item.Length / 1000m;
                swPart.Parameter("D1@LPattern7").SystemValue = cjNo + 1;
                swPart.Parameter("D3@Skizze18").SystemValue  = firstCjDis / 1000m;
                swFeat = swComp.FeatureByName("BCJ-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩.
                swFeat = swComp.FeatureByName("BCJ-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJDB800-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCWDB800-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJSB535-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCWSB535-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("UCJSB385-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJSB290-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJSB265-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCWSB265-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("GUTTER-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("LKS270-LEFT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJDB800-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCWDB800-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJSB535-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCWSB535-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("UCJSB385-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJSB290-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCJSB265-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("KCWSB265-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                swFeat = swComp.FeatureByName("LKS270-RIGHT");
                swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩

                //----------其他零件----------
                swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0016-1"));
                swPart = swComp.GetModelDoc2(); //打开零件
                swPart.Parameter("D2@Sketch1").SystemValue = (item.Length - 10m) / 1000m;
                swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0024-1"));
                swPart = swComp.GetModelDoc2(); //打开零件
                swPart.Parameter("D1@Skizze1").SystemValue = item.Length / 1000m;
                swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCJ0022-1"));
                swPart = swComp.GetModelDoc2(); //打开零件
                swPart.Parameter("D4@Skizze1").SystemValue = item.Length / 1000m;
                swPart.Parameter("D4@Skizze3").SystemValue = item.SuDis / 1000m;



                //----------DP腔----------
                swComp           = swAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "DP330INDPCJ-1"));
                swSubAssy        = swComp.GetModelDoc2();                                                //打开零件
                swSubModel       = (ModelDoc2)swSubAssy;
                subAssyName      = swSubModel.GetTitle().Substring(0, swSubModel.GetTitle().Length - 7); //获取装配体名称
                swSubModelDocExt = (ModelDocExtension)swSubModel.Extension;
                //----------吊装扣板----------
                if (item.Length < 1000m)
                {
                    swSubModel.Parameter("D1@LocalLPattern2").SystemValue = 2;
                    swSubModel.Parameter("D3@LocalLPattern2").SystemValue = (item.Length - 400m) / 1000m;
                }
                else if (item.Length >= 1000m && item.Length < 2000m)
                {
                    swSubModel.Parameter("D1@LocalLPattern2").SystemValue = 3;
                    swSubModel.Parameter("D3@LocalLPattern2").SystemValue = (item.Length - 400m) / 2000m;
                }
                else
                {
                    swSubModel.Parameter("D1@LocalLPattern2").SystemValue = 4;
                    swSubModel.Parameter("D3@LocalLPattern2").SystemValue = (item.Length - 400m) / 3000m;
                }
                //----------侧板----------
                switch (item.SidePanel)
                {
                case "LEFT":
                case "DPBACKL":
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0011-1"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-2"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0012-1"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-3"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    break;

                case "RIGHT":
                case "DPBACKR":
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0011-1"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-2"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0012-1"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-3"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    break;

                case "MIDDLE":
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0011-1"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-2"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0012-1"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-3"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    break;

                default:
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0011-1"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-2"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0012-1"));
                    swComp.SetSuppression2(2);     //2解压缩,0压缩.
                    swComp = swSubAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCS0013-3"));
                    swComp.SetSuppression2(0);     //2解压缩,0压缩.
                    break;
                }

                //----------NOCJ腔主体----------
                //重命名装配体内部
                compReName = "FNCS0001[DPCJ330-" + tree.Module + "]{" + (int)item.Length + "}";
                status     = swSubModelDocExt.SelectByID2(CommonFunc.AddSuffix(suffix, "FNCS0001-1") + "@" + subAssyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                if (status)
                {
                    swSubModelDocExt.RenameDocument(compReName);
                }
                swSubModel.ClearSelection2(true);
                status = swSubModelDocExt.SelectByID2(compReName + "-1" + "@" + subAssyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                swSubModel.ClearSelection2(true);
                if (status)
                {
                    swComp = swSubAssy.GetComponentByName(compReName + "-1");
                    swPart = swComp.GetModelDoc2(); //打开零件
                    swPart.Parameter("D2@Skizze1").SystemValue = item.Length / 1000m;
                    if (item.Outlet == "LEFT")
                    {
                        swFeat = swComp.FeatureByName("OUTLET-LEFT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("OUTLET-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    else if (item.Outlet == "RIGHT")
                    {
                        swFeat = swComp.FeatureByName("OUTLET-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("OUTLET-RIGHT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("OUTLET-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("OUTLET-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    swFeat = swComp.FeatureByName("DPB-LEFT");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    swFeat = swComp.FeatureByName("DPB-RIGHT");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩

                    //DP
                    if (item.DPSide == "LEFT" || item.DPSide == "BOTH")
                    {
                        swFeat = swComp.FeatureByName("DP-LEFT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D14@Sketch42").SystemValue = (item.LeftDis + 1m) / 1000m;
                        leftSBDis = leftSBDis + 90m;
                        swFeat    = swComp.FeatureByName("CUT-LEFT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D1@Sketch56").SystemValue = 105m / 1000m;
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("DP-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("CUT-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    if (item.DPSide == "RIGHT" || item.DPSide == "BOTH")
                    {
                        swFeat = swComp.FeatureByName("DP-RIGHT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D14@Sketch43").SystemValue = (item.RightDis + 1m) / 1000m;
                        rightSBDis = rightSBDis + 90m;
                        swFeat     = swComp.FeatureByName("CUT-RIGHT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D1@Sketch58").SystemValue = 105m / 1000m;
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("DP-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("CUT-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    //BCJ
                    if (item.BackCJSide == "LEFT" || item.BackCJSide == "BOTH")
                    {
                        swFeat = swComp.FeatureByName("BCJ-LEFT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D8@Sketch19").SystemValue = (item.LeftDis + 11m) / 1000m;
                        leftSBDis = leftSBDis + 90m;
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("BCJ-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    if (item.BackCJSide == "RIGHT" || item.BackCJSide == "BOTH")
                    {
                        swFeat = swComp.FeatureByName("BCJ-RIGHT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D1@Sketch20").SystemValue = (item.RightDis + 11m) / 1000m;
                        rightSBDis = rightSBDis + 90m;
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("BCJ-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    //----------左----------
                    ////左类型排风腔KCJDB800
                    //if (item.LeftBeamType == "KCJDB800" || item.LeftBeamType == "UCJDB800")
                    //{
                    //    swFeat = swComp.FeatureByName("BCJ-LEFT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //    swFeat = swComp.FeatureByName("KCJDB800-LEFT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D59@Sketch46").SystemValue = (item.LeftBeamDis + 1m) / 1000m;
                    //    if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-LEFT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch48").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch48").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D6@Sketch48").SystemValue = (item.Length - item.LeftBeamDis + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJDB800-LEFT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    //左类型排风腔KCWDB800
                    if (item.LeftBeamType == "KCWDB800" || item.LeftBeamType == "UCWDB800")
                    {
                        swFeat = swComp.FeatureByName("BCJ-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("DP-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("KCWDB800-LEFT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D30@Sketch50").SystemValue = (item.LeftBeamDis + 1m) / 1000m;
                        if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                        {
                            swFeat = swComp.FeatureByName("GUTTER-LEFT");
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D4@Sketch53").SystemValue = (item.GutterWidth - 2m) / 1000m;
                            swPart.Parameter("D5@Sketch53").SystemValue = (item.GutterWidth - 62m) / 1000m;
                            swPart.Parameter("D7@Sketch53").SystemValue = (item.Length - item.LeftBeamDis + 1m) / 1000m;
                        }
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("KCWDB800-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    ////左类型排风腔KCJSB535
                    //if (item.LeftBeamType == "KCJSB535" || item.LeftBeamType == "UCJSB535")
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB535-LEFT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D46@Sketch35").SystemValue = (leftSBDis + 1m) / 1000m;
                    //    if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-LEFT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch48").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch48").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D6@Sketch48").SystemValue = (leftSBDis + 535m + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB535-LEFT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    //左类型排风腔KCWSB535
                    if (item.LeftBeamType == "KCWSB535" || item.LeftBeamType == "UCWSB535")
                    {
                        swFeat = swComp.FeatureByName("KCWSB535-LEFT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D25@Sketch48").SystemValue = (leftSBDis + 1m) / 1000m;
                        if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                        {
                            swFeat = swComp.FeatureByName("GUTTER-LEFT");
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D4@Sketch53").SystemValue = (item.GutterWidth - 2m) / 1000m;
                            swPart.Parameter("D5@Sketch53").SystemValue = (item.GutterWidth - 62m) / 1000m;
                            swPart.Parameter("D7@Sketch53").SystemValue = (leftSBDis + 535m + 1m) / 1000m;
                        }
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("KCWSB535-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    ////左类型排风腔UCJSB385
                    //if (item.LeftBeamType == "UCJSB385")
                    //{
                    //    swFeat = swComp.FeatureByName("UCJSB385-LEFT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D16@Sketch43").SystemValue = (leftSBDis + 1m) / 1000m;
                    //    if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-LEFT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch48").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch48").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D6@Sketch48").SystemValue = (leftSBDis + 385m + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("UCJSB385-LEFT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    ////左类型排风腔KCJSB290
                    //if (item.LeftBeamType == "KCJSB290")
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB290-LEFT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D14@Sketch41").SystemValue = (leftSBDis + 1m) / 1000m;
                    //    if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-LEFT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch48").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch48").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D6@Sketch48").SystemValue = (leftSBDis + 290m + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB290-LEFT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    ////左类型排风腔KCJSB265
                    //if (item.LeftBeamType == "KCJSB265")
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB265-LEFT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D23@Sketch28").SystemValue = (leftSBDis + 1m) / 1000m;
                    //    if (item.LKSide == "LEFT" || item.LKSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("LKS270-LEFT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D24@Sketch51").SystemValue = (leftSBDis + 265m + 1m) / 1000m;
                    //        if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                    //        {
                    //            swFeat = swComp.FeatureByName("GUTTER-LEFT");
                    //            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //            swPart.Parameter("D4@Sketch48").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //            swPart.Parameter("D5@Sketch48").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //            swPart.Parameter("D6@Sketch48").SystemValue = (leftSBDis + 270m + 265m + 1m) / 1000m;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                    //        {
                    //            swFeat = swComp.FeatureByName("GUTTER-LEFT");
                    //            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //            swPart.Parameter("D4@Sketch48").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //            swPart.Parameter("D5@Sketch48").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //            swPart.Parameter("D6@Sketch48").SystemValue = (leftSBDis + 265m + 1m) / 1000m;
                    //        }
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB265-LEFT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    //左类型排风腔KCWSB265
                    if (item.LeftBeamType == "KCWSB265")
                    {
                        swFeat = swComp.FeatureByName("KCWSB265-LEFT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D15@Sketch46").SystemValue = (leftSBDis + 1m) / 1000m;
                        if (item.LKSide == "LEFT" || item.LKSide == "BOTH")
                        {
                            swFeat = swComp.FeatureByName("LKS270-LEFT");
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D24@Sketch52").SystemValue = (leftSBDis + 265m + 1m) / 1000m;
                            if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                            {
                                swFeat = swComp.FeatureByName("GUTTER-LEFT");
                                swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                                swPart.Parameter("D4@Sketch53").SystemValue = (item.GutterWidth - 2m) / 1000m;
                                swPart.Parameter("D5@Sketch53").SystemValue = (item.GutterWidth - 62m) / 1000m;
                                swPart.Parameter("D7@Sketch53").SystemValue = (leftSBDis + 270m + 265m + 1m) / 1000m;
                            }
                        }
                        else
                        {
                            if (item.GutterSide == "LEFT" || item.GutterSide == "BOTH")
                            {
                                swFeat = swComp.FeatureByName("GUTTER-LEFT");
                                swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                                swPart.Parameter("D4@Sketch53").SystemValue = (item.GutterWidth - 2m) / 1000m;
                                swPart.Parameter("D5@Sketch53").SystemValue = (item.GutterWidth - 62m) / 1000m;
                                swPart.Parameter("D7@Sketch53").SystemValue = (leftSBDis + 265m + 1m) / 1000m;
                            }
                        }
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("KCWSB265-LEFT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }

                    //----------右----------
                    ////右类型排风腔KCJDB800
                    //if (item.RightBeamType == "KCJDB800" || item.RightBeamType == "UCJDB800")
                    //{
                    //    swFeat = swComp.FeatureByName("BCJ-RIGHT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //    swFeat = swComp.FeatureByName("KCJDB800-RIGHT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D59@Sketch47").SystemValue = (item.RightBeamDis + 1m) / 1000m;
                    //    if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch50").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch50").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D7@Sketch50").SystemValue = (item.Length - item.RightBeamDis + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJDB800-RIGHT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    //右类型排风腔KCWDB800
                    if (item.RightBeamType == "KCWDB800" || item.RightBeamType == "UCWDB800")
                    {
                        swFeat = swComp.FeatureByName("BCJ-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("DP-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("KCWDB800-RIGHT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D31@Sketch51").SystemValue = (item.RightBeamDis + 1m) / 1000m;
                        if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                        {
                            swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D4@Sketch55").SystemValue = (item.GutterWidth - 2m) / 1000m;
                            swPart.Parameter("D5@Sketch55").SystemValue = (item.GutterWidth - 62m) / 1000m;
                            swPart.Parameter("D7@Sketch55").SystemValue =
                                (item.Length - item.RightBeamDis + 1m) / 1000m;
                        }
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("KCWDB800-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    ////右类型排风腔KCJSB535
                    //if (item.RightBeamType == "KCJSB535" || item.RightBeamType == "UCJSB535")
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB535-RIGHT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D46@Sketch37").SystemValue = (rightSBDis + 1m) / 1000m;
                    //    if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch50").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch50").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D7@Sketch50").SystemValue = (rightSBDis + 535m + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB535-RIGHT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    //右类型排风腔KCWSB535
                    if (item.RightBeamType == "KCWSB535" || item.RightBeamType == "UCWSB535")
                    {
                        swFeat = swComp.FeatureByName("KCWSB535-RIGHT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D24@Sketch49").SystemValue = (rightSBDis + 1m) / 1000m;
                        if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                        {
                            swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D4@Sketch55").SystemValue = (item.GutterWidth - 2m) / 1000m;
                            swPart.Parameter("D5@Sketch55").SystemValue = (item.GutterWidth - 62m) / 1000m;
                            swPart.Parameter("D7@Sketch55").SystemValue = (rightSBDis + 535m + 1m) / 1000m;
                        }
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("KCWSB535-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    ////右类型排风腔UCJSB385
                    //if (item.RightBeamType == "UCJSB385")
                    //{
                    //    swFeat = swComp.FeatureByName("UCJSB385-RIGHT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D16@Sketch44").SystemValue = (rightSBDis + 1m) / 1000m;
                    //    if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch50").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch50").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D7@Sketch50").SystemValue = (rightSBDis + 385m + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("UCJSB385-RIGHT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    ////右类型排风腔KCJSB290
                    //if (item.RightBeamType == "KCJSB290")
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB290-RIGHT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D14@Sketch42").SystemValue = (rightSBDis + 1m) / 1000m;
                    //    if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D4@Sketch50").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //        swPart.Parameter("D5@Sketch50").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //        swPart.Parameter("D7@Sketch50").SystemValue = (rightSBDis + 290m + 1m) / 1000m;
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB290-RIGHT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    ////右类型排风腔KCJSB265
                    //if (item.RightBeamType == "KCJSB265")
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB265-RIGHT");
                    //    swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //    swPart.Parameter("D1@Sketch55").SystemValue = (rightSBDis + 1m) / 1000m;
                    //    if (item.LKSide == "RIGHT" || item.LKSide == "BOTH")
                    //    {
                    //        swFeat = swComp.FeatureByName("LKS270-RIGHT");
                    //        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //        swPart.Parameter("D24@Sketch53").SystemValue = (rightSBDis + 265m + 1m) / 1000m;
                    //        if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                    //        {
                    //            swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                    //            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //            swPart.Parameter("D4@Sketch50").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //            swPart.Parameter("D5@Sketch50").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //            swPart.Parameter("D7@Sketch50").SystemValue = (rightSBDis + 270m + 265m + 1m) / 1000m;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                    //        {
                    //            swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                    //            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                    //            swPart.Parameter("D4@Sketch50").SystemValue = (item.GutterWidth - 2m) / 1000m;
                    //            swPart.Parameter("D5@Sketch50").SystemValue = (item.GutterWidth - 62m) / 1000m;
                    //            swPart.Parameter("D7@Sketch50").SystemValue = (rightSBDis + 265m + 1m) / 1000m;
                    //        }
                    //    }
                    //}
                    //else
                    //{
                    //    swFeat = swComp.FeatureByName("KCJSB265-RIGHT");
                    //    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    //}
                    //右类型排风腔KCWSB265
                    if (item.RightBeamType == "KCWSB265")
                    {
                        swFeat = swComp.FeatureByName("KCWSB265-RIGHT");
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swPart.Parameter("D15@Sketch47").SystemValue = (rightSBDis + 1m) / 1000m;
                        if (item.LKSide == "RIGHT" || item.LKSide == "BOTH")
                        {
                            swFeat = swComp.FeatureByName("LKS270-RIGHT");
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D24@Sketch54").SystemValue = (rightSBDis + 265m + 1m) / 1000m;
                            if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                            {
                                swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                                swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                                swPart.Parameter("D4@Sketch55").SystemValue = (item.GutterWidth - 2m) / 1000m;
                                swPart.Parameter("D5@Sketch55").SystemValue = (item.GutterWidth - 62m) / 1000m;
                                swPart.Parameter("D7@Sketch55").SystemValue = (rightSBDis + 270m + 265m + 1m) / 1000m;
                            }
                        }
                        else
                        {
                            if (item.GutterSide == "RIGHT" || item.GutterSide == "BOTH")
                            {
                                swFeat = swComp.FeatureByName("GUTTER-RIGHT");
                                swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                                swPart.Parameter("D4@Sketch55").SystemValue = (item.GutterWidth - 2m) / 1000m;
                                swPart.Parameter("D5@Sketch55").SystemValue = (item.GutterWidth - 62m) / 1000m;
                                swPart.Parameter("D7@Sketch55").SystemValue = (rightSBDis + 265m + 1m) / 1000m;
                            }
                        }
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("KCWSB265-RIGHT");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                }
                swModel.ForceRebuild3(true);    //设置成true,直接更新顶层,速度很快,设置成false,每个零件都会更新,很慢
                swModel.Save();                 //保存,很耗时间
                swApp.CloseDoc(packedAssyPath); //关闭,很快
            }
            catch (Exception ex)
            {
                throw new Exception(packedAssyPath + "作图过程发生异常,详细:" + ex.Message);
            }
            finally
            {
                swApp.CommandInProgress = false; //及时关闭外部命令调用,否则影响SolidWorks的使用
            }
        }
Example #5
0
        private void btnEditData_Click(object sender, EventArgs e)
        {
            #region 数据验证
            //必填项目
            if (pbModelImage.Tag.ToString().Length == 0)
            {
                return;
            }
            if (!DataValidate.IsDecimal(txtLength.Text.Trim()) || Convert.ToDecimal(txtLength.Text.Trim()) < 90m)
            {
                MessageBox.Show("请认真检查DPCJ腔长度", "提示信息");
                txtLength.Focus();
                txtLength.SelectAll();
                return;
            }
            if (cobSidePanel.SelectedIndex == -1)
            {
                MessageBox.Show("请选择DPCJ腔侧板", "提示信息");
                cobSidePanel.Focus();
                return;
            }
            if (cobSuType.SelectedIndex == -1)
            {
                MessageBox.Show("请选择CJ脖颈朝向", "提示信息");
                cobSuType.Focus();
                return;
            }
            if (!DataValidate.IsDecimal(txtSuDis.Text.Trim()) || Convert.ToDecimal(txtSuDis.Text.Trim()) < 90m)
            {
                MessageBox.Show("请认真检查CJ脖颈距离右边距离", "提示信息");
                txtSuDis.Focus();
                txtSuDis.SelectAll();
                return;
            }
            if (cobOutlet.SelectedIndex == -1)
            {
                MessageBox.Show("请选择排水口位置,没有请选择NO", "提示信息");
                cobOutlet.Focus();
                return;
            }
            if (cobBackCJSide.SelectedIndex == -1)
            {
                MessageBox.Show("请选择BCJ位置,如果没有请选择NO", "提示信息");
                cobBackCJSide.Focus();
                return;
            }
            if (cobDPSide.SelectedIndex == -1)
            {
                MessageBox.Show("请选择DP位置,如果没有请选择NO", "提示信息");
                cobDPSide.Focus();
                return;
            }
            if (cobLeftBeamType.SelectedIndex == -1)
            {
                MessageBox.Show("请选择左排风腔类型,如果没有请选择NO", "提示信息");
                cobBackCJSide.Focus();
                return;
            }
            if (cobRightBeamType.SelectedIndex == -1)
            {
                MessageBox.Show("请选择右排风腔类型,如果没有请选择NO", "提示信息");
                cobBackCJSide.Focus();
                return;
            }
            if (cobLKSide.SelectedIndex == -1)
            {
                MessageBox.Show("请选择LK270位置", "提示信息");
                cobLKSide.Focus();
                return;
            }

            if (cobGutterSide.SelectedIndex == -1)
            {
                MessageBox.Show("请选择ANSUL腔的位置", "提示信息");
                cobGutterSide.Focus();
                return;
            }
            if (cobGutterSide.SelectedIndex != 2)
            {
                if (!DataValidate.IsDecimal(txtGutterWidth.Text.Trim()) || Convert.ToDecimal(txtGutterWidth.Text.Trim()) < 30m)
                {
                    MessageBox.Show("请认真检查ANSUL腔的宽度", "提示信息");
                    txtGutterWidth.Focus();
                    txtGutterWidth.SelectAll();
                    return;
                }
            }
            #endregion
            //封装对象
            DPCJ330 objDPCJ330 = new DPCJ330()
            {
                DPCJ330Id     = Convert.ToInt32(pbModelImage.Tag),
                SidePanel     = cobSidePanel.Text,
                SuType        = cobSuType.Text,
                Outlet        = cobOutlet.Text,
                BackCJSide    = cobBackCJSide.Text,
                DPSide        = cobDPSide.Text,
                LeftBeamType  = cobLeftBeamType.Text,
                RightBeamType = cobRightBeamType.Text,
                LKSide        = cobLKSide.Text,
                GutterSide    = cobGutterSide.Text,

                Length       = Convert.ToDecimal(txtLength.Text.Trim()),
                SuDis        = Convert.ToDecimal(txtSuDis.Text.Trim()),
                LeftDis      = Convert.ToDecimal(txtLeftDis.Text.Trim()),
                RightDis     = Convert.ToDecimal(txtRightDis.Text.Trim()),
                LeftBeamDis  = Convert.ToDecimal(txtLeftBeamDis.Text.Trim()),
                RightBeamDis = Convert.ToDecimal(txtRightBeamDis.Text.Trim()),
                GutterWidth  = Convert.ToDecimal(txtGutterWidth.Text.Trim())
            };
            //提交修改
            try
            {
                if (objDPCJ330Service.EditModel(objDPCJ330) == 1)
                {
                    MessageBox.Show("制图数据修改成功", "提示信息");
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }