Beispiel #1
0
        /// <summary>
        /// 设置表达式值
        /// </summary>
        /// <param name="equMgr"></param>
        /// <param name="name"></param>
        /// <param name="equation">表达式</param>
        /// <returns></returns>
        /// <remarks>
        /// 全局变量表达式: "B" = 2
        /// 组件表达式:     "N_SPOKES@CirPattern1" = "BARLENGTH@Sketch2" /10
        /// 尺寸表达式       "D1@Extrude2" = (("D1@Extrude3">20, 15, 6))+5
        /// </remarks>
        public static bool SetEqu(this EquationMgr equMgr, string name, string equation)
        {
            int Index = equMgr.GetAllEqu().
                        Where(p => p.Equation.Split('=')?.FirstOrDefault()?.Replace("\"", "").Trim() == name)
                        .Select(p => p.Index).FirstOrDefault();

            equMgr.Equation[Index] = equation;
            if (equMgr.Equation[Index] != equation)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }