public override TclCommand[] Translate(StructurePart targetElement, out string elementTag)
        {
            var elm = targetElement as TriangleElement;
            var sec = elm.Section.GetThicknessAt(0);// as Sections.UniformParametric1DSection;
            var mat = elm.Material as Materials.UniformIsotropicMaterial;
            var g   = mat.YoungModulus / (2 * (1 + mat.PoissonRatio));


            var buf = new List <TclCommand>();

            var eleTag = TargetGenerator.GetCounter("element");
            var secTag = TargetGenerator.GetCounter("section");

            var vec = elm.GetTransformationManager().TransformLocalToGlobal(Vector.K).GetUnit();

            buf.Add(new TclCommand("section", "ElasticMembranePlateSection", secTag,
                                   mat.YoungModulus, mat.PoissonRatio, sec, 0));

            buf.Add(new TclCommand("element", "ShellDKGT", eleTag,
                                   elm.Nodes[0].GetIndex(),
                                   elm.Nodes[1].GetIndex(),
                                   elm.Nodes[2].GetIndex(),
                                   secTag));

            TargetGenerator.SetCounter("element", eleTag + 1);
            TargetGenerator.SetCounter("section", secTag + 1);

            elementTag = eleTag.ToString(CultureInfo.CurrentCulture);

            return(buf.ToArray());
        }
Beispiel #2
0
        public override TclCommand[] Translate(StructurePart targetElement, out string elementTag)
        {
            var elm = targetElement as BarElement;
            var sec = elm.Section as Sections.UniformParametric1DSection;
            var mat = elm.Material as Materials.UniformIsotropicMaterial;
            var g   = mat.YoungModulus / (2 * (1 + mat.PoissonRatio));


            var buf = new List <TclCommand>();

            var eleTag   = TargetGenerator.GetCounter("element");
            var transTag = TargetGenerator.GetCounter("geomTransf");

            var vec = elm.GetTransformationManager().TransformLocalToGlobal(Vector.K).GetUnit();

            buf.Add(new TclCommand("geomTransf", "Linear ", transTag,
                                   vec.X, vec.Y, vec.Z));

            buf.Add(new TclCommand("element", "elasticBeamColumn", eleTag,
                                   elm.StartNode.GetIndex(),
                                   elm.EndNode.GetIndex(),
                                   sec.A,
                                   mat.YoungModulus
                                   , g
                                   , sec.J,
                                   sec.Iz,
                                   sec.Iy, transTag));

            TargetGenerator.SetCounter("element", eleTag + 1);
            TargetGenerator.SetCounter("geomTransf", transTag + 1);

            elementTag = eleTag.ToString();

            return(buf.ToArray());
        }
Beispiel #3
0
        public override void Export(Asset asset, string path)
        {
            Model model = (asset as Model);

            if (string.Compare(Path.GetFileName(path), "structure.xml", true) != 0)
            {
                path += "\\Structure.XML";
            }

            if (model.SupportingDocuments.ContainsKey("Structure"))
            {
                ((Structure)model.SupportingDocuments["Structure"]).Save(path);
            }
            else
            {
                Structure structure = new Structure();

                StructurePart root = new StructurePart()
                {
                    IsRoot = true
                };

                TravelTree(model.Root, ref root, true);

                structure.Root = root;

                structure.Save(path);
            }
        }
        public override TclCommand[] Translate(StructurePart targetElement, out string elementTag)
        {
            var elm = targetElement as TetrahedronElement;

            var e  = elm.Material.GetMaterialPropertiesAt(0, 0, 0).Ex;
            var nu = elm.Material.GetMaterialPropertiesAt(0, 0, 0).NuXy;


            var buf = new List <TclCommand>();

            var eleTag = TargetGenerator.GetCounter("element");
            //var transTag = TargetGenerator.GetCounter("geomTransf");
            var matTag = TargetGenerator.GetCounter("nDMaterial");

            //var vec = elm.GetTransformationManager().TransformLocalToGlobal(Vector.K).GetUnit();

            buf.Add(new TclCommand("nDMaterial", "ElasticIsotropic", matTag,
                                   e, nu));

            buf.Add(new TclCommand("element", "FourNodeTetrahedron", eleTag,
                                   elm.Nodes[0].GetIndex(),
                                   elm.Nodes[1].GetIndex(),
                                   elm.Nodes[2].GetIndex(),
                                   elm.Nodes[3].GetIndex(),

                                   matTag, 0, 0, 0));

            TargetGenerator.SetCounter("element", eleTag + 1);
            TargetGenerator.SetCounter("nDMaterial", matTag + 1);

            elementTag = eleTag.ToString(CultureInfo.CurrentCulture);

            return(buf.ToArray());
        }
        public override TclCommand[] Translate(StructurePart targetElement, out string elementTag)
        {
            var elm = targetElement as TriangleElement;
            var sec = elm.Section.GetThicknessAt(0);// as Sections.UniformParametric1DSection;
            var mat = elm.Material as Materials.UniformIsotropicMaterial;
            var g   = mat.YoungModulus / (2 * (1 + mat.PoissonRatio));


            var buf = new List <TclCommand>();

            var eleTag = TargetGenerator.GetCounter("element");
            var matTag = TargetGenerator.GetCounter("nDMaterial");

            buf.Add(new TclCommand("nDMaterial", "ElasticIsotropic", matTag, mat.YoungModulus, mat.PoissonRatio));

            buf.Add(new TclCommand("element", "tri31 ", eleTag,
                                   elm.Nodes[0].GetIndex(),
                                   elm.Nodes[1].GetIndex(),
                                   elm.Nodes[2].GetIndex(),
                                   sec,
                                   "PlaneStrain",
                                   matTag));

            TargetGenerator.SetCounter("element", eleTag + 1);
            TargetGenerator.SetCounter("nDMaterial", matTag + 1);

            elementTag = eleTag.ToString(CultureInfo.CurrentCulture);

            return(buf.ToArray());
        }
Beispiel #6
0
        private static void ListTransactionStructure(KBObject obj, StreamWriter file)
        {
            StructurePart sp = obj.Parts.Get <StructurePart>();

            if (sp != null)
            {
                PrintSectionHeader("STRUCTURE", file);
                file.WriteLine(sp.ToString());
            }
        }
Beispiel #7
0
        private static void ListTransactionStructure(KBObject obj, StreamWriter file)
        {
            StructurePart sp = obj.Parts.Get <StructurePart>();

            if (sp != null)
            {
                file.WriteLine(Environment.NewLine + "=== STRUCTURE ===");
                file.WriteLine(sp.ToString());
            }
        }
        public override bool CanTranslate(StructurePart targetElement)
        {
            var elm = targetElement as TetrahedronElement;

            if (elm == null)
            {
                return(false);
            }

            return(true);
        }
            public static StructurePart GetStructurePart(Part part, Part root)
            {
                StructurePart structurePart = new StructurePart
                {
                    Id        = part.flightID,
                    Name      = part.name,
                    LinkCount = RmmUtil.GetLinkedParts(part).Count,
                    Position  = root.transform.InverseTransformPoint(part.transform.position)
                };

                return(structurePart);
            }
Beispiel #10
0
        public override bool CanTranslate(StructurePart targetElement)
        {
            var elm = targetElement as BarElement;

            if (elm == null)
            {
                return(false);
            }

            if (!(elm.Section is Sections.UniformParametric1DSection))
            {
                return(false);
            }

            if (!(elm.Material is Materials.UniformIsotropicMaterial))
            {
                return(false);
            }

            return(true);
        }
        public static Structure GetDockedStructure(Vessel vessel, Part dockedPort)
        {
            if (dockedPort == null)
            {
                return(null);
            }

            List <Part> dockedParts = RmmUtil.GetDockedParts(vessel, dockedPort);

            // root of structure is the docked port
            Part rootPart = dockedPort;

            // seperate child parts
            dockedParts.Remove(dockedPort);
            List <Part> childParts = dockedParts;

            // Create structure
            var structure = new Structure();

            structure.Parts = new List <StructurePart>();

            structure.Root = StructurePart.GetStructurePart(rootPart, rootPart);
            // decrement link count if root part is docked
            if (RmmUtil.IsDocked(vessel, dockedPort))
            {
                structure.Root.LinkCount--;
            }

            structure.Parts = new List <StructurePart>();
            // add root to structure parts
            structure.Parts.Add(structure.Root);
            // add all child parts to structure parts
            foreach (Part childPart in dockedParts)
            {
                structure.Parts.Add(StructurePart.GetStructurePart(childPart, rootPart));
            }

            return(structure);
        }
Beispiel #12
0
        public override TclCommand[] Translate(StructurePart targetElement, out string elementTag)
        {
            var elm = targetElement as Tetrahedral;

            //var sec = elm.Section as Sections.UniformParametric1DSection;

            //var mat = elm.Material as Materials.UniformIsotropicMaterial;
            //var g = mat.YoungModulus / (2 * (1 + mat.PoissonRatio));
            var e = elm.E;


            var buf = new List <TclCommand>();

            var eleTag = TargetGenerator.GetCounter("element");
            //var transTag = TargetGenerator.GetCounter("geomTransf");
            var matTag = TargetGenerator.GetCounter("nDMaterial");

            //var vec = elm.GetTransformationManager().TransformLocalToGlobal(Vector.K).GetUnit();

            buf.Add(new TclCommand("nDMaterial", "ElasticIsotropic", matTag,
                                   elm.E, elm.Nu));

            buf.Add(new TclCommand("element", "FourNodeTetrahedron", eleTag,
                                   elm.Nodes[0].GetIndex(),
                                   elm.Nodes[1].GetIndex(),
                                   elm.Nodes[2].GetIndex(),
                                   elm.Nodes[3].GetIndex(),

                                   matTag, 0, 0, 0));

            TargetGenerator.SetCounter("element", eleTag + 1);
            TargetGenerator.SetCounter("nDMaterial", matTag + 1);

            elementTag = eleTag.ToString(CultureInfo.CurrentCulture);

            return(buf.ToArray());
        }
        private static void WriteObjectContent(KBObject obj, StreamWriter file)
        {
            RulesPart rp = obj.Parts.Get <RulesPart>();

            if (rp != null)
            {
                file.WriteLine(Environment.NewLine + "=== RULES ===");
                file.WriteLine(rp.Source);
            }

            EventsPart ep = obj.Parts.Get <EventsPart>();

            if (ep != null)
            {
                file.WriteLine(Environment.NewLine + "=== EVENTS SOURCE ===");
                file.WriteLine(ep.Source);
            }

            switch (obj.TypeDescriptor.Name)
            {
            case "Attribute":

                Artech.Genexus.Common.Objects.Attribute att = (Artech.Genexus.Common.Objects.Attribute)obj;

                file.WriteLine(Functions.ReturnPicture(att));
                if (att.Formula == null)
                {
                    file.WriteLine("");
                }
                else
                {
                    file.WriteLine(att.Formula.ToString());
                }
                break;

            case "Procedure":
                ProcedurePart pp = obj.Parts.Get <ProcedurePart>();
                if (pp != null)
                {
                    file.WriteLine(Environment.NewLine + "=== PROCEDURE SOURCE ===");
                    file.WriteLine(pp.Source);
                }
                break;

            case "Transaction":
                StructurePart sp = obj.Parts.Get <StructurePart>();
                if (sp != null)
                {
                    file.WriteLine(Environment.NewLine + "=== STRUCTURE ===");
                    file.WriteLine(sp.ToString());
                }
                break;

            case "WorkPanel":
                break;

            case "WebPanel":
                break;

            case "WebComponent":
                break;

            case "Table":
                Table tbl = (Table)obj;

                foreach (TableAttribute attr in tbl.TableStructure.Attributes)
                {
                    String line = "";
                    if (attr.IsKey)
                    {
                        line = "*";
                    }
                    else
                    {
                        line = " ";
                    }

                    line += attr.Name + "  " + attr.GetPropertiesObject().GetPropertyValueString("DataTypeString") + "-" + attr.GetPropertiesObject().GetPropertyValueString("Formula");

                    if (attr.IsExternalRedundant)
                    {
                        line += " External_Redundant";
                    }

                    line += " Null=" + attr.IsNullable;
                    if (attr.IsRedundant)
                    {
                        line += " Redundant";
                    }

                    file.WriteLine(line);
                }
                break;


            case "SDT":
                SDT sdtToList = (SDT)obj;
                if (sdtToList != null)
                {
                    file.WriteLine(Environment.NewLine + "=== STRUCTURE ===");
                    ListStructure(sdtToList.SDTStructure.Root, 0, file);
                }
                break;

            default:

                //Unknown object. Use export format.
                file.Write(SerializeObject(obj).ToString());
                break;
            }

            file.WriteLine(Environment.NewLine + "====== PROPERTIES =======");
            foreach (Property prop in obj.Properties)
            {
                if (!prop.IsDefault)
                {
                    file.WriteLine(prop.Name + " -> " + prop.Value.ToString());
                }
                else
                {
                    if ((prop.Name == "CommitOnExit") || (prop.Name == "TRNCMT") || (prop.Name == "GenerateObject"))
                    {
                        file.WriteLine(prop.Name + " -> " + prop.Value.ToString());
                    }
                }
            }

            //CATEGORIES
            IEnumerable <Artech.Udm.Framework.References.EntityReference> refe = obj.GetReferences();

            string        GUIDCatString = "00000000-0000-0000-0000-000000000006";
            List <string> categories    = new List <string>();

            foreach (Artech.Udm.Framework.References.EntityReference reference in refe)
            {
                Guid   GUIDRefTo       = reference.To.Type;
                string GUIDRefToString = GUIDRefTo.ToString();

                if (GUIDRefToString == GUIDCatString)
                {
                    KBCategory cat = KBCategory.Get(UIServices.KB.CurrentModel, reference.To.Id);
                    categories.Add(cat.Name);
                }
            }

            if (categories.Count > 0)
            {
                file.WriteLine(Environment.NewLine + "====== CATEGORIES =======");
                foreach (string name in categories)
                {
                    file.WriteLine(name);
                }
            }
        }
Beispiel #14
0
 public abstract bool CanTranslate(StructurePart targetElement);
Beispiel #15
0
 public abstract TclCommand[] Translate(StructurePart targetElement, out string elementTag);
Beispiel #16
0
 public static bool Prefix(ref FurnaceVolume __instance, ref EntityCommandBuffer commandBuffer, ref EntityManager entityManager, ref Entity entity, ref StructurePart part)
 {
     FurnaceVolumePatch1.InvokeDestroy(__instance, entityManager, entity, part);
     SalvageableUtility.MarkAsDestroyed(commandBuffer, entityManager, entity, SalvagedBy.Furnace);
     return(false);
 }
Beispiel #17
0
        public static void InvokeDestroy(FurnaceVolume __instance, EntityManager entityManager, Entity entity, StructurePart part)
        {
            if (destroyPartMethod == null)
            {
                destroyPartMethod = typeof(FurnaceVolume).GetMethod("DestroyPart", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            }

            var destroyPartResult = (IEnumerator)destroyPartMethod.Invoke(__instance, new object[] { Main.Instance.MainSettings.SalvageSettings.ObjectDestructionDelay, part, entityManager, entity });

            __instance.StartCoroutine(destroyPartResult);
        }
Beispiel #18
0
        public static void TravelTree(ModelBone bone, ref StructurePart parent, bool root = false)
        {
            StructurePart part = new StructurePart();

            if (root)
            {
                part = parent;
            }

            part.Name = bone.Name;

            switch (bone.Name.ToLower())
            {
            case "driver":
                return;

            case "wheel_fl":
                parent.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_LEFT_POINT_OF_SUSPENSION);
                parent.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_LEFT_POINT_OF_STEERING);

                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_LEFT_WHEEL);
                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_LEFT_POINT_OF_ROTATION);
                part.DamageSettings.SetParameterForMethod("ShapeType", "Shape", "TIC_TAC_X");
                part.DamageSettings.SetParameterForMethod("Restitution", "Value", 2.0f);
                break;

            case "wheel_fr":
                parent.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_RIGHT_POINT_OF_SUSPENSION);
                parent.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_RIGHT_POINT_OF_STEERING);

                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_RIGHT_WHEEL);
                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.FRONT_RIGHT_POINT_OF_ROTATION);
                part.DamageSettings.SetParameterForMethod("ShapeType", "Shape", "TIC_TAC_X");
                part.DamageSettings.SetParameterForMethod("Restitution", "Value", 2.0f);
                break;

            case "wheel_rl":
                parent.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.REAR_LEFT_POINT_OF_SUSPENSION);

                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.REAR_LEFT_WHEEL);
                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.REAR_LEFT_POINT_OF_ROTATION);
                part.DamageSettings.SetParameterForMethod("ShapeType", "Shape", "TIC_TAC_X");
                part.DamageSettings.SetParameterForMethod("Restitution", "Value", 2.0f);
                break;

            case "wheel_rr":
                parent.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.REAR_RIGHT_POINT_OF_SUSPENSION);

                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.REAR_RIGHT_WHEEL);
                part.DamageSettings.SetParameterForMethod("PhysicsProperty", "Name", StructurePhysicsProperty.REAR_RIGHT_POINT_OF_ROTATION);
                part.DamageSettings.SetParameterForMethod("ShapeType", "Shape", "TIC_TAC_X");
                part.DamageSettings.SetParameterForMethod("Restitution", "Value", 2.0f);
                break;

            default:
                if (bone.Name.Length > 2 && bone.Name.StartsWith("c_", StringComparison.InvariantCultureIgnoreCase))
                {
                    part.DamageSettings.SetParameterForMethod("Crushability", "Value", 1.0f);
                }
                else
                {
                    part.DamageSettings.SetParameterForMethod("Crushability", "Value", 0.0f);
                }
                break;
            }

            foreach (ModelBone b in bone.Children)
            {
                TravelTree(b, ref part);
            }

            if (!root)
            {
                StructureWeld weld = new StructureWeld
                {
                    Partner = parent.Name
                };

                weld.WeldSettings.SetParametersForMethod("PartSpaceVertex", "X", 0, "Y", 0, "Z", 0);

                part.Welds.Add(weld);

                parent.Parts.Add(part);
            }
        }
Beispiel #19
0
 public abstract TclCommand[] Translate(StructurePart targetElement);
Beispiel #20
0
 public static int GetIndex(this StructurePart node)
 {
     return((int)node.GetMemberValue("Index"));
 }