/// <summary> /// 获取左侧檩托板的标注集; /// </summary> /// <param name="nFlag">1:左侧;2:右侧</param> /// <returns></returns> private List <CMrDimSet> GetMrApronPlateDimSet(int nFlag) { List <CMrDimSet> mrDimSetList = new List <CMrDimSet>(); Dictionary <CMrPart, CMrApronPlate> mMapPartToApronPlate = CMrCylinderDoorTopManager.GetInstance().mMapYNormalPartToMrApronPlate; //如果是右侧; if (nFlag == 2) { foreach (CMrApronPlate mrApronPlate in mMapPartToApronPlate.Values) { CMrPart yNormalPart = mrApronPlate.mYNormalPart; double minX = yNormalPart.GetMinXPoint().X; if (minX < 0) { continue; } CMrDimSet mrDimSet = new CMrDimSet(); bool bIsUp = mrApronPlate.mIsUp; if (bIsUp) { mrDimSet.AddPoint(yNormalPart.GetMaxXMinYPoint()); } else { mrDimSet.AddPoint(yNormalPart.GetMaxXMaxYPoint()); } mrDimSetList.Add(mrDimSet); } } //如果是左侧; else if (nFlag == 1) { foreach (CMrApronPlate mrApronPlate in mMapPartToApronPlate.Values) { CMrPart yNormalPart = mrApronPlate.mYNormalPart; double maxX = yNormalPart.GetMaxXPoint().X; if (maxX > 0) { continue; } CMrDimSet mrDimSet = new CMrDimSet(); bool bIsUp = mrApronPlate.mIsUp; if (bIsUp) { mrDimSet.AddPoint(yNormalPart.GetMinXMinYPoint()); } else { mrDimSet.AddPoint(yNormalPart.GetMinXMaxYPoint()); } mrDimSetList.Add(mrDimSet); } } return(mrDimSetList); }
/// <summary> /// 绘制檩托板的零件标记; /// </summary> private void DrawMrApronPlateMark() { DrawingHandler drawingHandler = new DrawingHandler(); TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector(); Dictionary <CMrPart, CMrApronPlate> mapPartToMrApronPlate = CMrCylinderDoorTopManager.GetInstance().mMapYNormalPartToMrApronPlate; foreach (CMrApronPlate mrApronPlate in mapPartToMrApronPlate.Values) { CMrPart yNormalPart = mrApronPlate.mYNormalPart; CMrPart zNormalPart = mrApronPlate.mZNormalPart; DS.SelectObject(yNormalPart.mPartInDrawing); DS.SelectObject(zNormalPart.mPartInDrawing); } CDimTools.GetInstance().DrawMarkByMacro(); }
/// <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); AppendMrPart(mrPart); } else { mrPart = new CMrPart(partInModel, partInDrawing); CDimTools.GetInstance().InitMrPart(modelObjectInModel, mViewBase, mrPart); 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); UpdateMinAndMaxYPart(mrPart); } //移除主柱子; mMrPartList.Remove(mMainBeam); //清空零件标记管理器中的零件标记; CMrMarkManager.GetInstance().Clear(); //构建门式框架结构柱标注顶视图的拓扑; CMrCylinderDoorTopManager.GetInstance().BuildCylinderDoorTopTopo(mMrPartList); }