Пример #1
0
        ///<summary> method <c>GetDrawingDocBOMTable</c>
        ///从SolidWorks 的Drawing文档获取到其材料明细表,一般一个文档一个,多余不获取
        ///</summary>
        public void GetDrawingDocBOMTable(ModelDoc2 modelDoc, out BomTableAnnotation swBOMTable, out string configName, out string topFileName)
        {
            Feature feature = modelDoc.IFirstFeature();

            swBOMTable  = null;
            configName  = "";
            topFileName = "";
            BomFeature swBomFeat = null;

            while (feature != null)
            {
                Type type = feature.GetType();
                if ("BomFeat" == feature.GetTypeName())
                {
                    //Console.WriteLine("******************************");
                    //Console.WriteLine("Feature Name : " + feature.Name);

                    swBomFeat = (BomFeature)feature.GetSpecificFeature2();
                    break;
                }

                string name = feature.Name;
                feature = feature.IGetNextFeature();
            }
            if (swBomFeat == null || swBomFeat.GetTableAnnotationCount() <= 0)
            {
                return;
            }
            Feature swFeat      = (Feature)swBomFeat.GetFeature();
            string  featureName = swFeat.Name;

            swBOMTable  = swBomFeat.IGetTableAnnotations(1);// default(TableAnnotation);
            topFileName = swBomFeat.GetReferencedModelName();
            int configCount = swBomFeat.GetConfigurationCount(true);

            //
            //object[] vTableArr = (object[])swBomFeat.GetTableAnnotations();
            //foreach (object vTable_loopVariable in vTableArr)
            //{
            //    object vTable = vTable_loopVariable;
            //    TableAnnotation swTable = (TableAnnotation)vTable;
            //    ProcessTableAnn(modelDoc, swTable);
            //}

            configName = "";
            if (configCount > 0)
            {
                bool visibility = true;
                configName = swBomFeat.IGetConfigurations(true, 0, ref visibility);
            }
            //swBOMTable.Iget
            return;
        }
Пример #2
0
        ///<summary> method <c>GetDrawingDocBOMTable</c>
        ///从SolidWorks 的Drawing文档获取到其材料明细表,一般一个文档一个,多余不获取
        ///</summary>
        public void GetDrawingDocBOMTable(ModelDoc2 modelDoc, out BomTableAnnotation swBOMTable, out string configName, out string topFileName)
        {
            Feature feature = modelDoc.IFirstFeature();

            swBOMTable = null;
            configName = "";
            BomFeature swBomFeat = null;

            while (feature != null)
            {
                Type type = feature.GetType();
                if ("BomFeat" == feature.GetTypeName())
                {
                    Console.WriteLine("******************************");
                    Console.WriteLine("Feature Name : " + feature.Name);

                    swBomFeat = (BomFeature)feature.GetSpecificFeature2();
                    break;
                }

                string name = feature.Name;
                feature = feature.IGetNextFeature();
            }
            if (swBomFeat == null || swBomFeat.GetTableAnnotationCount() <= 0)
            {
                return;
            }
            swBOMTable  = swBomFeat.IGetTableAnnotations(1);// default(TableAnnotation);
            topFileName = swBomFeat.GetReferencedModelName();
            configName  = "";
            if (configCount > 0)
            {
                bool visibility = true;
                configName = swBomFeat.IGetConfigurations(true, 0, ref visibility);
            }
            //swBOMTable.Iget
            return;
        }