Example #1
0
        //判断是否为多实体零件或钣金件
        private bool isMutiBodyOrSheetMetal(ref bool isBlank, ref bool isSM, ref bool isSolidBody, ref string strError)
        {
            if (m_ModelDoc != null)
            {
                PartDoc swPartDoc = (PartDoc)m_ModelDoc;
                if (swPartDoc != null)
                {
                    object[] vBodies = (object[])swPartDoc.GetBodies2((int)swBodyType_e.swAllBodies, false);
                    if (vBodies == null)
                    {
                        strError = "空白图纸";
                        isBlank  = true;
                        return(false);
                    }
                    if (vBodies.Length > 1)
                    {
                        return(true);
                    }
                    else if (vBodies.Length == 1)
                    {
                        Body2 body = (Body2)vBodies[0];
                        isSM = body.IsSheetMetal();

                        //识别文件类型体
                        isSolidBody = false;
                        switch (body.GetType())
                        {
                        case (int)swBodyType_e.swSolidBody:
                            strError    = "实体文件";
                            isSolidBody = true;
                            break;

                        case (int)swBodyType_e.swSheetBody:
                            strError = "板体文件";
                            break;

                        case (int)swBodyType_e.swEmptyBody:
                            strError = "空白体文件";
                            break;

                        case (int)swBodyType_e.swGeneralBody:
                            strError = "一般,非流形体文件";
                            break;

                        case (int)swBodyType_e.swMinimumBody:
                            strError = "点体文件";
                            break;

                        case (int)swBodyType_e.swWireBody:
                            strError = "线体文件";
                            break;
                        }
                    }
                }
            }

            return(false);
        }