/***************************************************/ private bool CreateLoad(AreaUniformTemperatureLoad bhLoad) { List <IAreaElement> panels = bhLoad.Objects.Elements.ToList(); string loadPat = GetAdapterId <string>(bhLoad.Loadcase); double vals = bhLoad.TemperatureChange; int loadType = 1; // BHoM currently supports uniform temperature change, no support yet for temperature gradient bool replace = SAPPushConfig.ReplaceLoads; foreach (Panel panel in panels) { string name = GetAdapterId <string>(panel); bool replaceNow = replace; if (m_model.AreaObj.SetLoadTemperature(name, loadPat, loadType, vals, Replace:replaceNow) != 0) { CreateElementError("AreaUniformTemperatureLoad", bhLoad.Name); } } SetAdapterId(bhLoad, null); Engine.Base.Compute.RecordNote("SAP2000 includes functionality for temperature gradient application, but that feature is not yet supported here."); return(true); }
public static List <ICurve> Visualize(this AreaUniformTemperatureLoad areaTempLoad, double scaleFactor = 1.0, bool displayForces = true, bool displayMoments = true, bool asResultants = true, bool edgeDisplay = true, bool gridDisplay = false) { if (areaTempLoad.IsNull()) { return(null); } List <ICurve> arrows = new List <ICurve>(); double loadFactor = areaTempLoad.TemperatureChange * 1000 * scaleFactor; //Arrow methods are scaling down force to 1/1000 foreach (IAreaElement element in areaTempLoad.Objects.Elements) { List <List <ICurve> > allEdges = edgeDisplay ? ISubElementBoundaries(element) : new List <List <ICurve> >(); List <Basis> allOrientations = IAllLocalOrientations(element); List <List <Point> > subElementGrids = gridDisplay ? ISubElementPointGrids(element) : new List <List <Point> >(); for (int i = 0; i < allOrientations.Count; i++) { IEnumerable <ICurve> edges = edgeDisplay ? allEdges[i] : null; List <Point> pts = gridDisplay ? subElementGrids[i] : null; Basis orientation = allOrientations[i]; Vector vector = orientation.Z * loadFactor; if (edgeDisplay) { arrows.AddRange(ConnectedArrows(edges, vector, true, null, 0, true)); } if (gridDisplay) { arrows.AddRange(MultipleArrows(pts, vector, true, null, 0, true)); } } } return(arrows); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static AreaUniformTemperatureLoad ToAreaTempratureLoad( IFLoading lusasTemperatureLoad, IEnumerable <IFAssignment> lusasAssignments, Dictionary <string, Panel> panels) { IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset(); Loadcase loadcase = ToLoadcase(assignedLoadcase); double temperatureChange = lusasTemperatureLoad.getValue("T") - lusasTemperatureLoad.getValue("T0"); IEnumerable <IAreaElement> assignedPanels = GetSurfaceAssignments(lusasAssignments, panels); AreaUniformTemperatureLoad AreaUniformTemperatureLoad = BH.Engine.Structure.Create.AreaUniformTemperatureLoad( loadcase, temperatureChange, assignedPanels, LoadAxis.Local, false, GetName(lusasTemperatureLoad)); int adapterNameId = lusasTemperatureLoad.getID(); AreaUniformTemperatureLoad.SetAdapterId(typeof(LusasId), adapterNameId); return(AreaUniformTemperatureLoad); }
private List <ILoad> ReadAreaUniformTemperatureLoads(List <string> ids = null) { /***************************************************/ /**** Private Methods ****/ /***************************************************/ List <ILoad> areaUniformTemperatureLoads = new List <ILoad>(); object[] lusasTemperatureLoads = d_LusasData.getAttributes("Temperature"); if (!(lusasTemperatureLoads.Count() == 0)) { List <Panel> panelsList = ReadPanels(); Dictionary <string, Panel> panels = panelsList.ToDictionary( x => x.AdapterId <string>(typeof(LusasId))); List <IFLoadcase> allLoadcases = new List <IFLoadcase>(); for (int i = 0; i < lusasTemperatureLoads.Count(); i++) { IFLoading lusasTemperatureLoad = (IFLoading)lusasTemperatureLoads[i]; IEnumerable <IGrouping <string, IFAssignment> > groupedByLoadcases = GetLoadAssignments(lusasTemperatureLoad); foreach (IEnumerable <IFAssignment> groupedAssignment in groupedByLoadcases) { List <IFAssignment> surfaceAssignments = new List <IFAssignment>(); foreach (IFAssignment assignment in groupedAssignment) { IFSurface trySurf = assignment.getDatabaseObject() as IFSurface; if (trySurf != null) { surfaceAssignments.Add(assignment); } } List <string> analysisName = new List <string> { lusasTemperatureLoad.getAttributeType() }; if (surfaceAssignments.Count != 0) { AreaUniformTemperatureLoad areaUniformTemperatureLoad = Adapters.Lusas.Convert.ToAreaTempratureLoad( lusasTemperatureLoad, groupedAssignment, panels); areaUniformTemperatureLoad.Tags = new HashSet <string>(analysisName); areaUniformTemperatureLoads.Add(areaUniformTemperatureLoad); } } } } return(areaUniformTemperatureLoads); }
/***************************************************/ private IFLoadingTemperature CreateAreaUniformTemperatureLoad(AreaUniformTemperatureLoad temperatureLoad, object[] lusasSurfaces) { IFLoadcase assignedLoadcase = (IFLoadcase)d_LusasData.getLoadset(temperatureLoad.Loadcase.AdapterId <int>(typeof(LusasId))); IFLoadingTemperature lusasTemperatureLoad = CreateTemperatureLoad(temperatureLoad.Name, temperatureLoad.TemperatureChange, lusasSurfaces, assignedLoadcase); int adapterIdName = lusasTemperatureLoad.getID(); temperatureLoad.SetAdapterId(typeof(LusasId), adapterIdName); return(lusasTemperatureLoad); }
/***************************************************/ public void SetLoad(AreaUniformTemperatureLoad areaTempratureLoad, bool replace) { int ret = 0; string caseName = GetAdapterId <string>(areaTempratureLoad.Loadcase); foreach (IAreaElement area in areaTempratureLoad.Objects.Elements) { double val = areaTempratureLoad.TemperatureChange; if (val != 0) { ret = m_model.AreaObj.SetLoadTemperature(GetAdapterId <string>(area), caseName, 1, val, "", replace); } } }
public static LoadType LoadType(this AreaUniformTemperatureLoad load) { return(oM.Structure.Loads.LoadType.AreaTemperature); }