private ComponentInfo GetParam(ksPart part) { ksMassInertiaParam massInertiaParam = (ksMassInertiaParam)part.CalcMassInertiaProperties((uint)ksLengthUnitsEnum.ksLUnMM); IPropertyMng propertyManager = part as IPropertyMng; //string oboz = propertyManager.GetProperty(kompasDocument, 4); //обозначение //string SSect = propertyManager.GetProperty(kompasDocument, 20); //раздел спецификации ComponentInfo iMSH = new ComponentInfo(); iMSH._MCH.Area = massInertiaParam.F; iMSH._MCH.Mass = massInertiaParam.m; iMSH._MCH.Volume = massInertiaParam.v; iMSH._MCH.Xc = massInertiaParam.xc; iMSH._MCH.Yc = massInertiaParam.yc; iMSH._MCH.Zc = massInertiaParam.zc; iMSH.FFN = part.fileName; iMSH.material = part.material; iMSH.Oboz = part.marking; iMSH.Naim = part.name; iMSH.Mass = part.GetMass(); iMSH.isDetal = part.IsDetail(); iMSH.standardComponent = part.standardComponent; iMSH.QNT = 1; iMSH.Key = part.fileName + "|" + part.marking; return(iMSH); }
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)); }
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()); }