예제 #1
0
        public void FastPut()
        {
            ProcessNum     = 0;
            ProcessMaximun = ElementPropList.Count;
            //MessageBoxService.ShowMessage($"The Number of ElementPropList is {ElementPropList.Count}", "Element number test");
            BCOM.Application app = PDIWT_MS.Program.COM_App;
            BCOM.Point3d     scale = app.Point3dOne();
            BCOM.Matrix3d    bmatrix3dx, bmatrix3dy, bmatrix3dz, bmatrix3dall;
            string           cellName;

            BCOM.Point3d origin;
            foreach (var ele in ElementPropList)
            {
                cellName = string.Empty;
                foreach (var cn in CellNameList)
                {
                    if (cn.Id == ele.CellNameType)
                    {
                        cellName = cn.Name;
                        break;
                    }
                }
                origin       = app.Point3dFromXYZ(ele.X, ele.Y, ele.Z);
                bmatrix3dx   = app.Matrix3dFromAxisAndRotationAngle(0, app.Radians(ele.AngelX));
                bmatrix3dy   = app.Matrix3dFromAxisAndRotationAngle(1, app.Radians(ele.AngelY));
                bmatrix3dz   = app.Matrix3dFromAxisAndRotationAngle(2, app.Radians(ele.AngelZ));
                bmatrix3dall = app.Matrix3dFromMatrix3dTimesMatrix3dTimesMatrix3d(ref bmatrix3dx, ref bmatrix3dy, ref bmatrix3dz);
                if (!string.IsNullOrEmpty(cellName))
                {
                    BCOM.Element element = app.CreateSharedCellElement2(cellName, ref origin, ref scale, true, ref bmatrix3dall);
                    app.ActiveModelReference.AddElement(element);
                }
                ProcessNum++;
                Bentley.UI.Threading.DispatcherHelper.DoEvents();
            }
            MessageBoxService.ShowMessage($"所列单元创建完毕,共{ElementPropList.Count}个。", "创建完成", MessageButton.OK, MessageIcon.Information);
        }