protected override void AddAnalysisToXMLOutput(CAD.AssemblyType cadassembly) { base.AddAnalysisToXMLOutput(cadassembly); CAD.AnalysesType cadanalysis = GetCADAnalysis(cadassembly); CAD.BlastType blastanalysis = new CAD.BlastType(); blastanalysis._id = UtilityHelpers.MakeUdmID(); blastanalysis.AnalysisID = blastConfig.analysis.ID; if (referencePlaneType != Survivability.ReferencePlaneTypeEnum.None) { CAD.ReferencePlaneType refplane = new CAD.ReferencePlaneType(); refplane._id = UtilityHelpers.MakeUdmID(); refplane.Type = referencePlaneType.ToString(); blastanalysis.ReferencePlane = new CAD.ReferencePlaneType[1]; // cardinality should be changed to have 0..1 in CAD_Uml.xme blastanalysis.ReferencePlane[0] = refplane; } List <CAD.MetricType> metrics = MetricsToCADXMLOutput(Computations, cadassembly.ConfigurationID); if (metrics.Count > 0) { blastanalysis.Metrics = new CAD.MetricsType(); blastanalysis.Metrics._id = UtilityHelpers.MakeUdmID(); blastanalysis.Metrics.Metric = metrics.ToArray(); } if (blastanalysis.ReferencePlane != null || blastanalysis.Metrics != null) { cadanalysis.Blast = new CAD.BlastType[] { blastanalysis }; } }
protected override void AddAnalysisToXMLOutput(CAD.AssemblyType cadassembly) { base.AddAnalysisToXMLOutput(cadassembly); CAD.AnalysesType cadanalysis = GetCADAnalysis(cadassembly); CAD.BallisticType ballisticanalysis = new CAD.BallisticType(); ballisticanalysis._id = UtilityHelpers.MakeUdmID(); ballisticanalysis.AnalysisID = AnalysisID; if (referencePlaneType != Survivability.ReferencePlaneTypeEnum.None) { CAD.ReferencePlaneType refplane = new CAD.ReferencePlaneType(); refplane._id = UtilityHelpers.MakeUdmID(); refplane.Type = referencePlaneType.ToString(); ballisticanalysis.ReferencePlane = refplane; } if (customShotlineList.Any()) { CAD.ShotlinesType cadshotlinesuite = new CAD.ShotlinesType(); cadshotlinesuite._id = UtilityHelpers.MakeUdmID(); List <CAD.ShotlineType> shotlineList = new List <CAD.ShotlineType>(); foreach (var shotline in customShotlineList) { CAD.ShotlineType cadshotline = new CAD.ShotlineType(); cadshotline._id = UtilityHelpers.MakeUdmID(); cadshotline.Azimuth = shotline.Azimuth; cadshotline.Elevation = shotline.Elevation; cadshotline.BallisticThreatRef = shotline.BallisticThreatRef; cadshotline.ComponentID = shotline.ComponentID; cadshotline.DatumPoint = shotline.DatumPoint; cadshotline.ShotlineName = shotline.ShotlineName; shotlineList.Add(cadshotline); } cadshotlinesuite.Shotline = shotlineList.ToArray(); ballisticanalysis.Shotlines = cadshotlinesuite; } List <CAD.MetricType> metrics = MetricsToCADXMLOutput(Computations, cadassembly.ConfigurationID); if (metrics.Count > 0) { ballisticanalysis.Metrics = new CAD.MetricsType(); ballisticanalysis.Metrics._id = UtilityHelpers.MakeUdmID(); ballisticanalysis.Metrics.Metric = metrics.ToArray(); } if (ballisticanalysis.Metrics != null || ballisticanalysis.ReferencePlane != null || ballisticanalysis.Shotlines != null) { cadanalysis.Ballistic = new CAD.BallisticType[] { ballisticanalysis }; } }
protected virtual void AddAnalysisToXMLOutput(CAD.AssemblyType assembly) { // R.O. 1/26/2015, InterferenceCheck deprecated. Now interference check is specified by adding a InterferenceCount to // a CADComputationComponent //if (InterferenceCheck) //{ // CAD.AnalysesType cadanalysis = GetCADAnalysis(assembly); // CAD.InterferenceType intfanalysis = new CAD.InterferenceType(); // intfanalysis._id = UtilityHelpers.MakeUdmID(); // intfanalysis.AnalysisID = AnalysisID; // cadanalysis.Interference = new CAD.InterferenceType[] { intfanalysis }; //} }
public CAD.AssembliesType ToCADXMLOutput(TestBenchModel.TestBenchBase tb, bool metalink = false) { CAD.AssembliesType outputAssembliesType = new CAD.AssembliesType(); outputAssembliesType.VersionInfo = ""; List <CAD.AssemblyType> asmlist = new List <CAD.AssemblyType>(); foreach (var item in assemblies.Values) { CAD.AssemblyType assembly = item.ToCADXMLOutput(tb); asmlist.Add(assembly); pointCoordinatesList.AddRange(item.PointCoordinatesList); } if (asmlist.Count > 1 && metalink) { Logger.Instance.AddLogMessage("There's more than one unconnected assembly in the model. Meta-Link may not work with this model.", Severity.Warning); } if (orphans.Any()) { if (metalink) { CAD.AssemblyType topAssembly = asmlist.First(); List <CAD.CADComponentType> cadcomponentlist = topAssembly.CADComponent.CADComponent.ToList(); foreach (var orphan in orphans) { cadcomponentlist.Add(orphan.ToCADXMLOutput(tb.GetRepresentation(orphan))); } topAssembly.CADComponent.CADComponent = cadcomponentlist.ToArray(); } else { List <CAD.CADComponentType> orphanlist = new List <CAD.CADComponentType>(); CAD.UnassembledComponentsType orphancomponentParent = new CAD.UnassembledComponentsType(); orphancomponentParent._id = UtilityHelpers.MakeUdmID(); foreach (var orphan in orphans) { orphanlist.Add(orphan.ToCADXMLOutput(tb.GetRepresentation(orphan))); } orphancomponentParent.CADComponent = orphanlist.ToArray(); outputAssembliesType.UnassembledComponents = orphancomponentParent; } } outputAssembliesType.Assembly = asmlist.ToArray(); return(outputAssembliesType); }
protected CAD.AnalysesType GetCADAnalysis(CAD.AssemblyType assembly) { CAD.AnalysesType analysis; if (assembly.Analyses == null) { analysis = new CAD.AnalysesType() { _id = UtilityHelpers.MakeUdmID() }; assembly.Analyses = analysis; } else { analysis = assembly.Analyses; } return(analysis); }
protected void AddStaticAnalysisMetrics(CAD.AssemblyType assemblyRoot) { if (ExportComponentPoints && cadDataContainer.PointCoordinatesList.Any()) { StaticAnalysisMetrics.AddRange(cadDataContainer.PointCoordinatesList.Where(x => !StaticAnalysisMetrics.Exists(r => r.MetricID == x.MetricID))); } if (StaticAnalysisMetrics.Any()) { CAD.AnalysesType cadanalysis = GetCADAnalysis(assemblyRoot); CAD.StaticType staticanalysis = GetStaticAnalysis(cadanalysis); //CAD.StaticType staticanalysis = new CAD.StaticType(); List <CAD.MetricType> metriclist = MetricsToCADXMLOutput(StaticAnalysisMetrics); staticanalysis.Metrics = new CAD.MetricsType(); staticanalysis.Metrics._id = UtilityHelpers.MakeUdmID(); staticanalysis.Metrics.Metric = metriclist.ToArray(); cadanalysis.Static = new CAD.StaticType[] { staticanalysis }; } }
protected override void AddAnalysisToXMLOutput(CAD.AssemblyType cadassembly) { base.AddAnalysisToXMLOutput(cadassembly); CAD.AnalysesType cadanalysis = GetCADAnalysis(cadassembly); CAD.CFDType cfdanalysis = new CAD.CFDType(); cfdanalysis._id = UtilityHelpers.MakeUdmID(); cfdanalysis.AnalysisID = AnalysisID; List <CAD.MetricType> metrics = MetricsToCADXMLOutput(Computations, cadassembly.ConfigurationID); if (metrics.Count > 0) { cfdanalysis.Metrics = new CAD.MetricsType(); cfdanalysis.Metrics._id = UtilityHelpers.MakeUdmID(); cfdanalysis.Metrics.Metric = metrics.ToArray(); } // Hydrostatics solver setting will go to the CadAssembly.xml as it is interpreted by CadCreateAssembly.exe foreach (var config in cfdConfigs.Where(cfg => cfg is CFDConfig.HydrostaticsSolverSettings)) { CFDConfig.HydrostaticsSolverSettings hconfig = config as CFDConfig.HydrostaticsSolverSettings; cfdanalysis.HydrostaticsSolverSettings = new CAD.HydrostaticsSolverSettingsType[1]; cfdanalysis.HydrostaticsSolverSettings[0] = new CAD.HydrostaticsSolverSettingsType() { VehicleVelocity = 1, FluidMaterial = hconfig.FluidMaterial.ToString(), FluidTemperature = hconfig.FluidTemperature, PitchAngleStart = hconfig.PitchAngleStart, PitchAngleEnd = hconfig.PitchAngleEnd, PitchAngleStepSize = hconfig.PitchAngleStep, RollAngleStart = hconfig.RollAngleStart, RollAngleEnd = hconfig.RollAngleEnd, RollAngleStepSize = hconfig.RollAngleStep }; } cadanalysis.CFD = new CAD.CFDType[] { cfdanalysis }; AddStaticAnalysisMetrics(cadassembly); }
public CAD.AssemblyType ToCADXMLOutput(TestBenchModel.TestBenchBase tb) { CAD.AssemblyType cadassemblyoutput = new CAD.AssemblyType(); cadassemblyoutput._id = UtilityHelpers.MakeUdmID(); cadassemblyoutput.ConfigurationID = ConfigID; CAD.CADComponentType cadassemblycomponentoutput = new CAD.CADComponentType(); cadassemblycomponentoutput._id = UtilityHelpers.MakeUdmID(); cadassemblycomponentoutput.ComponentID = ConfigID; cadassemblycomponentoutput.Type = "ASSEMBLY"; cadassemblycomponentoutput.Standalone = false; cadassemblycomponentoutput.SpecialInstruction = ""; cadassemblycomponentoutput.Name = this.Name; cadassemblycomponentoutput.DisplayName = DisplayName; cadassemblycomponentoutput.MaterialID = ""; cadassemblycomponentoutput.Representation = ""; cadassemblycomponentoutput.Classification = ""; Dictionary<string, List<CAD.ConstraintType>> compidToConstraint = new Dictionary<string, List<CAD.ConstraintType>>(); // Dictionary<Id, List<Constraints>> var sortedEdges = ChildEdges.OrderBy(x => x.DstPortName).ToList(); foreach (CADEdge edge in sortedEdges) //foreach (CADEdge edge in ChildEdges) { CAD.ConstraintType constraintout = edge.ToCADXMLOutput(tb); if (!compidToConstraint.ContainsKey(edge.Dst.Id)) { compidToConstraint.Add(edge.Dst.Id, new List<CAD.ConstraintType>()); } compidToConstraint[edge.Dst.Id].Add(constraintout); } var sortedS2FEdges = ChildSize2FitEdges.OrderBy(x => x.DstPortName).ToList(); foreach (CADEdge edge in sortedS2FEdges) //foreach (CADEdge edge in ChildSize2FitEdges) { CAD.ConstraintType constraintout = edge.ToCADXMLOutput(tb); if (!compidToConstraint.ContainsKey(edge.Dst.Id)) { compidToConstraint.Add(edge.Dst.Id, new List<CAD.ConstraintType>()); } compidToConstraint[edge.Dst.Id].Add(constraintout); } // META-2885 //Dictionary<string, CAD.CADComponentType> tmpComponents = new Dictionary<string, CAD.CADComponentType>(); List<CAD.CADComponentType> tmpComponents = new List<CAD.CADComponentType>(); var sortedComponents = ChildComponents.OrderBy(x => x.Value.Name).ToDictionary(x => x.Key, x => x.Value).Values.ToList(); foreach (CADComponent component in sortedComponents) //foreach (CADComponent component in ChildComponents.Values) { CAD.CADComponentType componentout = component.ToCADXMLOutput(tb.GetRepresentation(component)); // root constraint if (component.Id == RootComponentID) { bool rootIsAsmType = component.ModelType == "Assembly"; //bool rootIsAsmType = component.ModelType == "PART"; List<CAD.PairType> pairlist = new List<CAD.PairType>(); CAD.ConstraintType rootconstraintout = new CAD.ConstraintType(); rootconstraintout._id = UtilityHelpers.MakeUdmID(); // front pair pairlist.Add(MakeRootConstraint("FRONT", component.DisplayID, ConfigID, rootIsAsmType)); // top pair pairlist.Add(MakeRootConstraint("TOP", component.DisplayID, ConfigID, rootIsAsmType)); // right pair pairlist.Add(MakeRootConstraint("RIGHT", component.DisplayID, ConfigID, rootIsAsmType)); rootconstraintout.Pair = pairlist.ToArray(); componentout.Constraint = new CAD.ConstraintType[1]; componentout.Constraint[0] = rootconstraintout; } else { if (compidToConstraint.ContainsKey(component.Id)) { componentout.Constraint = compidToConstraint[component.Id].ToArray(); } } //tmpComponents[component.Id] = componentout; tmpComponents.Add(componentout); } var size2fitCompSorted = ChildSize2FitComponents.OrderBy(x => x.Value.Name).ToDictionary(x => x.Key, x => x.Value).Values.ToList(); foreach (CADComponent component in size2fitCompSorted)//foreach (CADComponent component in ChildSize2FitComponents.Values) // META-2885 { CAD.CADComponentType componentout = component.ToCADXMLOutput(tb.GetRepresentation(component)); if (compidToConstraint.ContainsKey(component.Id)) { componentout.Constraint = compidToConstraint[component.Id].ToArray(); } //tmpComponents[component.Id] = componentout; tmpComponents.Add(componentout); } // Fill MetaLinkData. Only needed in case if data is prepared for Meta-Link communication if (MetaLinkData != null && MetaLinkData.Components.Count>0) { cadassemblyoutput.MetaLinkData = new CAD.MetaLinkDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData = new CAD.CadComponentMLDataType[MetaLinkData.Components.Count]; int i = 0; foreach (MetaLinkData.Component comp in MetaLinkData.Components) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i] = new CAD.CadComponentMLDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ID = comp.ID; cadassemblyoutput.MetaLinkData.CadComponentMLData[i].AvmID = comp.AvmID; if (comp.Connectors.Count>0) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData = new CAD.ConnectorMLDataType[comp.Connectors.Count]; int j = 0; foreach (MetaLinkData.Connector conn in comp.Connectors) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j] = new CAD.ConnectorMLDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].ID = conn.ID; cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DisplayName = conn.DisplayName; if (conn.Datums.Count > 0) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData = new CAD.DatumMLDataType[conn.Datums.Count]; int k = 0; foreach (MetaLinkData.Datum d in conn.Datums) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData[k] = new CAD.DatumMLDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData[k].ID = d.ID; cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData[k].DisplayName = d.DisplayName; k++; } } j++; } } i++; } } cadassemblycomponentoutput.CADComponent = tmpComponents.ToArray(); //cadassemblycomponentoutput.CADComponent = tmpComponents.Values.ToArray(); cadassemblyoutput.CADComponent = cadassemblycomponentoutput; CAD.PropertiesType asmproperties = new CAD.PropertiesType(); asmproperties._id = UtilityHelpers.MakeUdmID(); CAD.UnitsType asmunit = new CAD.UnitsType(); asmunit._id = UtilityHelpers.MakeUdmID(); asmunit.Value = "value1"; asmproperties.Units = asmunit; cadassemblyoutput.Properties = asmproperties; return cadassemblyoutput; }
public CAD.AssemblyType ToCADXMLOutput(TestBenchModel.TestBenchBase tb) { CAD.AssemblyType cadassemblyoutput = new CAD.AssemblyType(); cadassemblyoutput._id = UtilityHelpers.MakeUdmID(); cadassemblyoutput.ConfigurationID = ConfigID; CAD.CADComponentType cadassemblycomponentoutput = new CAD.CADComponentType(); cadassemblycomponentoutput._id = UtilityHelpers.MakeUdmID(); cadassemblycomponentoutput.ComponentID = ConfigID; cadassemblycomponentoutput.Type = "ASSEMBLY"; cadassemblycomponentoutput.Standalone = false; cadassemblycomponentoutput.SpecialInstruction = ""; cadassemblycomponentoutput.Name = this.Name; cadassemblycomponentoutput.DisplayName = DisplayName; cadassemblycomponentoutput.MaterialID = ""; cadassemblycomponentoutput.Representation = ""; cadassemblycomponentoutput.Classification = ""; Dictionary <string, List <CAD.ConstraintType> > compidToConstraint = new Dictionary <string, List <CAD.ConstraintType> >(); // Dictionary<Id, List<Constraints>> var sortedEdges = ChildEdges.OrderBy(x => x.DstPortName).ToList(); foreach (CADEdge edge in sortedEdges) //foreach (CADEdge edge in ChildEdges) { CAD.ConstraintType constraintout = edge.ToCADXMLOutput(tb); if (!compidToConstraint.ContainsKey(edge.Dst.Id)) { compidToConstraint.Add(edge.Dst.Id, new List <CAD.ConstraintType>()); } compidToConstraint[edge.Dst.Id].Add(constraintout); } var sortedS2FEdges = ChildSize2FitEdges.OrderBy(x => x.DstPortName).ToList(); foreach (CADEdge edge in sortedS2FEdges) //foreach (CADEdge edge in ChildSize2FitEdges) { CAD.ConstraintType constraintout = edge.ToCADXMLOutput(tb); if (!compidToConstraint.ContainsKey(edge.Dst.Id)) { compidToConstraint.Add(edge.Dst.Id, new List <CAD.ConstraintType>()); } compidToConstraint[edge.Dst.Id].Add(constraintout); } // META-2885 //Dictionary<string, CAD.CADComponentType> tmpComponents = new Dictionary<string, CAD.CADComponentType>(); List <CAD.CADComponentType> tmpComponents = new List <CAD.CADComponentType>(); var sortedComponents = ChildComponents.OrderBy(x => x.Value.Name).ToDictionary(x => x.Key, x => x.Value).Values.ToList(); foreach (CADComponent component in sortedComponents) //foreach (CADComponent component in ChildComponents.Values) { CAD.CADComponentType componentout = component.ToCADXMLOutput(tb.GetRepresentation(component)); // root constraint if (component.Id == RootComponentID) { bool rootIsAsmType = component.ModelType == "Assembly"; //bool rootIsAsmType = component.ModelType == "PART"; List <CAD.PairType> pairlist = new List <CAD.PairType>(); CAD.ConstraintType rootconstraintout = new CAD.ConstraintType(); rootconstraintout._id = UtilityHelpers.MakeUdmID(); // front pair pairlist.Add(MakeRootConstraint("FRONT", component.DisplayID, ConfigID, rootIsAsmType, component.SpecialDatums.Where(d => d.DatumName == "FRONT").FirstOrDefault())); // top pair pairlist.Add(MakeRootConstraint("TOP", component.DisplayID, ConfigID, rootIsAsmType, component.SpecialDatums.Where(d => d.DatumName == "TOP").FirstOrDefault())); // right pair pairlist.Add(MakeRootConstraint("RIGHT", component.DisplayID, ConfigID, rootIsAsmType, component.SpecialDatums.Where(d => d.DatumName == "RIGHT").FirstOrDefault())); rootconstraintout.Pair = pairlist.ToArray(); componentout.Constraint = new CAD.ConstraintType[1]; componentout.Constraint[0] = rootconstraintout; } else { if (compidToConstraint.ContainsKey(component.Id)) { componentout.Constraint = compidToConstraint[component.Id].ToArray(); } } //tmpComponents[component.Id] = componentout; tmpComponents.Add(componentout); // 3/7/2016 - Export_All_Component_Points at TB level pointCoordinatesList.AddRange(component.PointCoordinatesList); } var size2fitCompSorted = ChildSize2FitComponents.OrderBy(x => x.Value.Name).ToDictionary(x => x.Key, x => x.Value).Values.ToList(); foreach (CADComponent component in size2fitCompSorted)//foreach (CADComponent component in ChildSize2FitComponents.Values) // META-2885 { CAD.CADComponentType componentout = component.ToCADXMLOutput(tb.GetRepresentation(component)); if (compidToConstraint.ContainsKey(component.Id)) { componentout.Constraint = compidToConstraint[component.Id].ToArray(); } //tmpComponents[component.Id] = componentout; tmpComponents.Add(componentout); // 3/7/2016 - Export_All_Component_Points at TB level pointCoordinatesList.AddRange(component.PointCoordinatesList); } // Fill MetaLinkData. Only needed in case if data is prepared for Meta-Link communication if (MetaLinkData != null && MetaLinkData.Components.Count > 0) { cadassemblyoutput.MetaLinkData = new CAD.MetaLinkDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData = new CAD.CadComponentMLDataType[MetaLinkData.Components.Count]; int i = 0; foreach (MetaLinkData.Component comp in MetaLinkData.Components) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i] = new CAD.CadComponentMLDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ID = comp.ID; cadassemblyoutput.MetaLinkData.CadComponentMLData[i].AvmID = comp.AvmID; if (comp.Connectors.Count > 0) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData = new CAD.ConnectorMLDataType[comp.Connectors.Count]; int j = 0; foreach (MetaLinkData.Connector conn in comp.Connectors) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j] = new CAD.ConnectorMLDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].ID = conn.ID; cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DisplayName = conn.DisplayName; if (conn.Datums.Count > 0) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData = new CAD.DatumMLDataType[conn.Datums.Count]; int k = 0; foreach (MetaLinkData.Datum d in conn.Datums) { cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData[k] = new CAD.DatumMLDataType(); cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData[k].ID = d.ID; cadassemblyoutput.MetaLinkData.CadComponentMLData[i].ConnectorMLData[j].DatumMLData[k].DisplayName = d.DisplayName; k++; } } j++; } } i++; } } cadassemblycomponentoutput.CADComponent = tmpComponents.ToArray(); //cadassemblycomponentoutput.CADComponent = tmpComponents.Values.ToArray(); cadassemblyoutput.CADComponent = cadassemblycomponentoutput; CAD.PropertiesType asmproperties = new CAD.PropertiesType(); asmproperties._id = UtilityHelpers.MakeUdmID(); CAD.UnitsType asmunit = new CAD.UnitsType(); asmunit._id = UtilityHelpers.MakeUdmID(); asmunit.Value = "value1"; asmproperties.Units = asmunit; cadassemblyoutput.Properties = asmproperties; return(cadassemblyoutput); }