Example #1
0
        // Token: 0x060000EA RID: 234 RVA: 0x000092AC File Offset: 0x000074AC
        protected override MountingPartData getDoorWindowData(RevitElement <FamilyInstance> familyInstance, RevitElement <Part> part)
        {
            ItGeBoundBlock3d   localExtents  = familyInstance.Element.getLocalExtents();
            ItGeVector3d       viewDirection = base.getViewDirection();
            ItGeMatrix3d       ecsToWcs      = familyInstance.Element.ecs();
            bool               flag;
            List <ItGePoint3d> contourFromElement = ItMachineDataBase.getContourFromElement(familyInstance.To <Element>(), part, ecsToWcs, viewDirection, out flag);
            bool               flag2 = contourFromElement.none <ItGePoint3d>() || contourFromElement.Count < 3;
            MountingPartData   result;

            if (flag2)
            {
                ItFailures.PostFailure(ItFailures.CAMObjectWithoutValidGeometry, familyInstance.Id);
                result = null;
            }
            else
            {
                contourFromElement.transformBy(base.MatWcsToPalette);
                localExtents.transformBy(base.MatWcsToPalette);
                MountingPartData mountingPartData = new MountingPartData
                {
                    ElementId = familyInstance.Id,
                    Contour   = contourFromElement,
                    Height    = localExtents.maxPoint.z - localExtents.minPoint.z,
                    IsOpeningWithoutGeometry = !flag,
                    Type = MountingPartData.Types.DoorWindow,
                    InstallationHeight = localExtents.minPoint.z,
                    Name     = familyInstance.Element.Name,
                    UniqueId = familyInstance.UniqueId
                };
                result = mountingPartData;
            }
            return(result);
        }
Example #2
0
        // Token: 0x06000048 RID: 72 RVA: 0x0000407C File Offset: 0x0000227C
        public static ItMachineDataBase getCNCDocCreator(AssemblyInstance assemblyInstance, ICamExportIntOptions options)
        {
            ItMachineDataBase itMachineDataBase = null;
            ProductType       productType       = assemblyInstance.productType();
            bool flag = ProductType.WallSD == productType;

            if (flag)
            {
                itMachineDataBase = new ItMachineDataWallSD(options);
            }
            bool flag2 = ProductType.WallSW == productType;

            if (flag2)
            {
                itMachineDataBase = new ItMachineDataWallSW(options);
            }
            bool flag3 = ProductType.WallDB == productType;

            if (flag3)
            {
                itMachineDataBase = new ItMachineDataWallDB(options);
            }
            bool flag4 = ProductType.SlabHC == productType;

            if (flag4)
            {
                itMachineDataBase = new ItMachineDataSlabHC(options);
            }
            bool flag5 = ProductType.SlabSD == productType;

            if (flag5)
            {
                itMachineDataBase = new ItMachineDataSlabSD(options);
            }
            bool flag6 = ProductType.SlabGD == productType;

            if (flag6)
            {
                itMachineDataBase = new ItMachineDataSlabGD(options);
            }
            bool flag7 = itMachineDataBase == null;

            if (flag7)
            {
                ItFailures.PostFailure(ItFailures.CAMManualCreatedAssemblyNotSupported, assemblyInstance.Id);
            }
            return(itMachineDataBase);
        }
Example #3
0
        // Token: 0x06000004 RID: 4 RVA: 0x00002228 File Offset: 0x00000428
        private static string ExportReinforcementToPXML(AssemblyInstance assembly, ICollection <ExportReinfData> exportedElements, Func <Element, bool> filter)
        {
            ICamExportIntOptions options       = new CamExporter.CamExportOptionsOnlyFileFormat(FileFormat.PXML13);
            ItMachineDataBase    cncdocCreator = ItCNCDataFactory.getCNCDocCreator(assembly, options);

            cncdocCreator.InitializeFromAssembly(assembly);
            ItGeMatrix3d matWcsToPalette = cncdocCreator.MatWcsToPalette;
            ILookup <SteelGroup, SteelGroupElement> steelGroups;

            using (ItTransaction itTransaction = ItTransactionManager.Instance.start(assembly.Document, "RevitPrecast Internal Transaction", null))
            {
                ReinfSorter reinfSorter = new ReinfSorter(assembly, new ItMachineDataBase.CNCElementData(), matWcsToPalette, filter);
                reinfSorter.SortElements();
                steelGroups = reinfSorter.GetSteelGroups();
                itTransaction.rollback("Planned rollback.");
            }
            IEnumerable <ItSteel> collection = from steelGroup in steelGroups
                                               select steelGroup.Key.ToPXML(exportedElements);

            ItSlab itSlab = new ItSlab();

            itSlab.steelList.AddRange(collection);
            XmlRootAttribute root = new XmlRootAttribute("Slab")
            {
                Namespace = "http://progress-m.com/ProgressXML/Version1"
            };
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ItSlab), root);
            StringWriter  stringWriter  = new StringWriter();
            XmlWriter     xmlWriter     = XmlWriter.Create(stringWriter, new XmlWriterSettings
            {
                Indent             = false,
                OmitXmlDeclaration = true,
                NewLineHandling    = NewLineHandling.None
            });

            xmlSerializer.Serialize(xmlWriter, itSlab, ItDocument.StaticNamespaces);
            string text = stringWriter.ToString();

            text = text.Replace("</Slab>", string.Empty);
            int startIndex = text.IndexOf("<Steel ", StringComparison.Ordinal);

            return(text.Substring(startIndex));
        }
Example #4
0
        // Token: 0x06000426 RID: 1062 RVA: 0x00012BFC File Offset: 0x00010DFC
        public void Initialize(ItMachineDataBase machineDataBase, AssemblyInstance assemblyInstance, IEnumerable <RevitElement <Part> > partsList, ItGeMatrix3d matTranslateToOrigin, ItGePoint3d startPoint, ItGeVector3d spanDirection, ItGeVector3d shiftingDirection, Parameter paramProdNo)
        {
            double totalThickness = partsList.isNotNull() ? partsList.Sum((RevitElement <Part> part) => machineDataBase.getThickness(part.getLocalExtents(false))) : -1.0;

            startPoint.transformBy(matTranslateToOrigin);
            ItGeBoundBlock3d   buildingExtents    = machineDataBase.getBuildingExtents(assemblyInstance.Document);
            ProjectCoordinates projectCoordinates = new ProjectCoordinates();
            ItGeMatrix3d       mat                = assemblyInstance.ecs();
            ItGeVector3d       spanDirection2     = mat * spanDirection;
            ItGeVector3d       shiftingDirection2 = mat * shiftingDirection;
            ItGePoint3d        startPoint2        = mat * startPoint;

            machineDataBase.setProjectCoordinates(projectCoordinates, startPoint2, buildingExtents, spanDirection2, shiftingDirection2);
            this.ProductType        = machineDataBase.ProductTypeString;
            this.ElementNo          = paramProdNo.AsString();
            this.TotalThickness     = totalThickness;
            this.PieceCount         = assemblyInstance.assemblyType().instances().Count;
            this.ProjectCoordinates = projectCoordinates;
            this.IsInitialized      = true;
        }
Example #5
0
        // Token: 0x06000005 RID: 5 RVA: 0x000023A8 File Offset: 0x000005A8
        private static string ExportReinforcementToUnitechnik(AssemblyInstance assembly, FileFormat fileFormat, ICollection <ExportReinfData> exportedElements, Func <Element, bool> filter)
        {
            ICamExportIntOptions options       = new CamExporter.CamExportOptionsOnlyFileFormat(fileFormat);
            ItMachineDataBase    cncdocCreator = ItCNCDataFactory.getCNCDocCreator(assembly, options);

            cncdocCreator.InitializeFromAssembly(assembly);
            ItGeMatrix3d matWcsToPalette = cncdocCreator.MatWcsToPalette;

            ItMachineDataBase.CNCElementData        cncelementData = new ItMachineDataBase.CNCElementData();
            ILookup <SteelGroup, SteelGroupElement> steelGroups;

            using (ItTransaction itTransaction = ItTransactionManager.Instance.start(assembly.Document, "RevitPrecast Internal Transaction", null))
            {
                ReinfSorter reinfSorter = new ReinfSorter(assembly, cncelementData, matWcsToPalette, filter);
                reinfSorter.SortElements();
                steelGroups = reinfSorter.GetSteelGroups();
                itTransaction.rollback("Planned rollback.");
            }
            short iVersion = (fileFormat == FileFormat.Unitechnik52) ? (short)502 : (short)600;

            ItUniWrapperImpl.StartDocument(1, 1, ProjectCoordinates.Empty, iVersion, "", 1.0, true);
            ItUniWrapperImpl.AddLayer(0, 1.0, 1.0, 1.0, "x");
            foreach (IGrouping <SteelGroup, SteelGroupElement> grouping in steelGroups)
            {
                grouping.Key.WriteUnitechnik(exportedElements);
            }
            ItMachineDataBase.UnitechnikWriteMountingPartData(cncelementData);
            ItMachineDataBase.UnitechnikWriteBRGirdersData(cncelementData);
            string fullReinforcementString = ItUniWrapperImpl.GetFullReinforcementString();
            bool   flag = fullReinforcementString.Contains("ERROR");

            if (flag)
            {
                throw new CamExportException(fullReinforcementString);
            }
            return(fullReinforcementString);
        }
Example #6
0
        // Token: 0x060000F0 RID: 240 RVA: 0x000094A4 File Offset: 0x000076A4
        protected override bool IsConnectionFamily(FamilyInstance famInst)
        {
            ItConnectionElementData o = ItMachineDataBase.LoadOrParentLoad <ItConnectionElementData>(famInst, ItBase.guid);

            return(o.isNotNull());
        }
Example #7
0
        /// <summary>
        /// 执行导出操作
        /// </summary>
        /// <param name="projectData"></param>
        public void run(CNCProjectData projectData)
        {
            XmlRootAttribute root = new XmlRootAttribute("PXML_Document")
            {
                Namespace = "http://progress-m.com/ProgressXML/Version1"
            };

            XmlSerializer     serializer = new XmlSerializer(typeof(ItDocument), root);
            List <ItDocument> list       = new List <ItDocument>();
            ItDocument        itDocument = null;

            this._options.TargetDirectory.Create();

            //读取所有的部件
            foreach (AssemblyInstance assemblyInstance in this._assemblies)
            {
                ProductType productType = assemblyInstance.productType();


                bool flag = productType == ProductType.None;
                if (flag)
                {
                    ItFailures.PostFailure(ItFailures.CAMManualCreatedAssemblyNotSupported, assemblyInstance.Id);
                }
                else
                {
                    bool flag2 = this.IsAlreadyWritten(assemblyInstance, list);
                    if (!flag2)
                    {
                        string fileName = ItCreatePXML.GetFileName(assemblyInstance, projectData, this._options, itDocument);
                        bool   flag3;
                        CamIntEvents.OnExportingAssembly(this._rvtDoc, assemblyInstance.Id, this._options, productType, fileName, out flag3);
                        bool flag4 = flag3;
                        if (flag4)
                        {
                            CamIntEvents.OnExportedAssembly(this._rvtDoc, assemblyInstance.Id, this._options, productType, fileName, CamIntExportStatus.EventCanceled);
                        }
                        else
                        {
                            bool flag5 = !this._options.MultipleElementsInOneFile || itDocument == null;
                            if (flag5)
                            {
                                bool userCanceled;
                                itDocument        = ItCreatePXML.GetDocument(projectData, assemblyInstance, this._options, fileName, out userCanceled);
                                this.UserCanceled = userCanceled;
                                bool userCanceled2 = this.UserCanceled;
                                if (userCanceled2)
                                {
                                    CamIntEvents.OnExportedAssembly(this._rvtDoc, assemblyInstance.Id, this._options, productType, fileName, CamIntExportStatus.UserCanceled);
                                    return;
                                }
                                bool flag6 = itDocument == null;
                                if (flag6)
                                {
                                    CamIntEvents.OnExportedAssembly(this._rvtDoc, assemblyInstance.Id, this._options, productType, fileName, CamIntExportStatus.Skipped);
                                    bool multipleElementsInOneFile = this._options.MultipleElementsInOneFile;
                                    if (multipleElementsInOneFile)
                                    {
                                        return;
                                    }
                                    continue;
                                }
                                else
                                {
                                    list.Add(itDocument);
                                    ItOrder        item   = ItCreatePXML.CreateOrderInstance(this._rvtDoc, projectData);
                                    List <ItOrder> orders = itDocument.Orders;
                                    if (orders != null)
                                    {
                                        orders.Add(item);
                                    }
                                }
                            }
                            this.AddProduct(itDocument);
                            ItMachineDataBase   cncdocCreator   = ItCNCDataFactory.getCNCDocCreator(assemblyInstance, this._options);
                            RevitElement <Part> partOfShellType = assemblyInstance.getPartOfShellType(ShellType.FirstShell);
                            itDocument.IsValid = cncdocCreator.CreateMachineDataPxml(assemblyInstance, partOfShellType, itDocument, projectData);
                            CamIntExportStatus status = CamIntExportStatus.None;
                            bool flag7 = !this._options.MultipleElementsInOneFile;
                            if (flag7)
                            {
                                string text;
                                bool   flag8 = this.WriteFile(itDocument, serializer, out text);
                                bool   flag9 = flag8;
                                if (flag9)
                                {
                                    int num = this.Successes;
                                    this.Successes = num + 1;
                                    status         = CamIntExportStatus.Success;
                                }
                                else
                                {
                                    int num = this.Failures;
                                    this.Failures = num + 1;
                                    status        = CamIntExportStatus.Failed;
                                }
                            }
                            CamIntEvents.OnExportedAssembly(this._rvtDoc, assemblyInstance.Id, this._options, productType, fileName, status);
                        }
                    }
                }
            }
            bool flag10 = this._options.MultipleElementsInOneFile && itDocument != null;

            if (flag10)
            {
                string             fileName2;
                bool               flag11 = this.WriteFile(itDocument, serializer, out fileName2);
                bool               flag12 = flag11;
                CamIntExportStatus status2;
                if (flag12)
                {
                    int num = this.Successes;
                    this.Successes = num + 1;
                    status2        = CamIntExportStatus.Success;
                }
                else
                {
                    int num = this.Failures;
                    this.Failures = num + 1;
                    status2       = CamIntExportStatus.Failed;
                }
                CamIntEvents.OnExportedAssembly(this._rvtDoc, ElementId.InvalidElementId, this._options, ProductType.None, fileName2, status2);
            }
        }
Example #8
0
        // Token: 0x06000009 RID: 9 RVA: 0x000025D4 File Offset: 0x000007D4
        public static CmdResult executeUniCAM(ref string message, IEnumerable <AssemblyInstance> assemblies, ICamExportIntOptions options, CNCProjectData projectData, out bool bExit)
        {
            assemblies = assemblies.ToList <AssemblyInstance>();
            bool      flag = assemblies.none <AssemblyInstance>();
            CmdResult result;

            if (flag)
            {
                bExit  = true;
                result = CmdResult.Failed;
            }
            else
            {
                Document document = assemblies.First <AssemblyInstance>().Document;
                bExit = false;
                bool flag2 = projectData == null;
                if (flag2)
                {
                    ItFailures.PostFailure(ItFailures.CAMMissingProjectData, ElementId.InvalidElementId);
                }
                ItTransactionManager.Instance.reset(document);
                using (ItTransaction itTransaction = ItTransactionManager.Instance.start(document, CamExporter._lclExportCNCTransaction, null))
                {
                    try
                    {
                        int val  = 0;
                        int val2 = 0;
                        foreach (AssemblyInstance assemblyInstance in assemblies)
                        {
                            Parameter parameter = assemblyInstance.getParameter(ItGlobals.PRODNUMBERPARAM, true, true);
                            bool      flag3     = parameter.isNull();
                            if (!flag3)
                            {
                                bool hasValue = parameter.HasValue;
                                if (hasValue)
                                {
                                    RevitElement <Part> part = assemblyInstance.getPart(null);
                                    bool flag4 = part == null;
                                    if (!flag4)
                                    {
                                        Element mainElement = part.getMainElement();
                                        int     val3;
                                        int.TryParse(parameter.AsString(), out val3);
                                        bool flag5 = mainElement is Wall;
                                        if (flag5)
                                        {
                                            val = Math.Max(val, val3);
                                        }
                                        else
                                        {
                                            bool flag6 = mainElement is Floor;
                                            if (flag6)
                                            {
                                                val2 = Math.Max(val2, val3);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        options.TargetDirectory.Create();
                        DirectoryInfo targetDirectory = options.TargetDirectory;
                        foreach (AssemblyInstance assemblyInstance2 in assemblies)
                        {
                            try
                            {
                                Parameter parameter2 = assemblyInstance2.getParameter(ItGlobals.PRODNUMBERPARAM, true, true);
                                bool      flag7      = parameter2 == null;
                                if (!flag7)
                                {
                                    RevitElement <Part> part2 = assemblyInstance2.getPart(null);
                                    bool flag8 = part2 == null;
                                    if (!flag8)
                                    {
                                        Element     mainElement2 = part2.getMainElement();
                                        ProductType product      = part2.productType();
                                        bool        subdirectoryPerProductType = options.SubdirectoryPerProductType;
                                        if (subdirectoryPerProductType)
                                        {
                                            options.TargetDirectory = targetDirectory.CreateSubdirectory(product.ToString());
                                        }
                                        ItMachineDataBase cncdocCreator = ItCNCDataFactory.getCNCDocCreator(assemblyInstance2, options);
                                        bool flag9 = cncdocCreator.isNull();
                                        if (!flag9)
                                        {
                                            bool flag10 = mainElement2 is Wall;
                                            if (flag10)
                                            {
                                                CamExporter.FixProdNumber(parameter2, ref val);
                                            }
                                            else
                                            {
                                                bool flag11 = mainElement2 is Floor;
                                                if (flag11)
                                                {
                                                    CamExporter.FixProdNumber(parameter2, ref val2);
                                                }
                                            }
                                            int    iProdNo            = Convert.ToInt32(parameter2.AsString());
                                            string unitechnikFilename = ItMachineDataBase.GetUnitechnikFilename(assemblyInstance2, options, projectData);
                                            bool   flag12;
                                            CamIntEvents.OnExportingAssembly(document, assemblyInstance2.Id, options, product, unitechnikFilename, out flag12);
                                            bool flag13 = flag12;
                                            if (!flag13)
                                            {
                                                bool flag14  = CamExporter.CheckUnitechnikFilename(options, unitechnikFilename, out bExit);
                                                bool success = false;
                                                bool flag15  = flag14 && !bExit;
                                                if (flag15)
                                                {
                                                    success = cncdocCreator.createMachineDataUnitechnik(assemblyInstance2, iProdNo, projectData, unitechnikFilename);
                                                }
                                                CamIntExportStatus status = CamExporter.DetermineStatus(success, bExit, flag14);
                                                CamIntEvents.OnExportedAssembly(document, assemblyInstance2.Id, options, product, unitechnikFilename, status);
                                                bool flag16 = bExit;
                                                if (flag16)
                                                {
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            catch (SplitByOpeningNotSupportedException ex)
                            {
                                ItFailures.PostFailure(ItFailures.SplitByOpeningNotSupported, ex.ElementId);
                            }
                        }
                        itTransaction.commit();
                    }
                    catch (Exception ex2)
                    {
                        message = ex2.Message;
                        ItLogging.print("Exception in ItCmdCreateMaschData");
                        ItLogging.printException(ex2);
                        itTransaction.rollback("Exception");
                        return(CmdResult.Failed);
                    }
                }
                result = (bExit ? CmdResult.Cancelled : CmdResult.Succeeded);
            }
            return(result);
        }