예제 #1
0
        /// <summary>
        /// Set a global variable if the name exists allready. If it doesn't
        /// then nothing happens and the function returns false;
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="eq"></param>
        /// <returns></returns>
        public static bool SetGlobal(this IModelDoc2 doc, SwEq eq)
        {
            var existing = doc.GetGlobal(eq.Id);

            return(existing.Match
                       (kv =>
            {
                SetGlobal(doc, kv.Key, eq);
                return true;
            }, () => false));
        }
예제 #2
0
 protected bool Equals(SwEq other)
 {
     return string.Equals(Id, other.Id) && Val.Equals(other.Val) && UnitsType == other.UnitsType && string.Equals(SolidWorksUnits, other.SolidWorksUnits);
 }
예제 #3
0
        /// <summary>
        /// Set a global variable at position i in the globals table
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="i"></param>
        /// <param name="eq"></param>
        private static void SetGlobal(this IModelDoc2 doc, int i, SwEq eq)
        {
            var swEqnMgr = doc.GetEquationMgr();

            swEqnMgr.Equation[i] = eq.ToString();
        }
예제 #4
0
 protected bool Equals(SwEq other)
 {
     return(string.Equals(Id, other.Id) && Val.Equals(other.Val) && UnitsType == other.UnitsType && string.Equals(SolidWorksUnits, other.SolidWorksUnits));
 }