Пример #1
0
        public static bool GetValueProperty(IPart7 part, IProperty Property, out object returnObject)
        {
            bool res = false;

            returnObject = null;
            if (Property != null)
            {
                IPropertyKeeper Prop = (IPropertyKeeper)part;

                if (Prop != null)
                {
                    bool Baseunit, FromSource;
                    Baseunit = false;
                    _Property classresProperty = (_Property)Property;
                    if (classresProperty != null)
                    {
                        Prop.GetPropertyValue((_Property)classresProperty, out returnObject, Baseunit, out FromSource);
                        if (returnObject != null)
                        {
                            res = true;
                        }
                    }
                }
            }
            return(res);
        }
Пример #2
0
        public string GetPropertyBodyIPart7(IPart7 part_, IBody7 Body, string PropertyName)
        {
            object            res = "";
            IKompasDocument3D _IKompasDocument3D = (IKompasDocument3D)GetIKompasDocument(part_.FileName, false, false);

            if (_IApplication != null)
            {
                IPropertyMng _IPropertyMng = (IPropertyMng)_IApplication;
                if (_IPropertyMng != null)
                {
                    bool Baseunit, FromSource;
                    Baseunit = false;
                    IPropertyKeeper propertyKeeper = (IPropertyKeeper)Body;
                    if (propertyKeeper != null)
                    {
                        IProperty Property = _IPropertyMng.GetProperty(_IKompasDocument3D, PropertyName);
                        if (Property != null)
                        {
                            propertyKeeper.GetPropertyValue((_Property)Property, out res, Baseunit, out FromSource);
                        }
                    }
                }
            }
            if (res != null)
            {
                if (res.GetType().Name == "Double")
                {
                    res = Math.Round(Convert.ToDouble(res), 3);
                }
            }
            else
            {
                return(null);
            }
            return(res.ToString());
        }