Skip to content

Commit

Permalink
🚧 icons and override ToString()
Browse files Browse the repository at this point in the history
  • Loading branch information
lorinczandrea committed Oct 3, 2024
1 parent ea20fb0 commit 877d2d9
Show file tree
Hide file tree
Showing 24 changed files with 181 additions and 70 deletions.
5 changes: 4 additions & 1 deletion FemDesign.Core/Bars/Bar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ public override string ToString()
{
if (this.BarPart.HasComplexCompositeRef)
{
return $"{this.Type} Start: {this.BarPart.Edge.Points.First()}, End: {this.BarPart.Edge.Points.Last()}, Length: {this.BarPart.Edge.Length} m, Sections: Composite section type, Material: Composite";
var compositeSection = this.BarPart.ComplexCompositeObj.CompositeSections[0];
List<string> compositeMaterials = compositeSection.Materials.Select(m => m.Name).ToList();

return $"{this.Type} Start: {this.BarPart.Edge.Points.First()}, End: {this.BarPart.Edge.Points.Last()}, Length: {this.BarPart.Edge.Length} m, Section: Composite - {compositeSection.Type}, Materials: {string.Join(", ", compositeMaterials)}";
}
if (this.BarPart.HasDeltaBeamComplexSectionRef)
{
Expand Down
35 changes: 20 additions & 15 deletions FemDesign.Core/Composites/CompositeSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ internal CompositeSection(CompositeSectionType type, List<Material> materials, L
}

/// <summary>
/// Create a EffectiveCompositeSlab type CompositeSection object.
/// Create an EffectiveCompositeSlab type CompositeSection object.
/// </summary>
/// <param name="steel">Steel part material.</param>
/// <param name="concrete">Concrete part material.</param>
/// <param name="steelProfile">Steel section from database. Can be a KKR, VKR or I-profile section type.</param>
/// <param name="name">Composite section name.</param>
/// <param name="t">Slab thickness.</param>
/// <param name="bEff">Concrete slab effective width.</param>
/// <param name="th">Hunch thickness.</param>
/// <param name="bt">Hunch width at the top.</param>
/// <param name="bb">Hunch width at the bottom.</param>
/// <param name="t">Slab thickness [mm].</param>
/// <param name="bEff">Concrete slab effective width [mm].</param>
/// <param name="th">Hunch thickness [mm].</param>
/// <param name="bt">Hunch width at the top [mm].</param>
/// <param name="bb">Hunch width at the bottom [mm].</param>
/// <param name="filled">True if steel section is filled with concrete, false if not.</param>
/// <returns></returns>
public static CompositeSection EffectiveCompositeSlab(string name, Material steel, Material concrete, Section steelProfile, double t, double bEff, double th, double bt, double bb, bool filled = false)
Expand Down Expand Up @@ -188,11 +188,11 @@ public static CompositeSection EffectiveCompositeSlab(string name, Material stee
/// Create a parametric section for EffectiveCompositeSlab type CompositeSection object.
/// </summary>
/// <param name="steelProfile">Steel section from database. Can be a KKR, VKR or I-profile section type.</param>
/// <param name="t">Slab thickness.</param>
/// <param name="bEff">Concrete slab effective width.</param>
/// <param name="th">Hunch thickness.</param>
/// <param name="bt">Hunch width at the top.</param>
/// <param name="bb">Hunch width at the bottom.</param>
/// <param name="t">Slab thickness [mm].</param>
/// <param name="bEff">Concrete slab effective width [mm].</param>
/// <param name="th">Hunch thickness [mm].</param>
/// <param name="bt">Hunch width at the top [mm].</param>
/// <param name="bb">Hunch width at the bottom [mm].</param>
/// <param name="filled">True if steel section is filled with concrete, false if not.</param>
/// <returns></returns>
internal static List<Sections.Section> CreateEffectiveCompositeSlabSection(Section steelProfile, double t, double bEff, double th, double bt, double bb, bool filled = false)
Expand Down Expand Up @@ -445,7 +445,6 @@ public static CompositeSection FilledHSQProfile(string name, Material steel, Mat
/// <returns></returns>
public static CompositeSection FilledDeltaBeamProfile(string name, Material steel, Material concrete, Section deltaBeamProfile)
{
NotImplemented();
CheckMaterialFamily(new List<Material> { steel }, concrete);

// check input data
Expand Down Expand Up @@ -501,7 +500,7 @@ private static List<Edge> GetDeltaBeamSideEdges(List<Region> deltaBeamSteelRegio
throw new ArgumentException("Invalid input section! The input section must be a Deltabeam profile and the number of regions must be 4!");

topPtsY = 0;
List<Edge> sideEdges = null;
List<Edge> sideEdges = new List<Edge>();

foreach (var region in deltaBeamSteelRegions)
{
Expand All @@ -515,7 +514,7 @@ private static List<Edge> GetDeltaBeamSideEdges(List<Region> deltaBeamSteelRegio
{
topPtsY = points.Select(p => p.Y).Min();
}
else if (topPts.Count != points.Count && topPts != null)
else if (topPts.Count != points.Count && topPts.Count != 0)
{
var edges = region.Contours[0].Edges;
var interiorEdg = edges.OrderBy(e => ((Vector3d)e.GetIntermediatePoint(0.5)).Length()).First();
Expand All @@ -524,7 +523,7 @@ private static List<Edge> GetDeltaBeamSideEdges(List<Region> deltaBeamSteelRegio
}
}

if (sideEdges is null || topPtsY == 0)
if (sideEdges?.Count == 0 || topPtsY == 0)
throw new Exception("Invalid section geometry! Deltabeam section origin must be (0,0,0)!");

return sideEdges;
Expand Down Expand Up @@ -1205,5 +1204,11 @@ internal void CheckCompositeSectionPartList(CompositeSectionType type, List<Comp

return sections;
}

public override string ToString()
{
List<string> parameters = ParameterDictionary.Select(d => d.Key + " = " + d.Value).ToList();
return $"{Type}, Materials: {string.Join(", ", this.Materials.Select(m => m.Name).ToList())}, Parameters: {string.Join(", ", parameters)}";
}
}
}
9 changes: 9 additions & 0 deletions FemDesign.Grasshopper/FemDesign.Grasshopper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -939,16 +939,22 @@
<Content Include="Resources\icons\CombDefine2.png" />
<Content Include="Resources\icons\CombDefine3.png" />
<None Include="Resources\icons\Config.png" />
<None Include="Resources\icons\DeltaBeamProfile.png" />
<Content Include="Resources\icons\Diaphragm.bmp" />
<Content Include="Resources\icons\DiaphragmDeconstruct.bmp" />
<None Include="Resources\icons\EffectiveCompositeSlab.png" />
<Content Include="Resources\icons\ExcitationForceSettings.png" />
<Content Include="Resources\icons\Fd_TabIcon_24_24.png" />
<None Include="Resources\icons\FilledCruciformProfile.png" />
<None Include="Resources\icons\FilledIProfile.png" />
<None Include="Resources\icons\FilledSteelTube.png" />
<Content Include="Resources\icons\FootfallDefine2.png" />
<Content Include="Resources\icons\FootfallDefine3.png" />
<Content Include="Resources\icons\FreqDefine2.png" />
<Content Include="Resources\icons\FreqDefine3.png" />
<Content Include="Resources\icons\GroundAccelerationDefine2.png" />
<Content Include="Resources\icons\GroundAccelerationDefine3.png" />
<None Include="Resources\icons\HSQProfile.png" />
<Content Include="Resources\icons\ImperfectionDefine2.png" />
<Content Include="Resources\icons\ImperfectionDefine3.png" />
<Content Include="Resources\icons\LabelledSection.png" />
Expand All @@ -957,10 +963,13 @@
<Content Include="Resources\icons\PeriodicExcitationDefine2.png" />
<Content Include="Resources\icons\PeriodicExcitationDefine3.png" />
<None Include="Resources\icons\PeriodicExcitationLoad.png" />
<None Include="Resources\icons\RHSProfile.png" />
<Content Include="Resources\icons\StabilityDefine2.png" />
<Content Include="Resources\icons\StabilityDefine3.png" />
<Content Include="Resources\icons\StageDefine2.png" />
<Content Include="Resources\icons\StageDefine3.png" />
<None Include="Resources\icons\SteelTubeWithIProfile.png" />
<None Include="Resources\icons\SteelTubeWithSteelCore.png" />
<Content Include="Resources\icons\StiffnessMatrix4Type.bmp" />
<None Include="Resources\icons\ExcitationForceDiagram.png" />
<None Include="Resources\icons\ExcitationForceCombination.png" />
Expand Down
90 changes: 90 additions & 0 deletions FemDesign.Grasshopper/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions FemDesign.Grasshopper/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -7389,4 +7389,31 @@
<data name="PeriodicExcitationLoad" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\PeriodicExcitationLoad.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DeltaBeamProfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\DeltaBeamProfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="EffectiveCompositeSlab" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\EffectiveCompositeSlab.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FilledCruciformProfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\FilledCruciformProfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FilledIProfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\FilledIProfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FilledSteelTube" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\FilledSteelTube.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="HSQProfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\HSQProfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="RHSProfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\RHSProfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SteelTubeWithIProfile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\SteelTubeWithIProfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SteelTubeWithSteelCore" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons\SteelTubeWithSteelCore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FemDesign.Grasshopper/Resources/icons/HSQProfile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FemDesign.Grasshopper/Resources/icons/RHSProfile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
using FemDesign.Grasshopper.Extension.ComponentExtension;
using FemDesign.Loads;
using Grasshopper.Kernel.Special;
using Eto.Drawing;

namespace FemDesign.Grasshopper
{
public class CompositeSectionDefine : GH_SwitcherComponent
{
private List<SubComponent> _subcomponents = new List<SubComponent>();
public override string UnitMenuName => "CompositeSection.Define";
protected override string DefaultEvaluationUnit => _subcomponents[2].name();
public override string UnitMenuName => "Section";
protected override string DefaultEvaluationUnit => _subcomponents[1].name();
public override Guid ComponentGuid => new Guid("{A6B804EA-F254-4ABE-BEC5-FA69E92069AA}");
public override GH_Exposure Exposure => GH_Exposure.tertiary;

protected override Bitmap Icon => null;
protected override System.Drawing.Bitmap Icon => Properties.Resources.HSQProfile;

public CompositeSectionDefine()
: base("CompositeSection.Define", "Define",
: base("Composite.Define", "Define",
"Define a new composite section.",
CategoryName.Name(), SubCategoryName.Cat4b())
{
Expand Down Expand Up @@ -77,6 +77,7 @@ protected override void SolveInstance(IGH_DataAccess DA, EvaluationUnit unit)
{
return;
}

foreach (SubComponent item in _subcomponents)
{
if (unit.Name.Equals(item.name()))
Expand Down
10 changes: 4 additions & 6 deletions FemDesign.Grasshopper/Sections/Composite/DeltaBeamProfile.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
using System;
using System.Collections.Generic;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using Grasshopper.Kernel.Types;
using FemDesign.Grasshopper.Components.UIWidgets;

using System.Linq;

namespace FemDesign.Grasshopper
{
public class DeltaBeamProfile : SubComponent
{
public System.Drawing.Bitmap Icon => Properties.Resources.DeltaBeamProfile;
public override string name() => "DeltaBeamProfile";
public override string display_name() => "DeltaBeamProfile";

public override void registerEvaluationUnits(EvaluationUnitManager mngr)
{
EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Create a composite section for Deltabeam sections. For more information, see FEM-Design GUI.");
EvaluationUnit evaluationUnit = new EvaluationUnit(name(), display_name(), "Create a composite section for Deltabeam sections. For more information, see FEM-Design GUI.", this.Icon);
mngr.RegisterUnit(evaluationUnit);

evaluationUnit.RegisterInputParam(new Param_String(), "SectionName", "SectionName", "Composite section name.", GH_ParamAccess.item);
evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true;

evaluationUnit.RegisterInputParam(new Param_GenericObject(), "Steel", "Steel", "Steel material.", GH_ParamAccess.item);
evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true;

evaluationUnit.RegisterInputParam(new Param_GenericObject(), "Concrete", "Concrete", "Concrete material.", GH_ParamAccess.item);
evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true;

evaluationUnit.RegisterInputParam(new Param_GenericObject(), "DeltaBeamProfile", "DeltaBeamProfile", "Steel DeltaBeam profile. Can be 'D' or 'DR' section family types.", GH_ParamAccess.item);
evaluationUnit.Inputs[evaluationUnit.Inputs.Count - 1].Parameter.Optional = true;
}

public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level)
Expand Down
Loading

0 comments on commit 877d2d9

Please sign in to comment.