Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Set Get Differential Temp Load #466

Merged
merged 9 commits into from
Dec 10, 2024
69 changes: 61 additions & 8 deletions Etabs_Adapter/CRUD/Create/Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,32 +273,85 @@ public void SetLoad(BarPointLoad barPointLoad, bool replace)

/***************************************************/

public void SetLoad(AreaUniformTemperatureLoad areaTempratureLoad, bool replace)
public void SetLoad(AreaUniformTemperatureLoad areaTemperatureLoad, bool replace)
{
int ret = 0;
string caseName = GetAdapterId<string>(areaTempratureLoad.Loadcase);
foreach (IAreaElement area in areaTempratureLoad.Objects.Elements)
string caseName = GetAdapterId<string>(areaTemperatureLoad.Loadcase);
foreach (IAreaElement area in areaTemperatureLoad.Objects.Elements)
{
double val = areaTempratureLoad.TemperatureChange;
double val = areaTemperatureLoad.TemperatureChange;
if (val != 0)
ret = m_model.AreaObj.SetLoadTemperature(GetAdapterId<string>(area), caseName, 1, val, "", replace);
}
}

/***************************************************/

public void SetLoad(BarUniformTemperatureLoad barTempratureLoad, bool replace)
public void SetLoad(AreaDifferentialTemperatureLoad areaDifferentialTemperatureLoad, bool replace)
{
int ret = 0;
string caseName = GetAdapterId<string>(barTempratureLoad.Loadcase);
foreach (Bar bar in barTempratureLoad.Objects.Elements)
string caseName = GetAdapterId<string>(areaDifferentialTemperatureLoad.Loadcase);
foreach (IAreaElement area in areaDifferentialTemperatureLoad.Objects.Elements)
{
double val = barTempratureLoad.TemperatureChange;
Dictionary<double, double> tempProfile = areaDifferentialTemperatureLoad.TemperatureProfile;
double tempMed = tempProfile.Average(kv => kv.Value);
double tempDelta= ((tempProfile[0] - tempMed) - (tempProfile[1] - tempMed));

if (tempMed!=0)
{ ret = m_model.AreaObj.SetLoadTemperature(GetAdapterId<string>(area), caseName, 1, tempMed, "", replace);}

if (tempDelta!=0)
{ ret = m_model.AreaObj.SetLoadTemperature(GetAdapterId<string>(area), caseName, 3, tempDelta, "", replace);}
GCRA101 marked this conversation as resolved.
Show resolved Hide resolved

}
}

/***************************************************/

public void SetLoad(BarUniformTemperatureLoad barTemperatureLoad, bool replace)
{
int ret = 0;
string caseName = GetAdapterId<string>(barTemperatureLoad.Loadcase);
foreach (Bar bar in barTemperatureLoad.Objects.Elements)
{
double val = barTemperatureLoad.TemperatureChange;
if (val != 0)
ret = m_model.FrameObj.SetLoadTemperature(GetAdapterId<string>(bar), caseName, 1, val, "", replace);
}
}

/***************************************************/

public void SetLoad(BarDifferentialTemperatureLoad barDifferentialTemperatureLoad, bool replace)
{
int ret = 0;
string caseName = GetAdapterId<string>(barDifferentialTemperatureLoad.Loadcase);
DifferentialTemperatureLoadDirection loadDir= barDifferentialTemperatureLoad.LoadDirection;

foreach (Bar bar in barDifferentialTemperatureLoad.Objects.Elements)
{
Dictionary<double, double> tempProfile = barDifferentialTemperatureLoad.TemperatureProfile;
double tempMed = tempProfile.Average(kv => kv.Value);
double tempDelta = ((tempProfile[0] - tempMed) - (tempProfile[1] - tempMed));
GCRA101 marked this conversation as resolved.
Show resolved Hide resolved

if (tempMed != 0)
{ ret = m_model.FrameObj.SetLoadTemperature(GetAdapterId<string>(bar), caseName, 1, tempMed, "", replace); }

if (tempDelta != 0)
{ switch (loadDir) {
case DifferentialTemperatureLoadDirection.LocalY:
ret = m_model.FrameObj.SetLoadTemperature(GetAdapterId<string>(bar), caseName, 2, tempDelta, "", replace);
break;
case DifferentialTemperatureLoadDirection.LocalZ:
ret = m_model.FrameObj.SetLoadTemperature(GetAdapterId<string>(bar), caseName, 3, tempDelta, "", replace);
break;}
}
}
}




/***************************************************/

public void SetLoad(GravityLoad gravityLoad, bool replace)
Expand Down