예제 #1
0
        /// <summary>
        /// 初始化函数;
        /// </summary>
        protected void Init()
        {
            if (mViewBase == null)
            {
                return;
            }
            //初始化视图的包围盒;
            CDimTools.GetInstance().InitViewBox();

            //获取所有螺钉的数据字典;
            Dictionary <Identifier, TSD.Bolt> dicIdentifierBolt = CDimTools.GetInstance().GetAllBoltInDrawing(mViewBase);

            //获取所有Drawing视图中的Part;
            List <TSD.Part> partList = CDimTools.GetInstance().GetAllPartInDrawing(mViewBase);

            foreach (TSD.Part partInDrawing in partList)
            {
                //1.获取部件的信息;
                TSM.ModelObject modelObjectInModel = CDimTools.GetInstance().TransformDrawingToModel(partInDrawing);
                TSM.Part        partInModel        = modelObjectInModel as TSM.Part;
                CMrPart         mrPart             = null;
                if (CMrMainBeam.GetInstance().mPartInModel.Identifier.GUID == partInModel.Identifier.GUID)
                {
                    mrPart    = CMrMainBeam.GetInstance();
                    mMainBeam = CMrMainBeam.GetInstance();
                    mMainBeam.mPartInDrawing = partInDrawing;
                    CDimTools.GetInstance().InitMrPart(modelObjectInModel, mViewBase, mrPart);
                    mrPart.UpdatePartBoxPoint();
                    AppendMrPart(mrPart);
                }
                else
                {
                    mrPart = new CMrPart(partInModel, partInDrawing);
                    CDimTools.GetInstance().InitMrPart(modelObjectInModel, mViewBase, mrPart);
                    mrPart.UpdatePartBoxPoint();
                    AppendMrPart(mrPart);
                }

                //2.获取部件中的所有螺钉组;
                List <BoltArray> boltArrayList = CDimTools.GetInstance().GetAllBoltArray(partInModel);
                foreach (BoltArray boltArray in boltArrayList)
                {
                    TSD.Bolt     boltInDrawing = dicIdentifierBolt[boltArray.Identifier];
                    CMrBoltArray mrBoltArray   = new CMrBoltArray(boltArray, boltInDrawing);
                    CDimTools.GetInstance().InitMrBoltArray(boltArray, mViewBase, mrBoltArray);
                    mrPart.AppendMrBoltArray(mrBoltArray);
                }
                CDimTools.GetInstance().UpdateViewBox(mrPart);
            }
            //清空零件标记管理器中的零件标记;
            CMrMarkManager.GetInstance().Clear();

            //构建门式框架主梁的拓扑结构;
            CMrBeamDoorManager.GetInstance().BuildBeamDoorTopo(mMrPartList);
        }