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

ETABS_Toolkit: Set material design parameters during push #405

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 146 additions & 10 deletions Etabs_Adapter/CRUD/Create/Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
using BH.Engine.Adapters.ETABS;
using System.ComponentModel;
using System;
using BH.Engine.Base;

#if Debug16 || Release16
using ETABS2016;
Expand All @@ -55,20 +56,34 @@ public partial class ETABSAdapter : BHoMAdapter
private bool CreateObject(IMaterialFragment material)
{
bool success = true;
eMatType matType = eMatType.NoDesign;
int colour = 0;
eMatType matType = MaterialTypeToCSI(material.IMaterialType());
string bhName = material.DescriptionOrName();
int color = 0;
string guid = null;
string notes = "";
string name = "";
if (m_model.PropMaterial.GetMaterial(material.DescriptionOrName(), ref matType, ref colour, ref notes, ref guid) != 0)
{
m_model.PropMaterial.AddMaterial(ref name, MaterialTypeToCSI(material.IMaterialType()), "", "", "");
m_model.PropMaterial.ChangeName(name, material.DescriptionOrName());
ETABSId etabsId = new ETABSId();

Engine.Base.Compute.RecordNote("Materials are being created in ETABS, rather than using existing materials from the ETABS database. Some parameters may be based on program defaults. It is recommended to pre-load any standard materials and ensure that the name in BHoM matches.");

success &= SetObject(material);
// New method for creating a material. If Region, Standard, and Grade are provided verbatim, it will pick a DB material, otherwise (as written) it will use the default of the type.
if (m_model.PropMaterial.AddMaterial(ref name, matType, "", "", "", bhName) == 0)
{
etabsId.Id = name;
SetObject(material);
}
if (!success)
Engine.Base.Compute.RecordWarning($"Failed to assign material: {material.DescriptionOrName()}, ETABS may have overwritten some properties with default values");
// This deprecated method creates a new material based on the default of the type. Keeping it here for compatibility.
else if (m_model.PropMaterial.SetMaterial(bhName, matType, color, notes, guid) == 0)
{
etabsId.Id = bhName;
SetObject(material);
}
else
{
CreateElementError("Material", bhName);
}
SetAdapterId(material, etabsId);

return success;
}

Expand Down Expand Up @@ -103,7 +118,7 @@ private bool SetObject(IMaterialFragment material)
}
success &= m_model.PropMaterial.SetWeightAndMass(material.DescriptionOrName(), 2, material.Density) == 0;

SetAdapterId(material, material.Name);
success &= ISetDesignMaterial(material);

return success;
}
Expand Down Expand Up @@ -143,7 +158,128 @@ private eMatType MaterialTypeToCSI(MaterialType materialType)

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

private bool ISetDesignMaterial(IMaterialFragment material)
{
return SetDesignMaterial(material as dynamic);
}

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

private bool SetDesignMaterial(Concrete material)
{
bool success = true;

double fc = 0;
bool lw = IsLightweight(material); //run method to get the warning message
double fcsFactor = 0;
int sstype = 0;
int sshystype = 0;
double strainAtFc = 0;
double strainUltimate = 0;
double finalSlope = 0;
double frictionAngle = 0;
double dilationAngle = 0;

m_model.PropMaterial.GetOConcrete_1(
material.DescriptionOrName(),
ref fc,
ref lw,
ref fcsFactor,
ref sstype,
ref sshystype,
ref strainAtFc,
ref strainUltimate,
ref finalSlope,
ref frictionAngle,
ref dilationAngle
);

success &= (0 == m_model.PropMaterial.SetOConcrete_1(
material.DescriptionOrName(),
material.CylinderStrength,
lw,
fcsFactor,
sstype,
sshystype,
strainAtFc,
strainUltimate,
finalSlope,
frictionAngle,
dilationAngle
));

return success;
}

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

private bool SetDesignMaterial(Steel material)
{
bool success = true;

double fy = 0;
double fu = 0;
double Efy = 0;
double Efu = 0;
int sstype = 0;
int sshystype = 0;
double strainAtHardening = 0;
double strainAtMaxStress = 0;
double strainAtRupture = 0;
double finalSlope = 0;

m_model.PropMaterial.GetOSteel_1(
material.DescriptionOrName(),
ref fy,
ref fu,
ref fy,
ref fu,
ref sstype,
ref sshystype,
ref strainAtHardening,
ref strainAtMaxStress,
ref strainAtRupture,
ref finalSlope
);

success &= (0 == m_model.PropMaterial.SetOSteel_1(
material.DescriptionOrName(),
material.YieldStress,
material.UltimateStress,
Efy,
Efu,
sstype,
sshystype,
strainAtHardening,
strainAtMaxStress,
strainAtRupture,
finalSlope
));

return success;
}

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

private bool SetDesignMaterial(IMaterialFragment material)
{
Engine.Base.Compute.RecordWarning($"Could not set ETABS design parameters for material: {material.DescriptionOrName()}. Please set them manually in ETABS, or load the material from ETABS database prior to push.");
return true;
}

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

private bool IsLightweight(Concrete material)
JosefTaylor marked this conversation as resolved.
Show resolved Hide resolved
{
if (material.DescriptionOrName().Contains("LW") || material.Density < 2080)
{
Engine.Base.Compute.RecordWarning("This concrete appears to be a lightweight type based on the name or density. ETABS has settings which account for this in some codes, but they have not been set. User should check the material design properties.");
return true;
}
return false;
}

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

}
}
Expand Down
Loading