Пример #1
0
 private ComponentInfo.Get_Body GetParamBody(IBody7 body)
 {
     ComponentInfo.Get_Body _Body = new ComponentInfo.Get_Body();
     _Body.Naim = body.Name;
     _Body.Oboz = body.Marking;
     return(_Body);
 }
Пример #2
0
        private void getBodyResoure(IPart7 Part, ComponentInfo componentInfo, TreeListNode node)
        {
            IFeature7 feature = (IFeature7)Part;
            var       RB      = feature.ResultBodies;

            if (RB == null)
            {
                return;
            }
            try
            {
                foreach (IBody7 _body in RB)
                {
                    try
                    {
                        ComponentInfo componentInfo_Copy = Add_BodyInfo_In_Component(Part, _body, componentInfo);

                        TreeListNode TempNode;
                        TempNode     = AddNode(node, componentInfo_Copy, true);
                        TempNode.Tag = componentInfo_Copy;
                    }
                    catch { }
                }
            }
            catch
            {
                IBody7        _body = (IBody7)RB;
                ComponentInfo componentInfo_Copy = Add_BodyInfo_In_Component(Part, _body, componentInfo);

                TreeListNode TempNode;
                TempNode     = AddNode(node, componentInfo_Copy, true);
                TempNode.Tag = componentInfo_Copy;
            }
        }
Пример #3
0
        private ComponentInfo Add_BodyInfo_In_Component(IPart7 Part, IBody7 _body, ComponentInfo componentInfo)
        {
            ComponentInfo componentInfo_Copy = (ComponentInfo)componentInfo.Clone();

            componentInfo_Copy.Body = GetParamBody(_body);
            double kolvo = Convert.ToDouble(GetPropertyBodyIPart7(Part, _body, "Количество"));

            if (kolvo == 0)
            {
                componentInfo_Copy.Body.QNT       = 1;
                componentInfo_Copy.Body.QNT_False = true;
            }
            else
            {
                componentInfo_Copy.Body.QNT       = kolvo;
                componentInfo_Copy.Body.QNT_False = false;
            }
            componentInfo_Copy.Key = Part.FileName + "|" + Part.Marking + "|" + _body.Marking;
            Dictionary <string, string> ParamValueList = new Dictionary <string, string>();

            foreach (string ParamName in FindParam_Model)
            {
                string ParamValue = null;
                ParamValue = OptionsFold.tools_class.FixInvalidChars_St(GetPropertyBodyIPart7(Part, _body, ParamName), "");
                if (Split_Naim && ParamName == "Наименование")
                {
                    ParamValue = OptionsFold.tools_class.SplitString(ParamValue);
                }
                ParamValueList.Add(ParamName, ParamValue);
            }
            componentInfo_Copy.Body.ParamValueList = ParamValueList;
            return(componentInfo_Copy);
        }
Пример #4
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());
        }