/// <summary> /// Sets the tendon section assignments. /// </summary> /// <param name="model">The model.</param> /// <param name="table">The table.</param> private static void setTENDON_SECTION_ASSIGNMENTS(Model model, List <Dictionary <string, string> > table) { foreach (Dictionary <string, string> tableRow in table) { Tendon tendon = model.Structure.Tendons[tableRow["Tendon"]]; tendon.SectionName = tableRow["TendonSect"]; } }
/// <summary> /// Sets the tendon layout data 01 general. /// </summary> /// <param name="model">The model.</param> /// <param name="table">The table.</param> private static void setTENDON_LAYOUT_DATA_01_GENERAL(Model model, List <Dictionary <string, string> > table) { foreach (Dictionary <string, string> tableRow in table) { Tendon tendon = model.Structure.Tendons[tableRow["Tendon"]]; tendon.MaxDiscretizationLength = Adaptor.toDouble(tableRow["MaxDiscLen"]); string loadGroupName = tableRow["LoadGroup"]; tendon.LoadGroupName = loadGroupName; tendon.LoadGroup = model.Groupings.Groups[loadGroupName]; } }
/// <summary> /// Sets the connectivity tendon. /// </summary> /// <param name="model">The model.</param> /// <param name="table">The table.</param> private static void setCONNECTIVITY_TENDON(Model model, List <Dictionary <string, string> > table) { foreach (Dictionary <string, string> tableRow in table) { Tendon tendon = model.Structure.Tendons[tableRow["Tendon"]]; if (tableRow.ContainsKey("GUID")) { tendon.GUID = tableRow["GUID"]; } tendon.PointNames.Add(tableRow["JointI"]); tendon.PointNames.Add(tableRow["JointJ"]); } }
/// <summary> /// Retrieves the assignments to the group. /// </summary> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> public void FillAssignments() { List <Tuple <eObjectType, string> > assignmentsList = GetAssignmentsList(); foreach (var tuple in assignmentsList) { string objectName = tuple.Item2; switch (tuple.Item1) { case eObjectType.Area: Area area = _objects.Areas.FillItem(objectName); HelperFunctions.AddUniqueItem(area, Areas); break; case eObjectType.Frame: Frame frame = _objects.Frames.FillItem(objectName); HelperFunctions.AddUniqueItem(frame, Frames); break; case eObjectType.Link: Link link = _objects.Links.FillItem(objectName); HelperFunctions.AddUniqueItem(link, Links); break; case eObjectType.Point: Point node = _objects.Points.FillItem(objectName); HelperFunctions.AddUniqueItem(node, Points); break; #if !BUILD_ETABS2015 && !BUILD_ETABS2016 && !BUILD_ETABS2017 case eObjectType.Cable: Cable cable = _objects.Cables.FillItem(objectName); HelperFunctions.AddUniqueItem(cable, Cables); break; case eObjectType.Tendon: Tendon tendon = _objects.Tendons.FillItem(objectName); HelperFunctions.AddUniqueItem(tendon, Tendons); break; case eObjectType.Solid: Solid solid = _objects.Solids.FillItem(objectName); HelperFunctions.AddUniqueItem(solid, Solids); break; #endif default: break; } } }
/// <summary> /// Retrieves the assignments to the group. /// </summary> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> public void FillAssignments() { List <Tuple <eObjectType, string> > assignmentsList = GetAssignmentsList(); foreach (var tuple in assignmentsList) { switch (tuple.Item1) { case eObjectType.Area: Area area = Area.Factory(tuple.Item2); HelperFunctions.AddUniqueItem(area, Areas); break; case eObjectType.Frame: Frame frame = Frame.Factory(tuple.Item2); HelperFunctions.AddUniqueItem(frame, Frames); break; case eObjectType.Link: Link link = Link.Factory(tuple.Item2); HelperFunctions.AddUniqueItem(link, Links); break; case eObjectType.Point: Node node = Node.Factory(tuple.Item2); HelperFunctions.AddUniqueItem(node, Points); break; #if !BUILD_ETABS2015 && !BUILD_ETABS2016 && !BUILD_ETABS2017 case eObjectType.Cable: Cable cable = Cable.Factory(tuple.Item2); HelperFunctions.AddUniqueItem(cable, Cables); break; case eObjectType.Tendon: Tendon tendon = Tendon.Factory(tuple.Item2); HelperFunctions.AddUniqueItem(tendon, Tendons); break; case eObjectType.Solid: Solid solid = Solid.Factory(tuple.Item2); HelperFunctions.AddUniqueItem(solid, Solids); break; #endif default: break; } } }
/// <summary> /// Adds new tendon to list of existing tendons. Sets all references and sets all references /// If tendon with this id already exists, nothing happens. /// </summary> /// <param name="tendonID">ID of new tendon</param> /// <param name="positions">position of wirepoints in world space</param> /// <param name="objectNames">names of roboy parts which are linked to each point</param> /// <param name="maxforce"></param> public void AddTendon(int tendonID, Vector3[] positions, string[] objectNames, float maxforce) { GameObject tendonObj = new GameObject(); tendonObj.name = "Tendon " + tendonID; tendonObj.transform.SetParent(m_TendonContainer.transform); Tendon tendon = tendonObj.AddComponent <Tendon>(); for (int i = 0; i < positions.Length; i++) {//assume Roboy in simulation around (0,0,0) since this roboy here is transformed to fit in the cave -> adapt positions[i] += m_Roboy.transform.position; } tendon.Initialize(tendonID, positions, objectNames, maxforce); AddTendon(tendon); }
/// <summary> /// Sets the tendon layout data 02 segments. /// </summary> /// <param name="model">The model.</param> /// <param name="table">The table.</param> private static void setTENDON_LAYOUT_DATA_02_SEGMENTS(Model model, List <Dictionary <string, string> > table) { foreach (Dictionary <string, string> tableRow in table) { Tendon tendon = model.Structure.Tendons[tableRow["Tendon"]]; eTendonGeometryDefinition segmentType = Enums.EnumLibrary.ConvertStringToEnumByDescription <eTendonGeometryDefinition>(tableRow["SegType"]); Coordinate3DCartesian coordinate = new Coordinate3DCartesian { X = Adaptor.toDouble(tableRow["XGlobal"]), Y = Adaptor.toDouble(tableRow["YGlobal"]), Z = Adaptor.toDouble(tableRow["ZGlobal"]) }; tendon.Segments.Add(new Tuple <eTendonGeometryDefinition, Coordinate3DCartesian>(segmentType, coordinate)); } }
/// <summary> /// Sets the groups 2 assignments. /// </summary> /// <param name="model">The model.</param> /// <param name="table">The table.</param> internal static void SetGroups_2_ASSIGNMENTS(Model model, List <Dictionary <string, string> > table) { foreach (Dictionary <string, string> tableRow in table) { Group group = model.Groupings.Groups.FillItem(tableRow["GroupName"]); switch (tableRow["ObjectType"]) { case "Joint": Point point = model.Structure.Points.FillItem(tableRow["ObjectLabel"]); group.Add(point); break; case "Frame": Frame frame = model.Structure.Frames.FillItem(tableRow["ObjectLabel"]); group.Add(frame); break; case "Area": Area area = model.Structure.Areas.FillItem(tableRow["ObjectLabel"]); group.Add(area); break; case "Link": Link link = model.Structure.Links.FillItem(tableRow["ObjectLabel"]); group.Add(link); break; case "Tendon": Tendon tendon = model.Structure.Tendons.FillItem(tableRow["ObjectLabel"]); group.Add(tendon); break; case "Cable": Cable cable = model.Structure.Cables.FillItem(tableRow["ObjectLabel"]); group.Add(cable); break; case "Solid": Solid solid = model.Structure.Solids.FillItem(tableRow["ObjectLabel"]); group.Add(solid); break; } } }
/// <summary> /// Adds tendon to list of existing tendons in case no tendon with this id /// exists so far and it's not in the list already. /// </summary> /// <param name="tendon"></param> private void AddTendon(Tendon tendon) { if (tendon && !m_Tendons.Contains(tendon)) //if not inserted already { int index = tendon.GetTendonID(); //add tendon to appropriate spot: if (index >= m_Tendons.Count || !m_Tendons[index]) //if no tendon with same id existing yet { while (m_Tendons.Count < index) //fill list until tendon can be inserted at index { m_Tendons.Insert(m_Tendons.Count, null); } m_Tendons.Insert(index, tendon); } } else { Destroy(tendon.gameObject); //destroy gameobject and script linked to it } }
protected void setGroupAssign(Tendon item, bool remove) { _app?.Model.ObjectModel.TendonObject.SetGroupAssign(item.Name, Name, remove); }
/// <summary> /// Removes objects from the group. /// </summary> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> public void Remove(Tendon item) { setGroupAssign(item, remove: true); Tendons.Remove(item); }
/// <summary> /// Adds objects to the group. /// </summary> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> public void Add(Tendon item) { setGroupAssign(item, remove: false); HelperFunctions.AddUniqueItem(item, Tendons); }
/// <summary> /// Removes objects from the group. /// </summary> public void Remove(Tendon item) { Tendons.Remove(item); item.RemoveFromGroup(this); }
/// <summary> /// Adds objects to the group. /// </summary> public void Add(Tendon item) { HelperFunctions.AddUniqueItem(item, Tendons); item.AddToGroup(this); }
/// <summary> /// Removes objects from the group. /// </summary> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> public void Remove(Tendon item) { setGroupAssign(item, remove: true); Tendons.Remove(item); item.RemoveFromGroup(this); }