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

Align with changes in oM and Engine on Reflection -> Base #397

Merged
merged 2 commits into from
Jan 13, 2022
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
6 changes: 3 additions & 3 deletions ETABS_Engine/Compute/UpgradeVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using System.Threading.Tasks;
using BH.oM.Architecture.Elements;
using BH.oM.Geometry.SettingOut;
using BH.oM.Reflection.Attributes;
using BH.oM.Base.Attributes;

namespace BH.Engine.Adapters.ETABS
{
Expand All @@ -38,7 +38,7 @@ public static partial class Compute
/**** Public Methods ****/
/***************************************************/

[Deprecated("3.1", "BH.oM.Architecture.Elements.Level replaced by BH.oM.Geometry.SettingOut.Level")]
[ToBeRemoved("3.1", "BH.oM.Architecture.Elements.Level replaced by BH.oM.Geometry.SettingOut.Level")]
public static List<oM.Geometry.SettingOut.Level> UpgradeVersion(this List<BH.oM.Architecture.Elements.Level> levels)
{
List<oM.Geometry.SettingOut.Level> upgradedLevels = new List<oM.Geometry.SettingOut.Level>();
Expand All @@ -51,7 +51,7 @@ public static partial class Compute

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

[Deprecated("3.1", "BH.oM.Architecture.Elements.Level replaced by BH.oM.Geometry.SettingOut.Level")]
[ToBeRemoved("3.1", "BH.oM.Architecture.Elements.Level replaced by BH.oM.Geometry.SettingOut.Level")]
public static oM.Geometry.SettingOut.Level UpgradeVersion(this BH.oM.Architecture.Elements.Level level)
{
return new oM.Geometry.SettingOut.Level {
Expand Down
2 changes: 1 addition & 1 deletion ETABS_Engine/Create/Diaphragm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static Diaphragm Diaphragm(/*List<Panel> panels,*/ string name, Diaphragm

//if (zvals.Where(x => Math.Abs(zvals.First() - x) > BH.oM.Geometry.Tolerance.Distance).Count() > 0)
//{
// BH.Engine.Reflection.Compute.RecordError("All panels need to be in the same plane");
// BH.Engine.Base.Compute.RecordError("All panels need to be in the same plane");
// return null;
//}

Expand Down
6 changes: 3 additions & 3 deletions ETABS_Engine/Create/MassSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public static MassSource MassSource(bool elementSelfWeight, bool additionalMass,
{
if (caseFactors == null)
{
Engine.Reflection.Compute.RecordError("If cases are provided, please provide factors as well");
Engine.Base.Compute.RecordError("If cases are provided, please provide factors as well");
return null;
}

if (loadCases.Count != caseFactors.Count)
{
Engine.Reflection.Compute.RecordError("Please provide the same number of cases and case factors");
Engine.Base.Compute.RecordError("Please provide the same number of cases and case factors");
return null;
}

Expand All @@ -61,7 +61,7 @@ public static MassSource MassSource(bool elementSelfWeight, bool additionalMass,
}
else if (caseFactors != null)
{
Engine.Reflection.Compute.RecordError("If factors are provided, please provide cases as well");
Engine.Base.Compute.RecordError("If factors are provided, please provide cases as well");
return null;
}

Expand Down
19 changes: 10 additions & 9 deletions ETABS_Engine/ETABS_Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<Reference Include="Adapter_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Adapter_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Analytical_oM">
<SpecificVersion>False</SpecificVersion>
Expand All @@ -43,22 +44,27 @@
<Reference Include="Architecture_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Architecture_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM">
<HintPath>C:\ProgramData\BHoM\Assemblies\BHoM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\BHoM_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Data_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Data_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Dimensional_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Dimensional_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Geometry_Engine">
<SpecificVersion>False</SpecificVersion>
Expand All @@ -68,32 +74,27 @@
<Reference Include="Geometry_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Geometry_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Physical_oM">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\ProgramData\BHoM\Assemblies\Physical_oM.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Reflection_Engine">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\ProgramData\BHoM\Assemblies\Reflection_Engine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Reflection_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Reflection_oM.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Serialiser_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Serialiser_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Structure_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\Structure_Engine.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Structure_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Structure_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion ETABS_Engine/Modify/SetAutoLengthOffset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static Bar SetAutoLengthOffset(this Bar bar, bool autoLengthOffset, doubl
if (rigidZoneFactor < 0 || rigidZoneFactor > 1.0)
{
rigidZoneFactor = Math.Min(Math.Max(0, rigidZoneFactor), 1);
Engine.Reflection.Compute.RecordWarning("Rigid zone factor needs to be between 0 and 1. The value has been updated to fit in this interval");
Engine.Base.Compute.RecordWarning("Rigid zone factor needs to be between 0 and 1. The value has been updated to fit in this interval");
}

return (Bar)bar.AddFragment(new AutoLengthOffset { AutoOffset = autoLengthOffset, RigidZoneFactor = rigidZoneFactor }, true);
Expand Down
8 changes: 4 additions & 4 deletions ETABS_oM/ETABS_oM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@
<Reference Include="BHoM">
<HintPath>C:\ProgramData\BHoM\Assemblies\BHoM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Data_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Data_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Geometry_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Geometry_oM.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Reflection_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Reflection_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Structure_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Structure_oM.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion ETABS_oM/Settings/DataBaseSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using System.Text;
using System.Threading.Tasks;
using BH.oM.Base;
using BH.oM.Reflection.Attributes;
using BH.oM.Base.Attributes;
using System.ComponentModel;

namespace BH.oM.Adapters.ETABS
Expand Down
2 changes: 1 addition & 1 deletion ETABS_oM/Settings/EtabsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using System.Text;
using System.Threading.Tasks;
using BH.oM.Base;
using BH.oM.Reflection.Attributes;
using BH.oM.Base.Attributes;
using System.ComponentModel;

namespace BH.oM.Adapters.ETABS
Expand Down
18 changes: 9 additions & 9 deletions Etabs_Adapter/AdapterActions/Execute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using BH.Engine.Adapter;
using BH.oM.Adapters.ETABS;
using BH.oM.Adapter;
using BH.oM.Reflection;
using BH.oM.Base;
using BH.oM.Adapter.Commands;
using BH.oM.Structure.Loads;

Expand Down Expand Up @@ -98,7 +98,7 @@ public bool RunCommand(Open command)
}
else
{
Engine.Reflection.Compute.RecordError("File does not exist");
Engine.Base.Compute.RecordError("File does not exist");
return false;
}
}
Expand All @@ -115,7 +115,7 @@ public bool RunCommand(Analyse command)
public bool RunCommand(AnalyseLoadCases command)
{
if(command.LoadCases == null || command.LoadCases.Count() == 0)
Engine.Reflection.Compute.RecordNote("No cases provided, all cases will be run");
Engine.Base.Compute.RecordNote("No cases provided, all cases will be run");

return Analyse(command.LoadCases);
}
Expand All @@ -135,7 +135,7 @@ public bool RunCommand(Exit command)
{
if (m_app.SapModel.GetModelFilepath() == "(Untitled)")
{
Engine.Reflection.Compute.RecordError($"Application not exited. File does not have a name. Please manually save the file or use the {nameof(SaveAs)} command before trying to Exit the application. If you want to close the application anyway, please toggle {nameof(Exit.SaveBeforeClose)} to false.");
Engine.Base.Compute.RecordError($"Application not exited. File does not have a name. Please manually save the file or use the {nameof(SaveAs)} command before trying to Exit the application. If you want to close the application anyway, please toggle {nameof(Exit.SaveBeforeClose)} to false.");
return false;
}
}
Expand All @@ -150,7 +150,7 @@ public bool RunCommand(Exit command)

public bool RunCommand(IExecuteCommand command)
{
Engine.Reflection.Compute.RecordWarning($"The command {command.GetType().Name} is not supported by this Adapter.");
Engine.Base.Compute.RecordWarning($"The command {command.GetType().Name} is not supported by this Adapter.");
return false;
}

Expand All @@ -165,7 +165,7 @@ private bool Analyse(IEnumerable<object> cases = null)
//Check if the model has been saved
if (m_model.GetModelFilename(true) == "(Untitled)")
{
Engine.Reflection.Compute.RecordWarning("ETABS requires the model to be saved before being analysed. Please save the model and try running again.");
Engine.Base.Compute.RecordWarning("ETABS requires the model to be saved before being analysed. Please save the model and try running again.");
return false;
}

Expand All @@ -175,7 +175,7 @@ private bool Analyse(IEnumerable<object> cases = null)

if (!success)
{
Engine.Reflection.Compute.RecordWarning("Failed to set up cases to run. Model has not been analysed");
Engine.Base.Compute.RecordWarning("Failed to set up cases to run. Model has not been analysed");
return false;
}
}
Expand All @@ -196,7 +196,7 @@ private bool Analyse(IEnumerable<object> cases = null)
name = (item as ICase).Name;
else
{
Engine.Reflection.Compute.RecordWarning("Can not set up cases for running of type " + item.GetType().Name + ". Item " + item.ToString() + " will be ignored. Please provide case names or BHoM cases to be run");
Engine.Base.Compute.RecordWarning("Can not set up cases for running of type " + item.GetType().Name + ". Item " + item.ToString() + " will be ignored. Please provide case names or BHoM cases to be run");
continue;
}

Expand All @@ -205,7 +205,7 @@ private bool Analyse(IEnumerable<object> cases = null)

if (!caseSuccess)
{
Engine.Reflection.Compute.RecordWarning("Failed to set case " + name + "for running. Please check that the case exists in the model");
Engine.Base.Compute.RecordWarning("Failed to set case " + name + "for running. Please check that the case exists in the model");
}
}

Expand Down
4 changes: 2 additions & 2 deletions Etabs_Adapter/CRUD/Create/Bar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private bool CreateObject(Bar bhBar)
{
FlipEndPoints(bhBar); //CloneBeforePush means this is fine
FlipInsertionPoint(bhBar); //ETABS specific operation
Engine.Reflection.Compute.RecordNote("Some bars has been flipped to comply with ETABS API, asymmetric sections will suffer");
Engine.Base.Compute.RecordNote("Some bars has been flipped to comply with ETABS API, asymmetric sections will suffer");
}

#endif
Expand All @@ -83,7 +83,7 @@ private bool CreateObject(Bar bhBar)

if (string.IsNullOrEmpty(stNodeId) || string.IsNullOrEmpty(endNodeId))
{
Engine.Reflection.Compute.RecordError("Could not find the ids for at least one end node for at least one Bar. Bar not created.");
Engine.Base.Compute.RecordError("Could not find the ids for at least one end node for at least one Bar. Bar not created.");
return false;
}

Expand Down
22 changes: 11 additions & 11 deletions Etabs_Adapter/CRUD/Create/Error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,29 @@ public partial class ETABS2016Adapter : BHoMAdapter

private bool CheckPropertyWarning<T, P>(T obj, Func<T, P> selector, bool couldNotBeCreated = false)
{
return CheckPropertyEvent(obj, selector, couldNotBeCreated, oM.Reflection.Debugging.EventType.Warning);
return CheckPropertyEvent(obj, selector, couldNotBeCreated, oM.Base.Debugging.EventType.Warning);
}

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

private bool CheckPropertyError<T, P>(T obj, Func<T, P> selector, bool couldNotBeCreated = false)
{
return CheckPropertyEvent(obj, selector, couldNotBeCreated, oM.Reflection.Debugging.EventType.Error);
return CheckPropertyEvent(obj, selector, couldNotBeCreated, oM.Base.Debugging.EventType.Error);
}

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

private bool CheckPropertyEvent<T, P>(T obj, Func<T, P> selector, bool couldNotBeCreated = false, BH.oM.Reflection.Debugging.EventType errorLevel = oM.Reflection.Debugging.EventType.Error)
private bool CheckPropertyEvent<T, P>(T obj, Func<T, P> selector, bool couldNotBeCreated = false, BH.oM.Base.Debugging.EventType errorLevel = oM.Base.Debugging.EventType.Error)
{
if (obj == null || selector == null)
return false;

if (selector(obj) == null)
{
if(couldNotBeCreated)
Engine.Reflection.Compute.RecordEvent($"An object of type {obj.GetType().Name} could not be created due to a property of type {typeof(P).Name} being null. Please check your input data!", errorLevel);
Engine.Base.Compute.RecordEvent($"An object of type {obj.GetType().Name} could not be created due to a property of type {typeof(P).Name} being null. Please check your input data!", errorLevel);
else
Engine.Reflection.Compute.RecordEvent($"A property of type {typeof(P).Name} on an object of type {obj.GetType().Name} is null and could not be set.", errorLevel);
Engine.Base.Compute.RecordEvent($"A property of type {typeof(P).Name} on an object of type {obj.GetType().Name} is null and could not be set.", errorLevel);

return false;
}
Expand All @@ -80,35 +80,35 @@ private bool CheckPropertyEvent<T, P>(T obj, Func<T, P> selector, bool couldNotB

private void CreateElementError(string elemType, string elemName)
{
Engine.Reflection.Compute.RecordError("Failed to create the element of type " + elemType + ", with id: " + elemName);
Engine.Base.Compute.RecordError("Failed to create the element of type " + elemType + ", with id: " + elemName);
}

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

private void CreatePropertyError(string failedProperty, string elemType, string elemName)
{
CreatePropertyEvent(failedProperty, elemType, elemName, oM.Reflection.Debugging.EventType.Error);
CreatePropertyEvent(failedProperty, elemType, elemName, oM.Base.Debugging.EventType.Error);
}

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

private void CreatePropertyWarning(string failedProperty, string elemType, string elemName)
{
CreatePropertyEvent(failedProperty, elemType, elemName, oM.Reflection.Debugging.EventType.Warning);
CreatePropertyEvent(failedProperty, elemType, elemName, oM.Base.Debugging.EventType.Warning);
}

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

private void CreatePropertyEvent(string failedProperty, string elemType, string elemName, oM.Reflection.Debugging.EventType eventType)
private void CreatePropertyEvent(string failedProperty, string elemType, string elemName, oM.Base.Debugging.EventType eventType)
{
Engine.Reflection.Compute.RecordEvent("Failed to set property " + failedProperty + " for the " + elemType + "with id: " + elemName, eventType);
Engine.Base.Compute.RecordEvent("Failed to set property " + failedProperty + " for the " + elemType + "with id: " + elemName, eventType);
}

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

private static void RecordFlippingError(string sectionName)
{
BH.Engine.Reflection.Compute.RecordWarning("Section with name " + sectionName + "has a flipping boolean. This is not currently supported in the ETABS_Toolkit. The section will be set to etabs unflipped");
BH.Engine.Base.Compute.RecordWarning("Section with name " + sectionName + "has a flipping boolean. This is not currently supported in the ETABS_Toolkit. The section will be set to etabs unflipped");
}

/***************************************************/
Expand Down
Loading