예제 #1
0
        public string GetPropertyIPart7(IPart7 part_, string PropertyName)
        {
            IKompasDocument3D _IKompasDocument3D = (IKompasDocument3D)GetIKompasDocument(part_.FileName, false, false);

            if (_IApplication != null)
            {
                IPropertyMng _IPropertyMng = (IPropertyMng)_IApplication;
                if (_IPropertyMng != null)
                {
                    int count = _IPropertyMng.PropertyCount[_IKompasDocument3D];
                    for (int i = 0; i < count; i++)
                    {
                        IProperty Property = _IPropertyMng.GetProperty(_IKompasDocument3D, i);

                        if (PropertyName == Property.Name)
                        {
                            object returnObject;
                            if (GetValueProperty(part_, Property, out returnObject))
                            {
                                if (returnObject.GetType().Name == "Double")
                                {
                                    returnObject = Math.Round(Convert.ToDouble(returnObject), 3);
                                }
                                if (!string.IsNullOrEmpty(returnObject.ToString()))
                                {
                                    return(returnObject.ToString());
                                }
                            }
                            break;
                        }
                    }
                }
            }
            return(GetVaribleValByName(part_, PropertyName));
        }
예제 #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());
        }