/// <summary> /// 初始化; /// </summary> protected void Init() { if (mViewBase == null) { return; } CDimTools dimTools = CDimTools.GetInstance(); //初始化视图包围盒; dimTools.InitViewBox(); //获取所有螺钉的数据字典; Dictionary <Identifier, TSD.Bolt> dicIdentifierBolt = dimTools.GetAllBoltInDrawing(mViewBase); //获取所有Drawing视图中的Part; List <TSD.Part> partList = dimTools.GetAllPartInDrawing(mViewBase); foreach (TSD.Part partInDrawing in partList) { //1.获取部件的信息; TSM.ModelObject modelObjectInModel = dimTools.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; } else { mrPart = new CMrPart(partInModel, partInDrawing); } dimTools.InitMrPart(modelObjectInModel, mViewBase, mrPart); AppendMrPart(mrPart); InitMrPart(mrPart); mrPart.GetBeamTopViewInfo().InitMrPartTopViewInfo(); //2.获取部件中的所有螺钉组; List <BoltArray> boltArrayList = dimTools.GetAllBoltArray(partInModel); foreach (BoltArray boltArray in boltArrayList) { TSD.Bolt boltInDrawing = dicIdentifierBolt[boltArray.Identifier]; CMrBoltArray mrBoltArray = new CMrBoltArray(boltArray, boltInDrawing); dimTools.InitMrBoltArray(boltArray, mViewBase, mrBoltArray); InitMrBoltArray(mrBoltArray); mrPart.AppendMrBoltArray(mrBoltArray); } dimTools.UpdateViewBox(mrPart); } CMrMarkManager.GetInstance().Clear(); }
/// <summary> /// 初始化; /// </summary> protected void Init() { if (mViewBase == null) { return; } CDimTools dimTools = CDimTools.GetInstance(); //初始化视图包围盒; dimTools.InitViewBox(); //获取所有螺钉的数据字典; Dictionary <Identifier, TSD.Bolt> dicIdentifierBolt = dimTools.GetAllBoltInDrawing(mViewBase); //获取所有Drawing视图中的Part; List <TSD.Part> partList = dimTools.GetAllPartInDrawing(mViewBase); foreach (TSD.Part partInDrawing in partList) { //1.获取部件的信息; TSM.ModelObject modelObjectInModel = dimTools.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; } else { mrPart = new CMrPart(partInModel, partInDrawing); } dimTools.InitMrPart(modelObjectInModel, mViewBase, mrPart); AppendMrPart(mrPart); mrPart.GetCylinderTopViewInfo().InitCylinderTopViewInfo(); InitMrPart(mrPart); //第一次遍历时就把所有的垂直加筋板保存起来,后面需要使用; if (CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, new Vector(1, 0, 0))) { mVerticalConnectPlateList.Add(mrPart); } //2.获取部件中的所有螺钉组; List <BoltArray> boltArrayList = dimTools.GetAllBoltArray(partInModel); foreach (BoltArray boltArray in boltArrayList) { TSD.Bolt boltInDrawing = dicIdentifierBolt[boltArray.Identifier]; CMrBoltArray mrBoltArray = new CMrBoltArray(boltArray, boltInDrawing); dimTools.InitMrBoltArray(boltArray, mViewBase, mrBoltArray); mrPart.AppendMrBoltArray(mrBoltArray); } dimTools.UpdateViewBox(mrPart); } InitCylinderGridLine(); //构建剪切板的拓扑结构; CMrClipPlateManager.GetInstance().BuildMrClipPlate(mMrPartList, MrViewType.CylinderTopView); //清空标记管理器中的数据; CMrMarkManager.GetInstance().Clear(); }
/// <summary> /// 初始化函数; /// </summary> protected void Init() { if (mViewBase == null) { return; } CDimTools dimTools = CDimTools.GetInstance(); //初始化视图的包围盒; dimTools.InitViewBox(); Point viewMinPoint = mViewBase.RestrictionBox.MinPoint; Point viewMaxPoint = mViewBase.RestrictionBox.MaxPoint; //获取所有螺钉的数据字典; Dictionary <Identifier, TSD.Bolt> dicIdentifierBolt = dimTools.GetAllBoltInDrawing(mViewBase); //获取所有Drawing视图中的Part; List <TSD.Part> partList = dimTools.GetAllPartInDrawing(mViewBase); foreach (TSD.Part partInDrawing in partList) { //1.获取部件的信息; TSM.ModelObject modelObjectInModel = dimTools.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; } else { mrPart = new CMrPart(partInModel, partInDrawing); } dimTools.InitMrPart(modelObjectInModel, mViewBase, mrPart); List <Point> pointList = mrPart.GetPointList(); int nCount = pointList.Count; Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); pointList.Sort(sorterX); Point minXPoint = pointList[0]; Point maxXPoint = pointList[nCount - 1]; if (minXPoint.X > viewMaxPoint.X || maxXPoint.X < viewMinPoint.X) { continue; } Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); pointList.Sort(sorterY); Point minYPoint = pointList[0]; Point maxYPoint = pointList[nCount - 1]; if (minYPoint.Y > viewMaxPoint.Y || maxYPoint.Y < viewMinPoint.Y) { continue; } Comparison <Point> sorterZ = new Comparison <Point>(CDimTools.ComparePointZ); pointList.Sort(sorterZ); Point minZPoint = pointList[0]; Point maxZPoint = pointList[nCount - 1]; if (minZPoint.Z > viewMaxPoint.Z || maxZPoint.Z < viewMinPoint.Z) { continue; } dimTools.UpdateViewBox(mrPart); AppendMrPart(mrPart); //2.获取部件中的所有螺钉组; List <BoltArray> boltArrayList = dimTools.GetAllBoltArray(partInModel); foreach (BoltArray boltArray in boltArrayList) { TSD.Bolt boltInDrawing = dicIdentifierBolt[boltArray.Identifier]; CMrBoltArray mrBoltArray = new CMrBoltArray(boltArray, boltInDrawing); dimTools.InitMrBoltArray(boltArray, mViewBase, mrBoltArray); mrPart.AppendMrBoltArray(mrBoltArray); } } CMrMarkManager.GetInstance().Clear(); }