public FrameEnvelopeReactionResult GetFrameReactions(string GroupName, string ComboName, ModelUnits ModelUnits) { //FrameForceExtractor ext = new FrameForceExtractor(model); //FrameEnvelopeReactionResult res = ext.GetFrameReactions(GroupName, ComboName, ModelUnits); FrameDataExtractor ext = new FrameDataExtractor(); FrameEnvelopeReactionResult res = ext.GetFrameReactions(GroupName, ComboName, ModelUnits.ToString()); return(res); }
internal XElement ToXElement(Package package) { // ensure build items are included var resourcesHash = new HashSet <ThreeMfResource>(Resources); foreach (var item in Items) { if (resourcesHash.Add(item.Object)) { Resources.Add(item.Object); } } // ensure components and property resources are included foreach (var resource in Resources.ToList()) { if (resource is ThreeMfObject obj) { foreach (var component in obj.Components) { if (resourcesHash.Add(component.Object)) { // components must be defined ahead of their reference Resources.Insert(0, component.Object); } } if (obj.PropertyResource != null && resourcesHash.Add((ThreeMfResource)obj.PropertyResource)) { // property resources must be defined ahead of their reference Resources.Insert(0, (ThreeMfResource)obj.PropertyResource); } foreach (var triangle in obj.Mesh.Triangles) { if (triangle.PropertyResource != null && resourcesHash.Add((ThreeMfResource)triangle.PropertyResource)) { // property resources must be defined ahead of their reference Resources.Insert(0, (ThreeMfResource)triangle.PropertyResource); } } } else if (resource is ThreeMfTexture2DGroup textureGroup) { if (resourcesHash.Add(textureGroup.Texture)) { // textures must be defined ahead of their reference Resources.Insert(0, textureGroup.Texture); } } } var resourceMap = new Dictionary <ThreeMfResource, int>(); for (int i = 0; i < Resources.Count; i++) { Resources[i].Id = i + 1; resourceMap.Add(Resources[i], Resources[i].Id); } var modelXml = new XElement(ModelName); // ensure all appropriate namespaces are included var extensionNamespaces = new List <Tuple <string, string> >(); if (Resources.Any(r => r is ThreeMfColorGroup || r is ThreeMfTexture2D || r is ThreeMfTexture2DGroup)) { extensionNamespaces.Add(Tuple.Create(MaterialNamespace, "m")); } modelXml.Add( new XAttribute(UnitAttributeName, ModelUnits.ToString().ToLowerInvariant()), new XAttribute(XmlLanguageAttributeName, DefaultLanguage), extensionNamespaces.Select(rns => new XAttribute(XNamespace.Xmlns + rns.Item2, rns.Item1)), GetMetadataXElements(Metadata_Title, Title), GetMetadataXElements(Metadata_Designer, Designer), GetMetadataXElements(Metadata_Description, Description), GetMetadataXElements(Metadata_Copyright, Copyright), GetMetadataXElements(Metadata_LicenseTerms, LicenseTerms), GetMetadataXElements(Metadata_Rating, Rating), GetMetadataXElements(Metadata_CreationDate, CreationDate), GetMetadataXElements(Metadata_ModificationDate, ModificationDate), new XElement(ResourcesName, Resources.Select(r => r.ToXElement(resourceMap))), new XElement(BuildName, Items.Select(i => i.ToXElement(resourceMap)))); return(modelXml); }