// 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)); }
/// <summary> /// 执行数据的导出 /// </summary> /// <param name="message"></param> /// <param name="assemblies"></param> /// <param name="options"></param> /// <param name="projectData"></param> /// <param name="bExit"></param> /// <returns></returns> public static CmdResult executePXML(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 { bExit = false; Document document = assemblies.First <AssemblyInstance>().Document; ItTransactionManager.Instance.reset(document); using (ItTransaction itTransaction = ItTransactionManager.Instance.start(document, "export CNC data", null)) { try { ItCreatePXML itCreatePXML = new ItCreatePXML(assemblies, options); itCreatePXML.run(projectData); bExit = itCreatePXML.UserCanceled; itTransaction.commit(); } catch (Exception ex) { message = ex.Message; ItLogging.print("Exception in ItCmdCreateMaschData"); ItLogging.printException(ex); itTransaction.rollback("Exception"); return(CmdResult.Failed); } } result = CmdResult.Succeeded; } return(result); }
// 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); }
// 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); }