コード例 #1
0
ファイル: CamExporter.cs プロジェクト: mh-soft/mh-master
        // 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));
        }
コード例 #2
0
ファイル: CamExporter.cs プロジェクト: mh-soft/mh-master
        // 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);
        }