diff --git a/FemDesign.Core/Bars/BarPart.cs b/FemDesign.Core/Bars/BarPart.cs index 913519881..8307a1adc 100644 --- a/FemDesign.Core/Bars/BarPart.cs +++ b/FemDesign.Core/Bars/BarPart.cs @@ -507,6 +507,8 @@ public BarPart(Geometry.Edge edge, BarType type, Materials.Material material, Se this.EccentricityCalc = true; this.Identifier = identifier; } + + this.CheckMaterialAndSectionType(); } /// @@ -529,6 +531,8 @@ public BarPart(Geometry.Edge edge, BarType type, Materials.Material material, Se this.EccentricityCalc = true; this.Identifier = identifier; } + + this.CheckMaterialAndSectionType(); } /// @@ -551,6 +555,8 @@ public BarPart(Geometry.Edge edge, BarType type, Materials.Material material, Se this.EccentricityCalc = true; this.Identifier = identifier; } + + this.CheckMaterialAndSectionType(); } /// @@ -573,6 +579,8 @@ public BarPart(Geometry.Edge edge, BarType type, Materials.Material material, Se this.EccentricityCalc = true; this.Identifier = identifier; } + + this.CheckMaterialAndSectionType(); } /// @@ -595,6 +603,8 @@ public BarPart(Geometry.Edge edge, BarType type, Materials.Material material, Se this.EccentricityCalc = true; this.Identifier = identifier; } + + this.CheckMaterialAndSectionType(); } /// @@ -615,6 +625,8 @@ public BarPart(Geometry.Edge edge, BarType type, Materials.Material material, Se this.TrussUniformSectionObj = section; this.Identifier = identifier; } + + this.CheckMaterialAndSectionType(); } /// @@ -626,5 +638,50 @@ public void OrientCoordinateSystemToGCS() cs.AlignYAroundXToGcs(); this.Plane = cs; } + + /// + /// This method checks if the material type of a bar is consistent with the materials used in its sections.

+ /// If the bar's material is custom, the check is skipped. + ///
+ /// Thrown when the material type of the bar does not match the material type of any section. + private void CheckMaterialAndSectionType() + { + // get BarPart's material + var material = this.ComplexMaterialObj.Family; + + // section type check for custom material is unneccessary + if (material == Materials.Family.Custom) + return; + + + // get BarPart's sections materials + List secMats = null; + if (this.ComplexSectionObj != null) // if it is not a composite bar + { + secMats = this.ComplexSectionObj.Sections.Select(s => s.MaterialFamily).ToList(); + } + else if (this.TrussUniformSectionObj != null) // if it is a truss + { + secMats = new List { this.TrussUniformSectionObj.MaterialFamily }; + } + + // check section material type + if(secMats != null) + { + foreach(var item in secMats) + { + string mat; + if (item == "Custom") + continue; + if (item == "Hollow") + mat = "Concrete"; + else + mat = item; + + if (mat != material.ToString()) + throw new ArgumentException($"Material Family ({material}) must be the same as the Section MaterialFamily ({mat})!"); + } + } + } } } \ No newline at end of file diff --git a/FemDesign.Core/Calculate/Analysis.cs b/FemDesign.Core/Calculate/Analysis.cs index 18955b5ac..c4724f36f 100644 --- a/FemDesign.Core/Calculate/Analysis.cs +++ b/FemDesign.Core/Calculate/Analysis.cs @@ -510,6 +510,13 @@ public void SetCombAnalysis(FemDesignConnection connection) // ordered load combinations in the model var loadCombination = connection.GetLoadCombinations(); + var nullCombItems = this.Comb.CombItem.Where(x => x.CombName == null).Count(); + var namedCombItems = this.Comb.CombItem.Where(x => x.CombName != null).Count(); + + if(nullCombItems != 0 && namedCombItems != 0) + throw new Exception("CombItem in Analysis contains both named and unnamed CombItems. This is not allowed."); + + _setCombAnalysis(loadCombination.Values.ToList()); } diff --git a/FemDesign.Core/Calculate/CombItem.cs b/FemDesign.Core/Calculate/CombItem.cs index c9c89248c..f5308b201 100644 --- a/FemDesign.Core/Calculate/CombItem.cs +++ b/FemDesign.Core/Calculate/CombItem.cs @@ -36,23 +36,11 @@ public bool Calc } } - /// - /// Write only property. If true, no calculations will be executed for load combinations. - /// - [XmlIgnore] - public bool NoCalc - { - set - { - Calc = !value; - } - } - [XmlAttribute("NLE")] public int _nle { get; set; } /// - /// Consider elastic nonlinear behaviour of structural elements. + /// Consider elastic nonlinear behaviour of structural elements. If false, 'NLE' must be false. /// [XmlIgnore] public bool NLE @@ -69,12 +57,11 @@ public bool NLE } } - [XmlAttribute("PL")] public int _pl { get; set; } /// - /// Consider plastic behaviour of structural elements. + /// Consider plastic behaviour of structural elements. If true, 'NLE' must be true. /// [XmlIgnore] public bool PL @@ -90,7 +77,6 @@ public bool PL } } - [XmlAttribute("NLS")] public int _nls { get; set; } @@ -108,7 +94,7 @@ public bool NLS public int _cr { get; set; } /// - /// Cracked section analysis. Note that Cr only executes properly in RCDesign with DesignCheck set to true. + /// Cracked section analysis. If true, 'PL' must be false. Note that Cr only executes properly in RCDesign with DesignCheck set to true. /// [XmlIgnore] public bool Cr @@ -124,21 +110,26 @@ public bool Cr } } - [XmlAttribute("f2nd")] public int _f2nd { get; set; } /// - /// 2nd order analysis. + /// 2nd order analysis. If true, 'PL' must be false. /// [XmlIgnore] public bool f2nd { - get { return Convert.ToBoolean(_f2nd); } - set { _f2nd = Convert.ToInt32(value); } + get + { + return Convert.ToBoolean(_f2nd); + } + set + { + _f2nd = Convert.ToInt32(value); + if (value) PL = false; + } } - [XmlAttribute("Im")] public int Im { get; set; } diff --git a/FemDesign.Core/FemDesign.Core.sln b/FemDesign.Core/FemDesign.Core.sln new file mode 100644 index 000000000..49f0262e7 --- /dev/null +++ b/FemDesign.Core/FemDesign.Core.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FemDesign.Core", "FemDesign.Core.csproj", "{2FEEBF30-2D04-4EA3-BEE9-5A25466AC396}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2FEEBF30-2D04-4EA3-BEE9-5A25466AC396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FEEBF30-2D04-4EA3-BEE9-5A25466AC396}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FEEBF30-2D04-4EA3-BEE9-5A25466AC396}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FEEBF30-2D04-4EA3-BEE9-5A25466AC396}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {21F6B73C-23CA-4DD5-B61A-CA07CFADE079} + EndGlobalSection +EndGlobal diff --git a/FemDesign.Core/FemDesignConnection.cs b/FemDesign.Core/FemDesignConnection.cs index e99d37edd..ec88925b7 100644 --- a/FemDesign.Core/FemDesignConnection.cs +++ b/FemDesign.Core/FemDesignConnection.cs @@ -332,7 +332,10 @@ public void RunAnalysis(Analysis analysis) if (analysis.Comb != null) { - analysis.SetCombAnalysis(this); + if(analysis.Comb.CombItem.Any(CombItem => CombItem.CombName != null) || analysis.Comb.CombItem.Count() == 0) + { + analysis.SetCombAnalysis(this); + } script = new FdScript( logfile, new CmdUser(CmdUserModule.RESMODE), @@ -739,9 +742,8 @@ public List GetResultsOnPoints(List resultPoints, Results. /// /// /// - public string GetResultsFromBsc(string inputBscPath, string outputCsvPath = null) + public List GetResultsFromBsc(string inputBscPath, string outputCsvPath = null) { - // Check input if (outputCsvPath == null) { @@ -754,7 +756,7 @@ public string GetResultsFromBsc(string inputBscPath, string outputCsvPath = null _listResultsByFdScript("GetResultsFromBsc", new List { inputBscPath }, new List { outputCsvPath }); // Read results - var results = System.IO.File.ReadAllText(outputCsvPath, System.Text.Encoding.UTF8).Replace("\t", ","); + var results = System.IO.File.ReadAllLines(outputCsvPath, System.Text.Encoding.UTF8).Select(x => x.Replace("\t", ",")).ToList(); return results; } diff --git a/FemDesign.Core/GenericClasses/RestrictedDouble.cs b/FemDesign.Core/GenericClasses/RestrictedDouble.cs index ab3d17baf..13e7dcaa3 100644 --- a/FemDesign.Core/GenericClasses/RestrictedDouble.cs +++ b/FemDesign.Core/GenericClasses/RestrictedDouble.cs @@ -167,6 +167,14 @@ internal static double NonNegMax_1e5(double val) return RestrictedDouble.ValueInClosedInterval(val, 0, 1E5); } + /// + /// non_neg_max_1e7 + /// + internal static double NonNegMax_1e7(double val) + { + return RestrictedDouble.ValueInClosedInterval(val, 0, 1E7); + } + /// /// non_neg_max_1e10 /// @@ -183,6 +191,14 @@ internal static double NonNegMax_1e15(double val) return RestrictedDouble.ValueInClosedInterval(val, 0, 1E15); } + /// + /// Checks if the value is a positive, non-zero number that is no greater than 1e15. + /// + internal static double NonZeroMax_1e15(double val) + { + return RestrictedDouble.ValueInClosedInterval(val, 1E-5, 1E15); + } + /// /// non_neg_max_1e20 /// @@ -191,6 +207,14 @@ internal static double NonNegMax_1e20(double val) return RestrictedDouble.ValueInClosedInterval(val, 0, 1E20); } + /// + /// Checks if the value is a positive, non-zero number that is no greater than 1e15. + /// + internal static double NonZeroMax_1e20(double val) + { + return RestrictedDouble.ValueInClosedInterval(val, 1E-5, 1E20); + } + /// /// non_neg_max_1e30 /// diff --git a/FemDesign.Core/Geometry/Region.cs b/FemDesign.Core/Geometry/Region.cs index 36f2d884b..bfd9b5981 100644 --- a/FemDesign.Core/Geometry/Region.cs +++ b/FemDesign.Core/Geometry/Region.cs @@ -226,6 +226,7 @@ public void SetEdgeConnection(Shells.EdgeConnection edgeConnection, int index) Shells.EdgeConnection ec = Shells.EdgeConnection.CopyExisting(edgeConnection, name); edge.EdgeConnection = ec; + edge.EdgeConnection.Normal = this.LocalZ; } return; } @@ -260,8 +261,7 @@ public void SetEdgeConnections(Shells.EdgeConnection edgeConnection) string name = "CE." + cInstance.ToString(); Shells.EdgeConnection ec = Shells.EdgeConnection.CopyExisting(edgeConnection, name); edge.EdgeConnection = ec; - // edge connection Normal are opposite to the normal of the contour - edge.EdgeConnection.Normal = this.LocalZ.Reverse(); + edge.EdgeConnection.Normal = this.LocalZ; } } else @@ -276,6 +276,27 @@ public void SetEdgeConnections(Shells.EdgeConnection edgeConnection) } } + public void SetEdgeConnections(List edgeConnections) + { + if (edgeConnections?.Count == 0) + { + // pass; keep edges as before + } + else if (edgeConnections.Count == 1) + { + this.SetEdgeConnections(edgeConnections[0]); + } + else if (edgeConnections.Count == this.GetEdgeConnections().Count) + { + for (int i = 0; i < edgeConnections.Count; i++) + this.SetEdgeConnection(edgeConnections[i], i); + } + else + { + throw new ArgumentException($"The number of edge connections must be 1 or equal to the number of surface edges!"); + } + } + /// /// Get all EdgeConnection from all Edges in Region. /// @@ -290,7 +311,7 @@ public void SetEdgeConnections(Shells.EdgeConnection edgeConnection) if(edgeConnection != null) { edgeConnection.Edge = edge; - edgeConnection.Normal = this.LocalZ.Reverse(); + edgeConnection.Normal = this.LocalZ; } edgeConnections.Add(edgeConnection); } diff --git a/FemDesign.Core/Model/CountryEnum.cs b/FemDesign.Core/Model/CountryEnum.cs index ac8f2b7ea..2170042c1 100644 --- a/FemDesign.Core/Model/CountryEnum.cs +++ b/FemDesign.Core/Model/CountryEnum.cs @@ -13,6 +13,13 @@ namespace FemDesign ///
public enum Country { + /// + /// Belgian annex + /// + [Parseable("B", "b", "belgium", "Belgium", "belgian", "Belgian")] + [XmlEnum("B")] + B, + /// /// Unspecified/Common annex /// @@ -23,55 +30,63 @@ public enum Country /// /// German annex /// - [Parseable("D", "d", "germany", "Germany")] + [Parseable("D", "d", "germany", "Germany", "german", "German")] [XmlEnum("D")] D, /// /// Danish annex /// - [Parseable("DK", "dk", "denmark", "Denmark")] + [Parseable("DK", "dk", "denmark", "Denmark", "danish", "Danish")] [XmlEnum("DK")] DK, + /// + /// Spanish annex + /// + [Parseable("E", "e", "spain", "Spain", "spanish", "Spanish")] + [XmlEnum("E")] + E, + /// /// Estonian annex /// - [Parseable("EST", "est", "estonia", "Estonia")] + [Parseable("EST", "est", "estonia", "Estonia", "estonian", "Estonian")] [XmlEnum("EST")] EST, + /// /// Finnish annex /// - [Parseable("FIN", "fin", "finland", "Finland")] + [Parseable("FIN", "fin", "finland", "Finland", "finnish", "Finnish")] [XmlEnum("FIN")] FIN, /// - /// Brittish annex + /// British annex /// - [Parseable("GB", "gb", "brittish", "Brittish", "great britain", "Great Britain")] + [Parseable("GB", "gb", "british", "British", "great britain", "Great Britain")] [XmlEnum("GB")] GB, /// /// Hungarian annex /// - [Parseable("H", "h", "hungary", "Hungary")] + [Parseable("H", "h", "hungary", "Hungary", "hungarian", "Hungarian")] [XmlEnum("H")] H, /// /// Latvian annex /// - [Parseable("LT", "lt", "lithuania", "Lithuania")] + [Parseable("LT", "lt", "latvia", "Latvia", "latvian", "Latvian")] [XmlEnum("LT")] LT, /// /// Norwegian annex /// - [Parseable("N", "n", "norway", "Norway")] + [Parseable("N", "n", "norway", "Norway", "norwegian", "Norwegian")] [XmlEnum("N")] N, @@ -85,25 +100,29 @@ public enum Country /// /// Polish annex /// - [Parseable("PL", "pl", "poland", "Poland")] + [Parseable("PL", "pl", "poland", "Poland", "polish", "Polish")] [XmlEnum("PL")] PL, /// /// Romanian annex /// - [Parseable("RO", "ro", "romania", "Romania")] + [Parseable("RO", "ro", "romania", "Romania", "romanian", "Romanian")] [XmlEnum("RO")] RO, + /// /// Swedish annex /// - [Parseable("S", "s", "SE", "sweden", "Sweden", "😎")] + [Parseable("S", "s", "SE", "sweden", "Sweden", "swedish", "Swedish", "😎")] [XmlEnum("S")] S, /// - /// Turkish annex + /// Turkish annex. + ///

+ ///

+ /// Note: the TR (Turkish) national annex is no longer supported by FEM-Design. ///
[Parseable("TR", "tr", "turkey", "Turkey")] [XmlEnum("TR")] diff --git a/FemDesign.Core/Model/Model.cs b/FemDesign.Core/Model/Model.cs index dffbae1e2..2150c8aab 100644 --- a/FemDesign.Core/Model/Model.cs +++ b/FemDesign.Core/Model/Model.cs @@ -2760,7 +2760,7 @@ private void AddLineSupport(Supports.LineSupport obj, bool overwrite) this.Entities.Supports.LineSupport.Add(obj); // add lib item - if (obj.Group.PredefRigidity != null) + if (obj.Group?.PredefRigidity != null) { this.AddLineSupportGroupLibItem(obj.Group.PredefRigidity, overwrite); } diff --git a/FemDesign.Core/ModellingTools/FictitiousBar.cs b/FemDesign.Core/ModellingTools/FictitiousBar.cs index 04581d12a..16450f28d 100644 --- a/FemDesign.Core/ModellingTools/FictitiousBar.cs +++ b/FemDesign.Core/ModellingTools/FictitiousBar.cs @@ -129,7 +129,7 @@ public double AE } set { - this._ae = RestrictedDouble.Positive(value); + this._ae = RestrictedDouble.NonZeroMax_1e15(value); } } @@ -145,7 +145,7 @@ public double ItG } set { - this._itg = RestrictedDouble.Positive(value); + this._itg = RestrictedDouble.NonZeroMax_1e15(value); } } @@ -161,7 +161,7 @@ public double I1E } set { - this._i1e = RestrictedDouble.Positive(value); + this._i1e = RestrictedDouble.NonZeroMax_1e15(value); } } @@ -177,7 +177,7 @@ public double I2E } set { - this._i2e = RestrictedDouble.Positive(value); + this._i2e = RestrictedDouble.NonZeroMax_1e15(value); } } diff --git a/FemDesign.Core/ModellingTools/FictitiousShell.cs b/FemDesign.Core/ModellingTools/FictitiousShell.cs index 5126147eb..3c2cffdbd 100644 --- a/FemDesign.Core/ModellingTools/FictitiousShell.cs +++ b/FemDesign.Core/ModellingTools/FictitiousShell.cs @@ -165,7 +165,7 @@ public double T1 } set { - this._t1 = RestrictedDouble.NonNegMax_1e20(value); + this._t1 = RestrictedDouble.NonZeroMax_1e20(value); } } @@ -183,7 +183,7 @@ public double T2 } set { - this._t2 = RestrictedDouble.NonNegMax_1e20(value); + this._t2 = RestrictedDouble.NonZeroMax_1e20(value); } } @@ -319,7 +319,28 @@ public static FictitiousShell UpdateEdgeConnection(FictitiousShell fictShell, Sh // return clone; - } + } + + /// + /// Set EdgeConnections by indices. + /// + /// FictitiousShell. + /// EdgeConnection. + /// Index of edge to set. + /// + public static FictitiousShell UpdateEdgeConnection(FictitiousShell fictShell, Shells.EdgeConnection edgeConnection, int index) + { + // deep clone. downstreams objs will contain changes made in this method, upstream objs will not. + // downstream and uppstream objs will share guid. + FictitiousShell fictShellClone = fictShell.DeepClone(); + + if (index < 0 & index >= fictShellClone.Region.GetEdgeConnections().Count) + throw new System.ArgumentException("Index is out of bounds."); + + fictShellClone.Region.SetEdgeConnection(edgeConnection, index); + + return fictShellClone; + } } } \ No newline at end of file diff --git a/FemDesign.Core/ModellingTools/StiffnessMatrix2Type.cs b/FemDesign.Core/ModellingTools/StiffnessMatrix2Type.cs index 4e7583246..5d7d206ec 100644 --- a/FemDesign.Core/ModellingTools/StiffnessMatrix2Type.cs +++ b/FemDesign.Core/ModellingTools/StiffnessMatrix2Type.cs @@ -17,7 +17,7 @@ public double XZ } set { - this._xz = RestrictedDouble.NonNegMax_1e20(value); + this._xz = RestrictedDouble.NonZeroMax_1e20(value); } } @@ -32,7 +32,7 @@ public double YZ } set { - this._yz = RestrictedDouble.NonNegMax_1e20(value); + this._yz = RestrictedDouble.NonZeroMax_1e20(value); } } diff --git a/FemDesign.Core/ModellingTools/StiffnessMatrix4Type.cs b/FemDesign.Core/ModellingTools/StiffnessMatrix4Type.cs index 2d102df6e..c8d8b36ac 100644 --- a/FemDesign.Core/ModellingTools/StiffnessMatrix4Type.cs +++ b/FemDesign.Core/ModellingTools/StiffnessMatrix4Type.cs @@ -17,10 +17,10 @@ public double XX } set { - this._xx = RestrictedDouble.NonNegMax_1e20(value); + this._xx = RestrictedDouble.NonZeroMax_1e20(value); } } - + [XmlAttribute("xy")] public double _xy; [XmlIgnore] @@ -32,7 +32,7 @@ public double XY } set { - this._xy = RestrictedDouble.NonNegMax_1e20(value); + this._xy = RestrictedDouble.NonZeroMax_1e20(value); } } @@ -47,7 +47,7 @@ public double YY } set { - this._yy = RestrictedDouble.NonNegMax_1e20(value); + this._yy = RestrictedDouble.NonZeroMax_1e20(value); } } @@ -62,7 +62,7 @@ public double GXY } set { - this._gxy = RestrictedDouble.NonNegMax_1e20(value); + this._gxy = RestrictedDouble.NonZeroMax_1e20(value); } } @@ -87,7 +87,14 @@ public StiffnessMatrix4Type(double xx, double xy, double yy, double gxy) this.XY = xy; this.YY = yy; this.GXY = gxy; + + this.CheckMatrixValidity(); } + private void CheckMatrixValidity() + { + if (XX * YY - XY * XY <= 0.0) + throw new System.Exception("(XX*YY)-(XY*XY) must be greater than 0.0!"); + } } } \ No newline at end of file diff --git a/FemDesign.Core/Properties/GlobalAssemblyInfo.cs b/FemDesign.Core/Properties/GlobalAssemblyInfo.cs index c43fed5f2..4e207d684 100644 --- a/FemDesign.Core/Properties/GlobalAssemblyInfo.cs +++ b/FemDesign.Core/Properties/GlobalAssemblyInfo.cs @@ -23,5 +23,5 @@ // Revision // -[assembly: AssemblyVersion("23.3.0")] -[assembly: AssemblyFileVersion("23.3.0")] +[assembly: AssemblyVersion("23.4.0")] +[assembly: AssemblyFileVersion("23.4.0")] diff --git a/FemDesign.Core/Releases/RigidityDataType1.cs b/FemDesign.Core/Releases/RigidityDataType1.cs index 7fe033d89..542818c04 100644 --- a/FemDesign.Core/Releases/RigidityDataType1.cs +++ b/FemDesign.Core/Releases/RigidityDataType1.cs @@ -17,7 +17,7 @@ public partial class RigidityDataType1 public Releases.MotionsPlasticLimits PlasticLimitForces { get; set; } [XmlAttribute("detach")] - public DetachType _deachType; + public DetachType _deachType = DetachType.None; [XmlIgnore] public DetachType DetachType @@ -29,27 +29,27 @@ public DetachType DetachType set { this._deachType = value; - if(value == DetachType.X_Compression) + if (value == DetachType.X_Compression) { this.Motions.XNeg = 0.00; } - else if(value == DetachType.X_Tension) + else if (value == DetachType.X_Tension) { this.Motions.XPos = 0.00; } - else if(value == DetachType.Y_Compression) + else if (value == DetachType.Y_Compression) { this.Motions.YNeg = 0.00; } - else if(value == DetachType.Y_Tension) + else if (value == DetachType.Y_Tension) { this.Motions.YPos = 0.00; } - else if(value == DetachType.Z_Compression) + else if (value == DetachType.Z_Compression) { this.Motions.ZNeg = 0.00; } - else if(value == DetachType.Z_Tension) + else if (value == DetachType.Z_Tension) { this.Motions.ZPos = 0.00; } @@ -76,10 +76,11 @@ public RigidityDataType1(Motions motions) /// /// Construct RigidityDataType1 with motions and plastic limits forces only /// - public RigidityDataType1(Motions motions, MotionsPlasticLimits motionsPlasticLimits) + public RigidityDataType1(Motions motions, MotionsPlasticLimits motionsPlasticLimits, DetachType detachType = DetachType.None) { this.Motions = motions; this.PlasticLimitForces = motionsPlasticLimits; + this.DetachType = detachType; } } } \ No newline at end of file diff --git a/FemDesign.Core/Shells/Panel.cs b/FemDesign.Core/Shells/Panel.cs index 6bfce9441..0de04c257 100644 --- a/FemDesign.Core/Shells/Panel.cs +++ b/FemDesign.Core/Shells/Panel.cs @@ -5,6 +5,7 @@ using FemDesign.GenericClasses; using System.ComponentModel; using System.Linq; +using FemDesign.Releases; namespace FemDesign.Shells { @@ -205,7 +206,7 @@ public Geometry.Region Region public GuidListType InternalPredefinedRigidity { get; set; } [XmlElement("external_rigidity", Order = 16)] - public Releases.RigidityDataType3 ExternalRigidity { get; set; } // // sets region border. region edgeconnection sets edgeconnection for specific edge. default should be hinged? + public Releases.RigidityDataType3 ExternalRigidity { get; set; } // sets region border. region edgeconnection sets edgeconnection for specific edge. default should be hinged? [XmlElement("external_predefined_rigidity", Order = 17)] public GuidListType ExternalPredefinedRigidity { get; set; } @@ -352,7 +353,7 @@ public double IgnoredDistance public bool IgnoredInStability { get; set; } = false; /// - /// Set external edge connections (i.e. set edge connections around region). + /// Set external edge connections (i.e. set edge connections on the border). /// When this is performed for panels the external rigidity is changed accordingly. /// /// EdgeConnection @@ -376,6 +377,27 @@ public void SetExternalEdgeConnections(EdgeConnection ec) this.ExternalPredefinedRigidity = ec.PredefRigidity; } + /// + /// Set external edge connections (i.e. set edge connections on the border). + /// When this is performed for panels the external rigidity is changed accordingly. + /// + /// EdgeConnection + public void SetExternalEdgeConnections(List edgeConnections) + { + // set the edge connections of the external edges of the internal panels + if (this.InternalPanels.IntPanels.Count == 1) + { + this.InternalPanels.IntPanels[0].Region.SetEdgeConnections(edgeConnections); + } + else + { + throw new System.ArgumentException("Can't set external edge connections for panels with more than 1 internal panel (i.e. can only set external edge conncetions for panels with a continuous analytical model)"); + } + + // set external rigidity property + this.ExternalRigidity = RigidityDataType3.RigidLine(); + + } public List GetEdgeConnections() { @@ -456,16 +478,11 @@ public void SetExternalEdgeConnectionsForContinuousAnalyticalModel(EdgeConnectio foreach (int index in indices) { - if (index >= 0 & index < this.InternalPanels.IntPanels[0].Region.GetEdgeConnections().Count) - { - // pass - } - else + if (index < 0 || index >= this.InternalPanels.IntPanels[0].Region.GetEdgeConnections().Count) { throw new System.ArgumentException("Index is out of bounds."); } - // this.SetExternalEdgeConnectionAtIndexForContinousAnalyticalModel(shellEdgeConnection, index); } } @@ -505,10 +522,10 @@ private Panel() /// ShellEccentricity. /// EdgeConnection LCS changes along edge? /// - /// + /// /// /// - internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, EdgeConnection externalEdgeConnection, PanelType type, Materials.Material material, Sections.Section section, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal) + internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, List externalEdgeConnections, PanelType type, Materials.Material material, Sections.Section section, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal) { this.EntityCreated(); @@ -517,10 +534,10 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan this.Plane = region.Plane; this.AnchorPoint = anchorPoint; this.InternalPanels = internalPanels; - this.ExternalRigidity = externalEdgeConnection.Rigidity; + this.ExternalRigidity = RigidityDataType3.RigidLine(); // set edge connections - this.SetExternalEdgeConnections(externalEdgeConnection); + this.SetExternalEdgeConnections(externalEdgeConnections); // attributes this.Type = type; @@ -543,7 +560,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan /// Region of shell containing panels. /// /// - /// Default value for shell border EdgeConnections. Can be overwritten by EdgeConnection for each specific edge in Region. + /// Default value for shell border EdgeConnections. Can be overwritten by EdgeConnection for each specific edge in Region. /// /// Type of panel. /// Name of shell. @@ -553,7 +570,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan /// ShellEccentricity. /// EdgeConnection LCS changes along edge? /// - internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, Materials.TimberPanelType timberApplicationData, EdgeConnection externalEdgeConnection, PanelType type, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal, double panelWidth) + internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPanels internalPanels, Materials.TimberPanelType timberApplicationData, List externalEdgeConnections, PanelType type, string identifier, string panelName, double gap, double orthotropy, ShellEccentricity ecc, bool externalMovingLocal, double panelWidth) { this.EntityCreated(); @@ -565,7 +582,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan this.TimberPanelData = timberApplicationData; // set external rigidity - this.SetExternalEdgeConnections(externalEdgeConnection); + this.SetExternalEdgeConnections(externalEdgeConnections); // set internal rigidity - not relevant for a panel with continuous analytical model @@ -574,6 +591,7 @@ internal Panel(Geometry.Region region, Geometry.Point3d anchorPoint, InternalPan this.Identifier = identifier; this.PanelName = panelName; this.Gap = gap; + this.Orthotropy = orthotropy; this.Alignment = ecc.Alignment; this.AlignOffset = ecc.Eccentricity; this.EccentricityCalculation = ecc.EccentricityCalculation; @@ -603,7 +621,34 @@ public static Panel DefaultContreteContinuous(Geometry.Region region, EdgeConnec double gap = 0.003; bool externalMovingLocal = externalEdgeConnection.MovingLocal; - return new Panel(region, anchorPoint, internalPanels, externalEdgeConnection, type, material, section, identifier, panelName, gap, orthotropy, ecc, externalMovingLocal); + return new Panel(region, anchorPoint, internalPanels, new List { externalEdgeConnection }, type, material, section, identifier, panelName, gap, orthotropy, ecc, externalMovingLocal); + } + + /// + /// Create a default concrete shell with panels using a continuous analytical model. + /// + /// Panel region. + /// + /// + /// + /// Name of shell. + /// + /// + /// + public static Panel DefaultContreteContinuous(Geometry.Region region, List externalEdgeConnections, Materials.Material material, Sections.Section section, string identifier, double orthotropy, ShellEccentricity ecc) + { + if (externalEdgeConnections?.Count == 0 || externalEdgeConnections == null) + externalEdgeConnections = new List { EdgeConnection.Default}; + + Geometry.Point3d anchorPoint = region.Contours[0].Edges[0].Points[0]; + InternalPanel internalPanel = new InternalPanel(region); + InternalPanels internalPanels = new InternalPanels(internalPanel); + PanelType type = PanelType.Concrete; + string panelName = "A"; + double gap = 0.003; + bool externalMovingLocal = true; + + return new Panel(region, anchorPoint, internalPanels, externalEdgeConnections, type, material, section, identifier, panelName, gap, orthotropy, ecc, externalMovingLocal); } /// @@ -634,11 +679,47 @@ public static Panel DefaultTimberContinuous(Geometry.Region region, Materials.Ti double orthotropy = 1; bool externalMovingLocal = externalEdgeConnection.MovingLocal; - var panel = new Panel(region, anchorPoint, internalPanels, timberPlateMaterial, externalEdgeConnection, type, identifier, panelName, gap, orthotropy, eccentricity, externalMovingLocal, panelWidth); + var panel = new Panel(region, anchorPoint, internalPanels, timberPlateMaterial, new List { externalEdgeConnection }, type, identifier, panelName, gap, orthotropy, eccentricity, externalMovingLocal, panelWidth); panel.LocalX = direction; // Set timber panel span direction return panel; } + + /// + /// Create a default timber shell with panels using a continuous analytical model. + /// + /// Panel region. + /// Timber material. See . + /// Timber panel span direction. + /// + /// Name of shell. + /// + /// + /// + public static Panel DefaultTimberContinuous(Geometry.Region region, Materials.TimberPanelType timberPlateMaterial, Geometry.Vector3d direction, List externalEdgeConnections, string identifier = "TP", ShellEccentricity eccentricity = null, double panelWidth = 1.5) + { + + if (externalEdgeConnections?.Count == 0 || externalEdgeConnections == null) + externalEdgeConnections = new List { EdgeConnection.Default}; + + if (eccentricity == null) + eccentricity = ShellEccentricity.Default; + + Geometry.Point3d anchorPoint = region.Contours[0].Edges[0].Points[0]; + InternalPanel internalPanel = new InternalPanel(region); + InternalPanels internalPanels = new InternalPanels(internalPanel); + PanelType type = PanelType.Timber; + string panelName = "A"; + double gap = 0.01; + double orthotropy = 1; + bool externalMovingLocal = true; + + var panel = new Panel(region, anchorPoint, internalPanels, timberPlateMaterial, externalEdgeConnections, type, identifier, panelName, gap, orthotropy, eccentricity, externalMovingLocal, panelWidth); + + panel.LocalX = direction; // Set timber panel span direction + + return panel; + } } } \ No newline at end of file diff --git a/FemDesign.Core/Supports/SurfaceSupport.cs b/FemDesign.Core/Supports/SurfaceSupport.cs index 1766e65b7..702b56336 100644 --- a/FemDesign.Core/Supports/SurfaceSupport.cs +++ b/FemDesign.Core/Supports/SurfaceSupport.cs @@ -77,12 +77,19 @@ public SurfaceSupport(Geometry.Region region, Motions motions, string identifier /// /// Create surface support with only translation rigidity and force plastic limits defined. /// + [Obsolete("Constructor will be removed in FD 24.")] public SurfaceSupport(Geometry.Region region, Motions motions, MotionsPlasticLimits motionsPlasticLimits, string identifier = "S") { var rigidity = new RigidityDataType1(motions, motionsPlasticLimits); Initialize(region, rigidity, identifier); } + public SurfaceSupport(Geometry.Region region, Motions motions, MotionsPlasticLimits motionsPlasticLimits, DetachType detachType = DetachType.None, string identifier = "S") + { + var rigidity = new RigidityDataType1(motions, motionsPlasticLimits, detachType); + Initialize(region, rigidity, identifier); + } + private void Initialize(Geometry.Region region, RigidityDataType1 rigidity, string identifier) { this.EntityCreated(); diff --git a/FemDesign.Examples/C#/Practical example - Run analysis/Program.cs b/FemDesign.Examples/C#/Practical example - Run analysis/Program.cs index 5b7901d91..da3819887 100644 --- a/FemDesign.Examples/C#/Practical example - Run analysis/Program.cs +++ b/FemDesign.Examples/C#/Practical example - Run analysis/Program.cs @@ -167,7 +167,7 @@ static void Main() var noCombItem_1 = new Calculate.CombItem { - CombName = "WIND LEAD", + CombName = "SNOW LEAD", ImpfRqd = 0, StabRqd = 0, Calc = true, @@ -181,13 +181,13 @@ static void Main() }; var noCombItem_2 = new Calculate.CombItem { - CombName = "SNOW LEAD", - NoCalc = true, + CombName = "WIND LEAD", + Calc = false, }; var noCombItem_3 = new Calculate.CombItem { CombName = "ULS VERTICAL", - NoCalc = true, + Calc = false, }; var noCombItems = new List diff --git a/FemDesign.Examples/C#/Practical example - WPF/App.xaml b/FemDesign.Examples/C#/Practical example - WPF/App.xaml new file mode 100644 index 000000000..2af6122b4 --- /dev/null +++ b/FemDesign.Examples/C#/Practical example - WPF/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/FemDesign.Examples/C#/Practical example - WPF/App.xaml.cs b/FemDesign.Examples/C#/Practical example - WPF/App.xaml.cs new file mode 100644 index 000000000..dc9668c36 --- /dev/null +++ b/FemDesign.Examples/C#/Practical example - WPF/App.xaml.cs @@ -0,0 +1,14 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace Practical_example___WPF +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } + +} diff --git a/FemDesign.Examples/C#/Practical example - WPF/AssemblyInfo.cs b/FemDesign.Examples/C#/Practical example - WPF/AssemblyInfo.cs new file mode 100644 index 000000000..b0ec82757 --- /dev/null +++ b/FemDesign.Examples/C#/Practical example - WPF/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/FemDesign.Examples/C#/Practical example - WPF/FDlong-blue-trans back.png b/FemDesign.Examples/C#/Practical example - WPF/FDlong-blue-trans back.png new file mode 100644 index 000000000..906bd0988 Binary files /dev/null and b/FemDesign.Examples/C#/Practical example - WPF/FDlong-blue-trans back.png differ diff --git a/FemDesign.Examples/C#/Practical example - WPF/FDlong-blue.png b/FemDesign.Examples/C#/Practical example - WPF/FDlong-blue.png new file mode 100644 index 000000000..264398bb5 Binary files /dev/null and b/FemDesign.Examples/C#/Practical example - WPF/FDlong-blue.png differ diff --git a/FemDesign.Examples/C#/Practical example - WPF/MainWindow.xaml b/FemDesign.Examples/C#/Practical example - WPF/MainWindow.xaml new file mode 100644 index 000000000..12b6bbc04 --- /dev/null +++ b/FemDesign.Examples/C#/Practical example - WPF/MainWindow.xaml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FemDesign.Examples/C#/Practical example - WPF/MainWindow.xaml.cs b/FemDesign.Examples/C#/Practical example - WPF/MainWindow.xaml.cs new file mode 100644 index 000000000..4e76c21ba --- /dev/null +++ b/FemDesign.Examples/C#/Practical example - WPF/MainWindow.xaml.cs @@ -0,0 +1,217 @@ +using Microsoft.Win32; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using FemDesign; +using FemDesign.Calculate; +using System.Security.Policy; +using System.Threading.Tasks; +using FemDesign.Results; + +namespace Practical_example___WPF +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + FemDesign.FemDesignConnection connection; + string _filePath; + Comb Comb = null; + Model model = null; + + public MainWindow() + { + InitializeComponent(); + this.connection = new FemDesign.FemDesignConnection(minimized: false); + } + + ~MainWindow() + { + this.connection.Dispose(); + } + + + private async Task OpenFemDesignFile(string filePath) + { + await Task.Factory.StartNew(() => + { + connection.Open(filePath); + }); + } + private async Task GetModel() + { + await Task.Factory.StartNew(() => + { + model = connection.GetModel(); + }); + } + private async Task RunOptimisation(int iteration, double thicknessStep) + { + await Task.Factory.StartNew(() => + { + + // create a while loop with a condition that will be true until the utilisation is less than 1 + double utilisation = 2; + int i = 1; + + + + while(utilisation > 1 && i < iteration) + { + var thickness = i * thicknessStep / 1000; + // update the thickness of all the slabs in the model + foreach (var slab in model.Entities.Slabs) + { + slab.UpdateThickness(i * thickness); + } + + connection.Open(model); + var analysis = new Analysis(comb: Comb, calcCase: true, calcComb: true); + connection.RunAnalysis(analysis); + + var quantities = connection.GetQuantities(); + double total = quantities.Sum(r => r.TotalWeight); + + var units = UnitResults.Default(); + units.Stress = Stress.MPa; + var maxStress = connection.GetResults(units, options: new Options(BarResultPosition.ResultPoints, ShellResultPosition.ResultPoints, 0.5)).Select(x => Math.Abs(x.SigmaVM)).Max(); + utilisation = maxStress / 355; + + DisplayResults(i, thickness, total, utilisation); + i++; + } + + + + + + //for (int i = 1; i <= iteration; i++) + //{ + // // update the thickness of all the slabs in the model + // foreach (var slab in model.Entities.Slabs) + // { + // slab.UpdateThickness(i * thickness / 1000); + // } + // connection.Open(model); + // var analysis = new Analysis(comb: Comb, calcCase: true, calcComb: true); + // connection.RunAnalysis(analysis); + + // var quantities = connection.GetQuantities(); + // double total = quantities.Sum(r => r.TotalWeight); + + // var units = UnitResults.Default(); + // units.Stress = Stress.MPa; + // var maxStress = connection.GetResults(options: new Options(BarResultPosition.ResultPoints, ShellResultPosition.ResultPoints, 0.5)).Select(x => Math.Abs(x.SigmaVM)).Max(); + // var utilisation = 355 / maxStress; + + // DisplayResults(i, thickness, total, utilisation); + //} + }); + } + private void DisplayResults(int i, double thickness, double weight, double utilisation) + { + Dispatcher.Invoke(() => + { + TextBox.AppendText($"Iteration: {i}\r\n"); + TextBox.AppendText($"thickness: {thickness}\r\n"); + TextBox.AppendText($"Steel utilisation: {utilisation * 100:0.0} %.\r\n"); + TextBox.AppendText($"Steel weight: {weight:0.0} ton.\r\n"); + TextBox.AppendText($"\r\n"); + }); + } + + #region Events + private async void OpenFile_Click(object sender, RoutedEventArgs e) + { + // open a file dialog + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "FEM-Design files|*.str;*.struxml"; + openFileDialog.InitialDirectory = "C:\\GitHub\\femdesign-api\\FemDesign.Examples\\C#\\Practical example - WPF"; + openFileDialog.Title = "Select a FemDesign file"; + + // store the selected file path + if (openFileDialog.ShowDialog() == true) + { + _filePath = openFileDialog.FileName; + this.label1.Content = System.IO.Path.GetFileName(_filePath); + + await OpenFemDesignFile(_filePath); + await GetModel(); + + } + } + private void Picture_MouseDown(object sender, MouseEventArgs e) + { + // open a browser to the FemDesign API documentation + System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd", "/c start " + "https://femdesign-api-docs.onstrusoft.com/"); + psi.CreateNoWindow = true; + System.Diagnostics.Process.Start(psi); + } + private async void RunOptimisation_Click(object sender, RoutedEventArgs e) + { + if(_filePath == null) + { + MessageBox.Show("Please open a FemDesign file first"); + return; + } + + Run_Optimisation.Content = "Processing..."; + Run_Optimisation.IsEnabled = false; + + TextBox.Clear(); + + int iteration = int.Parse(ComboBox.Text); + double thickness = double.Parse(Thk.Text); + + // await makes sure that the task is completed before the next line is executed + await RunOptimisation(iteration, thickness); + + // it will be called after the task is completed + TextBox.AppendText($"Optimisation completed"); + + Run_Optimisation.Content = "Run Optimisation"; + Run_Optimisation.IsEnabled = true; + } + private void setComb() + { + if (Radio_button_NLE.IsChecked == true) + { + var comb = new Comb(); + var NLE = new CombItem(NLE: true, PL: true); + comb.CombItem = new List { NLE }; + Comb = comb; + } + + if (Radio_button_LE.IsChecked == true) + { + var comb = new Comb(); + var LE = new CombItem(NLE: false, PL: false); + comb.CombItem = new List { LE }; + Comb = comb; + } + } + private void Radio_button_LE_Checked(object sender, RoutedEventArgs e) + { + setComb(); + } + private void Radio_button_NLE_Checked(object sender, RoutedEventArgs e) + { + setComb(); + } + + #endregion + + private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/FemDesign.Examples/C#/Practical example - WPF/Practical example - Windows Presentation Foundation (WPF).csproj b/FemDesign.Examples/C#/Practical example - WPF/Practical example - Windows Presentation Foundation (WPF).csproj new file mode 100644 index 000000000..b1da0eccb --- /dev/null +++ b/FemDesign.Examples/C#/Practical example - WPF/Practical example - Windows Presentation Foundation (WPF).csproj @@ -0,0 +1,26 @@ + + + + WinExe + net6.0-windows + Practical_example___WPF + enable + enable + true + + + + + + + + + + + + + + + + + diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/App.config b/FemDesign.Examples/C#/Practical example - Windows forms/App.config deleted file mode 100644 index 193aecc67..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Form1.Designer.cs b/FemDesign.Examples/C#/Practical example - Windows forms/Form1.Designer.cs deleted file mode 100644 index 632809e63..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Form1.Designer.cs +++ /dev/null @@ -1,111 +0,0 @@ -namespace FemDesign.Examples -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.button1 = new System.Windows.Forms.Button(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(12, 53); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(121, 29); - this.button1.TabIndex = 0; - this.button1.Text = "Run syncrounous"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.syncrounousButtonClick); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(12, 88); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(237, 289); - this.textBox1.TabIndex = 1; - // - // button2 - // - this.button2.Location = new System.Drawing.Point(139, 53); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(110, 29); - this.button2.TabIndex = 2; - this.button2.Text = "Run asynchronous"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.asyncrounousButtonClick); - // - // button3 - // - this.button3.Location = new System.Drawing.Point(12, 12); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(80, 35); - this.button3.TabIndex = 3; - this.button3.Text = "Select model"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(98, 23); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 13); - this.label1.TabIndex = 4; - this.label1.Text = "label1"; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(261, 389); - this.Controls.Add(this.label1); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.button1); - this.Name = "Form1"; - this.Text = "Form1"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Label label1; - } -} - diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Form1.cs b/FemDesign.Examples/C#/Practical example - Windows forms/Form1.cs deleted file mode 100644 index 54ecde92a..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Form1.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using FemDesign.Results; - -namespace FemDesign.Examples -{ - public partial class Form1 : Form - { - FemDesignConnection _connection = new FemDesignConnection(); - string _modelPath = Path.GetFullPath("sample_slab.struxml"); - - public Form1() - { - InitializeComponent(); - - label1.Text = Path.GetFileName(_modelPath); - } - - ~Form1() - { - _connection.Dispose(); - } - - private void syncrounousButtonClick(object sender, EventArgs e) - { - // The following will block the main thread (UI) until the Task has completed then continue. - var quantities = GetQuantitiesAsync(_modelPath).Result; - - DisplayResults(quantities); - } - - private async void asyncrounousButtonClick(object sender, EventArgs e) - { - // By running in an async method we can instead 'await' the Task. - // The following will not block the main thread and the UI will continue to be responsive. - // When the results are awailable the method will continue. - var quantities = await GetQuantitiesAsync(_modelPath); - - DisplayResults(quantities); - } - - private Task> GetQuantitiesAsync(string modelPath) - { - var units = UnitResults.Default(); - units.Mass = Mass.t; - - // In order not to get stuck in a deadlock, the commands must be sent from a background thread. - // Task.Run() will start a thread then open the model and return the quantity estimation. - return Task.Run(() => - { - _connection.Open(modelPath); - return _connection.GetResults(); - }); - } - - private void DisplayResults(List quantities) - { - double total = quantities.Sum(r => r.TotalWeight); - textBox1.AppendText($"Concrete weight: {total:0.0} ton.\r\n"); - } - - private void button3_Click(object sender, EventArgs e) - { - var dialog = new OpenFileDialog(); - dialog.Filter = "FEM-Design files|*.str;*.struxml|All files (*.*)|*.*"; - - if (dialog.ShowDialog() != DialogResult.OK) - { - _modelPath = dialog.FileName; - label1.Text = Path.GetFileName(_modelPath); - } - } - } -} diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Form1.resx b/FemDesign.Examples/C#/Practical example - Windows forms/Form1.resx deleted file mode 100644 index 1af7de150..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Practical example - Windows forms.csproj b/FemDesign.Examples/C#/Practical example - Windows forms/Practical example - Windows forms.csproj deleted file mode 100644 index cbb019ff2..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Practical example - Windows forms.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Debug - AnyCPU - {1428F873-E8E8-4A23-974F-2633FDA060C4} - WinExe - Practical_example___Windows_forms - Practical example - Windows forms - v4.8 - 512 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - Always - - - - - - - - {1d91ebf4-a473-4c5b-a171-ab2da1b7017b} - FemDesign.Core - - - - \ No newline at end of file diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Program.cs b/FemDesign.Examples/C#/Practical example - Windows forms/Program.cs deleted file mode 100644 index 6651f1ebe..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Program.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace FemDesign.Examples -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/AssemblyInfo.cs b/FemDesign.Examples/C#/Practical example - Windows forms/Properties/AssemblyInfo.cs deleted file mode 100644 index 0a17dc152..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Practical example - Windows forms")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Practical example - Windows forms")] -[assembly: AssemblyCopyright("Copyright © 2022")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1428f873-e8e8-4a23-974f-2633fda060c4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Resources.Designer.cs b/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Resources.Designer.cs deleted file mode 100644 index 9c1452bdc..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace FemDesign.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Practical_example___Windows_forms.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Resources.resx b/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Resources.resx deleted file mode 100644 index af7dbebba..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Settings.Designer.cs b/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Settings.Designer.cs deleted file mode 100644 index f8bae3334..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace FemDesign.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Settings.settings b/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Settings.settings deleted file mode 100644 index 39645652a..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/FemDesign.Examples/C#/Practical example - Windows forms/sample_slab.struxml b/FemDesign.Examples/C#/Practical example - Windows forms/sample_slab.struxml deleted file mode 100644 index 68fda62e7..000000000 --- a/FemDesign.Examples/C#/Practical example - Windows forms/sample_slab.struxml +++ /dev/null @@ -1,852 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
- -
- - -
-
- - -
-
-
- - - - - - - - - - - - -
diff --git a/FemDesign.Grasshopper/Calculate/ApplicationRun.cs b/FemDesign.Grasshopper/Calculate/ApplicationRun.cs index 92a0a0a83..6f7c68407 100644 --- a/FemDesign.Grasshopper/Calculate/ApplicationRun.cs +++ b/FemDesign.Grasshopper/Calculate/ApplicationRun.cs @@ -67,9 +67,13 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager.AddGenericParameter("DesignGroups", "DesignGroups", "DesignGroups.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("ResultTypes", "ResultTypes", "Results to be extracted from model. This might require the model to have been analysed. Item or list.", GH_ParamAccess.list); + pManager.AddTextParameter("ResultTypes", "ResultTypes", "Results to be extracted from model. This might require the model to have been analysed.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Bsc", "Bsc", "Bsc file path. This might require the model to have been analysed.", GH_ParamAccess.list); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddGenericParameter("Options", "Options", "Settings for output location. Default is 'ByStep' and 'Vertices'", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -158,6 +162,9 @@ protected override void SolveInstance(IGH_DataAccess DA) List _resultType = new List(); DA.GetDataList("ResultTypes", _resultType); + List bscFilePath = new List(); + DA.GetDataList("Bsc", bscFilePath); + FemDesign.Calculate.Options options = null; DA.GetData("Options", ref options); @@ -254,17 +261,28 @@ protected override void SolveInstance(IGH_DataAccess DA) finiteElement = connection.GetFeaModel(units.Length); + int i = 0; if (types.Count != 0) { - int i = 0; foreach (var type in types) { var res = _getResults(connection, type, units, options); - resultsTree.AddRange(res, new GH_Path(iteration,i)); + resultsTree.AddRange(res, new GH_Path(iteration, i)); i++; } } + if(bscFilePath.Count != 0) + { + foreach(var bsc in bscFilePath) + { + var res = connection.GetResultsFromBsc(bsc); + resultsTree.AddRange(res, new GH_Path(iteration, i)); + i++; + } + + } + if (dscTemplate != null) { var outputDocx = OutputFileHelper.GetDocxPath(connection.OutputDir); @@ -312,7 +330,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("{FDECFC6E-4E0C-41A5-8414-207C77FCB503}"); } + get { return new Guid("{1D5D200B-2F6F-4D81-A295-2924773782B3}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Calculate/CombSettings.cs b/FemDesign.Grasshopper/Calculate/CombSettings.cs index 1d16dd0d2..4dd867f70 100644 --- a/FemDesign.Grasshopper/Calculate/CombSettings.cs +++ b/FemDesign.Grasshopper/Calculate/CombSettings.cs @@ -41,11 +41,22 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { + // Default values for input parameters dynamic _loadCombination = null; + bool calc = true; + bool nle = true; + bool pl = true; + bool nls = false; + bool cr = false; + bool f2nd = false; + int im = 0; + double amplitude = 0.0; + int waterlevel = 0; + + // read input data if (!DA.GetData(0, ref _loadCombination)) return; string loadCombination = ""; - if (_loadCombination.Value is string str) { loadCombination = str; @@ -55,45 +66,47 @@ protected override void SolveInstance(IGH_DataAccess DA) loadCombination = loads.Name; } - // Default values for input parameters - bool calc = true; - bool nle = true; - bool pl = true; - bool nls = false; - bool cr = false; - bool f2nd = false; - int im = 0; - double amplitude = 0.0; - int waterlevel = 0; + DA.GetData(1, ref calc); + DA.GetData(2, ref nle); + DA.GetData(3, ref pl); + DA.GetData(4, ref nls); + DA.GetData(5, ref cr); + DA.GetData(6, ref f2nd); + DA.GetData(7, ref im); + DA.GetData(8, ref amplitude); + DA.GetData(9, ref waterlevel); + var combItem = new FemDesign.Calculate.CombItem(combName: loadCombination); - DA.GetData(1, ref calc); - if(calc) + // Check inputs + if (!calc) { - DA.GetData(2, ref nle); - DA.GetData(3, ref pl); - DA.GetData(4, ref nls); - DA.GetData(5, ref cr); - DA.GetData(6, ref f2nd); - DA.GetData(7, ref im); - DA.GetData(8, ref amplitude); - DA.GetData(9, ref waterlevel); - - // Check inputs - if (pl == true && cr == true) + combItem.Calc = false; + AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, $"'Calc' is False. No calculations will be performed for load combination '{loadCombination}'."); + + } + else + { + if (pl && cr) { - AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "'PL' and 'Cr' can not be mutually be equal True. 'Cr' is set to False!"); - cr = false; + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "'PL' and 'Cr' are mutually exclusive. 'PL' is set to False!"); + pl = false; + } + if (pl && !nle) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "'NLE' is set to True as 'PL' is true."); + nle = true; + } + if (pl && f2nd) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "'PL' and 'f2nd' are mutually exclusive. 'PL' is set to False!"); + pl = false; } combItem = new FemDesign.Calculate.CombItem(loadCombination, 0, 0, nle, pl, nls, cr, f2nd, im, amplitude, waterlevel); } - else - { - // No calculations will be performed for this load combination - combItem.NoCalc = true; - } + // return DA.SetData(0, combItem); diff --git a/FemDesign.Grasshopper/Calculate/OBSOLETE/ApplicationRun_OBSOLETE_2.cs b/FemDesign.Grasshopper/Calculate/OBSOLETE/ApplicationRun_OBSOLETE_2.cs new file mode 100644 index 000000000..24b3191b5 --- /dev/null +++ b/FemDesign.Grasshopper/Calculate/OBSOLETE/ApplicationRun_OBSOLETE_2.cs @@ -0,0 +1,321 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper; +using Grasshopper.Kernel; +using Grasshopper.Kernel.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Runtime.Remoting.Messaging; +using FemDesign.Loads; +using FemDesign.Calculate; +using FemDesign.Results; +using System.Data.Common; +using System.Reflection; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using FemDesign.Grasshopper.Extension.ComponentExtension; + +using GH_IO.Serialization; + + +namespace FemDesign.Grasshopper +{ + public class ApplicationRun_OBSOLETE_2 : FEM_Design_API_Component + { + public ApplicationRun_OBSOLETE_2() : base("Application.Run", "RunApplication", "Run application for a model.", CategoryName.Name(), SubCategoryName.Cat7a()) + { + _minimised = false; + _keepOpen = false; + } + + public bool _minimised { get; set; } + public bool _keepOpen { get; set; } + + + public override bool Write(GH_IWriter writer) + { + // Save the version when this component was created + writer.SetBoolean("minimised", _minimised); + writer.SetBoolean("keepOpen", _keepOpen); + return base.Write(writer); + } + + public override bool Read(GH_IReader reader) + { + // Read the version when this component was created + try + { + _minimised = reader.GetBoolean("minimised"); + _keepOpen = reader.GetBoolean("keepOpen"); + } + catch (NullReferenceException) { } // In case the info component was created before the VersionWhenFirstCreated was implemented. + return base.Read(reader); + } + + + + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("Model", "Model", "Model to open.", GH_ParamAccess.item); + pManager.AddGenericParameter("Analysis", "Analysis", "Analysis.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("Design", "Design", "Design.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddGenericParameter("DesignGroups", "DesignGroups", "DesignGroups.", GH_ParamAccess.list); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddTextParameter("ResultTypes", "ResultTypes", "Results to be extracted from model. This might require the model to have been analysed. Item or list.", GH_ParamAccess.list); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddGenericParameter("Options", "Options", "Settings for output location. Default is 'ByStep' and 'Vertices'", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddGenericParameter("Units", "Units", "Specify the Result Units for some specific type. \n" + + "Default Units are: Length.m, Angle.deg, SectionalData.m, Force.kN, Mass.kg, Displacement.m, Stress.Pa", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddTextParameter("Cfg", "Cfg", "Cfg file path with design parameters for structural materials. \nYou can use the 'cfg.xml' file in located package manager library folder as a starting point..\n%AppData%\\McNeel\\Rhinoceros\\packages\\7.0\\FemDesign\\", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddTextParameter("GlobalCfg", "GlobalCfg", "GlobalCfg file path. You can use the 'cmdglobalcfg.xml' file in located package manager library folder as a starting point.\n%AppData%\\McNeel\\Rhinoceros\\packages\\7.0\\FemDesign\\", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddTextParameter("DocxTemplatePath", "DocxTemplatePath", "File path to documentation template file (.dsc). The documentation will be saved in the `FEM-Design API` folder. Optional parameter.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("SaveFilePath", "SaveFilePath", "File path where to save the model as .struxml.\nIf not specified, the file will be saved in the `FEM-Design API` folder adjacent to your .gh script.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("RunNode", "RunNode", "If true node will execute. If false node will not execute.", GH_ParamAccess.item, false); + pManager[pManager.ParamCount - 1].Optional = true; + + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("Model", "Model", "Model.", GH_ParamAccess.item); + pManager.Register_GenericParam("FiniteElement", "FiniteElement", "FemDesign Finite Element Geometries(nodes, bars, shells)."); + pManager.AddGenericParameter("Results", "Results", "Results.", GH_ParamAccess.tree); + } + + + public dynamic _getResults(FemDesignConnection connection, Type resultType, Results.UnitResults units = null, Options options = null, List elements = null) + { + List mixedResults = new List(); + MethodInfo genericMethod = typeof(FemDesign.FemDesignConnection).GetMethod("_getResults", BindingFlags.Instance | BindingFlags.NonPublic).MakeGenericMethod(resultType); + dynamic result = genericMethod.Invoke(connection, new object[] { units, options, elements, true }); + mixedResults.AddRange(result); + return mixedResults; + } + + + protected override void AppendAdditionalComponentMenuItems(System.Windows.Forms.ToolStripDropDown menu) + { + // Append the item to the menu, making sure it's always enabled and checked if Absolute is True. + ToolStripMenuItem minimisedItem = Menu_AppendItem(menu, "Minimise FEM-Design", Menu_AbsoluteClicked, null, true, _minimised); + ToolStripMenuItem keepOpenItem = Menu_AppendItem(menu, "Keep open", keepOpenClick, null, true, _keepOpen); + } + + private void Menu_AbsoluteClicked(object sender, EventArgs e) + { + _minimised = !_minimised; + ExpireSolution(true); + } + + private void keepOpenClick(object sender, EventArgs e) + { + _keepOpen = !_keepOpen; + ExpireSolution(true); + } + + + protected override void SolveInstance(IGH_DataAccess DA) + { + bool runNode = false; + DA.GetData("RunNode", ref runNode); + + if (runNode == false) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "RunNode set to false!"); + return; + } + + dynamic _model = null; + DA.GetData("Model", ref _model); + + FemDesign.Calculate.Analysis analysis = null; + DA.GetData("Analysis", ref analysis); + + FemDesign.Calculate.Design design = null; + DA.GetData("Design", ref design); + + FemDesign.Results.UnitResults units = UnitResults.Default(); + DA.GetData("Units", ref units); + + List designGroups = new List(); + DA.GetDataList("DesignGroups", designGroups); + + List _resultType = new List(); + DA.GetDataList("ResultTypes", _resultType); + + FemDesign.Calculate.Options options = null; + DA.GetData("Options", ref options); + + string cfg = null; + DA.GetData("Cfg", ref cfg); + + string globalCfg = null; + DA.GetData("GlobalCfg", ref globalCfg); + + string dscTemplate = null; + DA.GetData("DocxTemplatePath", ref dscTemplate); + + string saveFilePath = null; + DA.GetData("SaveFilePath", ref saveFilePath); + + + //if (analysis == null && design == null && saveFilePath == null && _resultType.Count == 0) + //{ + // AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "At least one of the following should be provided.\n'Analysis', 'Design', 'ResultTypes' or 'SaveFilePath'"); + // return; + //} + + // Collect Outputs + Model model = null; + List results = new List(); + FemDesign.Results.FiniteElement finiteElement = null; + var resultsTree = new DataTree(); + + + var types = new List(); + foreach (var resType in _resultType) + { + var _type = $"FemDesign.Results.{resType}, FemDesign.Core"; + Type type = Type.GetType(_type); + types.Add(type); + } + + + bool fileExist = OnPingDocument().IsFilePathDefined; + if (!fileExist) + { + // hops issue + //var folderPath = System.IO.Directory.GetCurrentDirectory(); + string tempPath = System.IO.Path.GetTempPath(); + System.IO.Directory.SetCurrentDirectory(tempPath); + } + else + { + var filePath = OnPingDocument().FilePath; + var currentDir = System.IO.Path.GetDirectoryName(filePath); + System.IO.Directory.SetCurrentDirectory(currentDir); + } + + + // Gets how many times SolveInstance() has been called + var iteration = DA.Iteration; + + // Create Task + var t = Task.Run((Action)(() => + { + var connection = new FemDesign.FemDesignConnection(minimized: _minimised, keepOpen: _keepOpen); + + connection.Open(_model.Value); + + if (cfg != null) + connection.SetConfig(new Calculate.CmdConfig(cfg)); + + if (globalCfg != null) + connection.SetGlobalConfig(CmdGlobalCfg.DeserializeCmdGlobalCfgFromFilePath(globalCfg)); + + if (analysis != null) + connection.RunAnalysis(analysis); + + + // run design + + if (design != null) + { + CmdUserModule userModule = design.Mode; + if (designGroups.Count() == 0) + connection.RunDesign(userModule, design); + else + connection.RunDesign(userModule, design, designGroups); + + if (design.ApplyChanges == true && design.Check == true) + { + connection.RunAnalysis(analysis); + var _design = new Design(check: true); + + connection.RunDesign(userModule, _design); + } + } + + + finiteElement = connection.GetFeaModel(units.Length); + + if (types.Count != 0) + { + int i = 0; + foreach (var type in types) + { + var res = _getResults(connection, type, units, options); + resultsTree.AddRange(res, new GH_Path(iteration,i)); + i++; + } + } + + if (dscTemplate != null) + { + var outputDocx = OutputFileHelper.GetDocxPath(connection.OutputDir); + connection.SaveDocx(outputDocx, dscTemplate); + } + + // return the new model + model = connection.GetModel(); + + + // save calculated model in .str format + if (saveFilePath == null) + { + saveFilePath = OutputFileHelper.GetStrPath(connection.OutputDir, "model_saved"); + } + + connection.Save(saveFilePath); + + connection.Dispose(); + })); + + + t.ConfigureAwait(false); + + try + { + t.Wait(); + } + catch (Exception ex) + { + throw ex.InnerException; + } + + // Set output + DA.SetData("Model", model); + DA.SetData("FiniteElement", finiteElement); + DA.SetDataTree(2, resultsTree); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.ModelRunAnalysis; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{FDECFC6E-4E0C-41A5-8414-207C77FCB503}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs index e0bc9aa39..cc697f914 100644 --- a/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs @@ -20,7 +20,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) } protected override void RegisterOutputParams(GH_OutputParamManager pManager) { - pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code: B/COMMON/D/DK/E/EST/FIN/GB/H/LT/N/NL/PL/RO/S/TR.", GH_ParamAccess.item); + pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code: B/COMMON/D/DK/E/EST/FIN/GB/H/LT/N/NL/PL/RO/S/TR\n\nNote: the TR (Turkish) national annex is no longer supported by FEM-Design.", GH_ParamAccess.item); pManager.AddGenericParameter("Foundations", "Foundations", "Single foundation element or list of foundation elements.", GH_ParamAccess.list); pManager.AddGenericParameter("Bars", "Bars", "Single bar element or list of bar elements.", GH_ParamAccess.list); pManager.AddGenericParameter("Shells", "Shells", "Single shell element or list of shell elements.", GH_ParamAccess.list); diff --git a/FemDesign.Grasshopper/Deconstruct/Shells/EdgeConnectionDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Shells/EdgeConnectionDeconstruct.cs index b50276f6f..a441b2b54 100644 --- a/FemDesign.Grasshopper/Deconstruct/Shells/EdgeConnectionDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/Shells/EdgeConnectionDeconstruct.cs @@ -42,28 +42,24 @@ protected override void SolveInstance(IGH_DataAccess DA) return; } - // return + // set output DA.SetData(0, obj.Guid); DA.SetData(1, obj.Name); - var edgeCurve = obj.Edge.ToRhino(); - DA.SetData(2, obj.Edge.ToRhino()); + Curve edgeCurve = obj.Edge.ToRhino(); + DA.SetData(2, edgeCurve); - if (!edgeCurve.IsLinear()) - { - this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Arc edge detected in the panel. Local plane is not calculated"); - DA.SetData(3, null); - } - else // it is a line - { - edgeCurve.Domain = new Rhino.Geometry.Interval(0, 1.0); - var midPoint = edgeCurve.PointAt(0.5).FromRhino(); - var localX = (edgeCurve.PointAtEnd - edgeCurve.PointAtStart).FromRhino(); - var localZ = obj.Normal; - var localY = localX.Cross(localZ); - var localPlane = new FemDesign.Geometry.Plane(midPoint, localX, localY).ToRhino(); - DA.SetData(3, localPlane); - } + // local coordinate system + Point3d midPoint = edgeCurve.PointAtNormalizedLength(0.5); + Point3d startPoint = edgeCurve.PointAtNormalizedLength(0.0); + Point3d endPoint = edgeCurve.PointAtNormalizedLength(1.0); + + Vector3d xDir = new Vector3d(endPoint.X - startPoint.X, endPoint.Y - startPoint.Y, endPoint.Z - startPoint.Z); + Vector3d zDir = obj.Normal.ToRhino(); + Vector3d yDir = Vector3d.CrossProduct(xDir, zDir); + + Plane localPlane = new Plane(midPoint, xDir, yDir); + DA.SetData(3, localPlane); // catch pre-defined rigidity if (obj.Rigidity != null) diff --git a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj index caaab60ea..1bea7935f 100644 --- a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj +++ b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj @@ -70,6 +70,7 @@ Properties\GlobalAssemblyInfo.cs + @@ -85,6 +86,7 @@ + @@ -133,13 +135,15 @@ - + + + @@ -223,7 +227,8 @@ - + + @@ -265,6 +270,13 @@ + + + + + + + @@ -275,6 +287,7 @@ + @@ -371,7 +384,7 @@ - + @@ -858,28 +871,33 @@ + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - @@ -930,7 +948,6 @@ - @@ -955,7 +972,6 @@ - diff --git a/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseDefault.cs b/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseDefault.cs index c24caedea..49c0b8f21 100644 --- a/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseDefault.cs +++ b/FemDesign.Grasshopper/Loads/Load categories/LoadCategoryDatabaseDefault.cs @@ -13,7 +13,7 @@ public class LoadCategoryDefault: FEM_Design_API_Component } protected override void RegisterInputParams(GH_InputParamManager pManager) { - pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code: S/N.\n EST/FIN/GB/H/N/PL/RO/S/TR NOT yet implemented. Contact us at support@strusoft.freshdesk.com if you need it.", GH_ParamAccess.item, "S"); + pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code: S/N.\n B/COMMON/D/DK/E/EST/FIN/GB/H/LT/NL/PL/RO are NOT yet implemented. Contact us at support@strusoft.freshdesk.com if you need it.", GH_ParamAccess.item, "S"); pManager[pManager.ParamCount - 1].Optional = true; } protected override void RegisterOutputParams(GH_OutputParamManager pManager) diff --git a/FemDesign.Grasshopper/Loads/Load groups/LoadGroupToLoadComb.cs b/FemDesign.Grasshopper/Loads/Load groups/LoadGroupToLoadComb.cs index 97dc6bd10..8020efa9f 100644 --- a/FemDesign.Grasshopper/Loads/Load groups/LoadGroupToLoadComb.cs +++ b/FemDesign.Grasshopper/Loads/Load groups/LoadGroupToLoadComb.cs @@ -7,6 +7,7 @@ using FemDesign.Loads; using FemDesign.Grasshopper.Extension.ComponentExtension; using Grasshopper.Kernel.Special; +using FemDesign.GenericClasses; namespace FemDesign.Grasshopper { @@ -21,6 +22,7 @@ public LoadGroupToLoadComb() : base("LoadGroupToLoadComb", "LoadGroupToLoadComb" protected override void RegisterInputParams(GH_InputParamManager pManager) { + pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code.\nConnect 'ValueList' to get the options.\nB/COMMON/D/DK/E/EST/FIN/GB/H/LT/N/NL/PL/RO/S/TR\n\nNote: the TR (Turkish) national annex is no longer supported by FEM-Design.", GH_ParamAccess.item, "S"); pManager.AddGenericParameter("LoadGroups", "LoadGroups", "Load groups to convert in load combinations", GH_ParamAccess.list); pManager.AddTextParameter("CombinationMethod", "CombinationMethod", "Connect 'ValueList' to get the options.\nCombination Method type:\nEN 1990 6.4.3(6.10)\nEN 1990 6.4.3(6.10.a, b)", GH_ParamAccess.item, "EN 1990 6.4.3(6.10)"); pManager[pManager.ParamCount - 1].Optional = true; @@ -59,7 +61,7 @@ protected override void SolveInstance(IGH_DataAccess DA) var loadGroups = new List(); DA.GetDataList("LoadGroups", loadGroups); - if(loadGroups.Count == 0) + if (loadGroups.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Input parameter 'LoadGroups' failed to collect data"); return; @@ -69,16 +71,16 @@ protected override void SolveInstance(IGH_DataAccess DA) foreach (var loadGroup in loadGroups) { - if(loadGroup.ModelLoadGroupPermanent != null) + if (loadGroup.ModelLoadGroupPermanent != null) { _loadCases.AddRange(loadGroup.ModelLoadGroupPermanent.LoadCase); } - else if(loadGroup.ModelLoadGroupTemporary != null) + else if (loadGroup.ModelLoadGroupTemporary != null) { _loadCases.AddRange(loadGroup.ModelLoadGroupTemporary.LoadCase); } } - + _loadCases = _loadCases.Distinct().ToList(); string combinationMethod = "EN 1990 6.4.3(6.10)"; @@ -86,6 +88,11 @@ protected override void SolveInstance(IGH_DataAccess DA) LoadCombinationMethod _combinationMethod = FemDesign.GenericClasses.EnumParser.Parse(combinationMethod); + string _countryCode = "S"; + DA.GetData("CountryCode", ref _countryCode); + + Country countryCode = EnumParser.Parse(_countryCode); + var fU = true; DA.GetData("fU", ref fU); @@ -127,9 +134,9 @@ protected override void SolveInstance(IGH_DataAccess DA) // Create Task var t = Task.Run(() => { - var connection = new FemDesignConnection( minimized: true, tempOutputDir: false); + var connection = new FemDesignConnection(minimized: true, tempOutputDir: false); - var model = new Model(Country.S, loadCases: _loadCases, loadGroups: loadGroups); + var model = new Model(countryCode, loadCases: _loadCases, loadGroups: loadGroups); model.Entities.Loads.LoadGroupTable.SimpleCombinationMethod = _combinationMethod; connection.Open(model); @@ -157,8 +164,9 @@ protected override void SolveInstance(IGH_DataAccess DA) protected override void BeforeSolveInstance() { - ValueListUtils.UpdateValueLists(this, 1, new List - { "EN 1990 6.4.3(6.10)", "EN 1990 6.4.3(6.10.a, b)" }, null, GH_ValueListMode.DropDown); + ValueListUtils.UpdateValueLists(this, 0, Enum.GetNames(typeof(Country)).ToList(), null, GH_ValueListMode.DropDown); + + ValueListUtils.UpdateValueLists(this, 2, new List { "EN 1990 6.4.3(6.10)", "EN 1990 6.4.3(6.10.a, b)" }, null, GH_ValueListMode.DropDown); } @@ -171,7 +179,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("{9E952662-2BF2-4727-ABAA-094FA2D67DF9}"); } + get { return new Guid("{A5D427E1-B928-4684-A8B4-9E1353FF46CB}"); } } public override GH_Exposure Exposure => GH_Exposure.senary; diff --git a/FemDesign.Grasshopper/Loads/Load groups/OBSOLETE/LoadGroupToLoadComb_OBSOLETE.cs b/FemDesign.Grasshopper/Loads/Load groups/OBSOLETE/LoadGroupToLoadComb_OBSOLETE.cs new file mode 100644 index 000000000..fb255e457 --- /dev/null +++ b/FemDesign.Grasshopper/Loads/Load groups/OBSOLETE/LoadGroupToLoadComb_OBSOLETE.cs @@ -0,0 +1,179 @@ +// https://strusoft.com/ +using System; +using System.Linq; +using System.Collections.Generic; +using Grasshopper.Kernel; +using System.Threading.Tasks; +using FemDesign.Loads; +using FemDesign.Grasshopper.Extension.ComponentExtension; +using Grasshopper.Kernel.Special; + +namespace FemDesign.Grasshopper +{ + public class LoadGroupToLoadComb_OBSOLETE : FEM_Design_API_Component + { + public LoadGroupToLoadComb_OBSOLETE() : base("LoadGroupToLoadComb", "LoadGroupToLoadComb", "", CategoryName.Name(), SubCategoryName.Cat3()) + { + + } + + public List _log = new List(); + + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("LoadGroups", "LoadGroups", "Load groups to convert in load combinations", GH_ParamAccess.list); + pManager.AddTextParameter("CombinationMethod", "CombinationMethod", "Connect 'ValueList' to get the options.\nCombination Method type:\nEN 1990 6.4.3(6.10)\nEN 1990 6.4.3(6.10.a, b)", GH_ParamAccess.item, "EN 1990 6.4.3(6.10)"); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fU", "fU", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fUa", "fUa", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fUs", "fUs", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fSq", "fSq", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fSf", "fSf", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fSc", "fSc", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fSeisSigned", "fSeisSigned", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fSeisTorsion", "fSeisTorsion", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fSeisZdir", "fSeisZdir", "", GH_ParamAccess.item, false); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fSkipMinDL", "fSkipMinDL", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fForceTemp", "fForceTemp", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("fShortName", "fShortName", "", GH_ParamAccess.item, true); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.Register_GenericParam("LoadCombination", "LoadCombination", ""); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var loadGroups = new List(); + DA.GetDataList("LoadGroups", loadGroups); + + if(loadGroups.Count == 0) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Input parameter 'LoadGroups' failed to collect data"); + return; + } + + var _loadCases = new List(); + + foreach (var loadGroup in loadGroups) + { + if(loadGroup.ModelLoadGroupPermanent != null) + { + _loadCases.AddRange(loadGroup.ModelLoadGroupPermanent.LoadCase); + } + else if(loadGroup.ModelLoadGroupTemporary != null) + { + _loadCases.AddRange(loadGroup.ModelLoadGroupTemporary.LoadCase); + } + } + + _loadCases = _loadCases.Distinct().ToList(); + + string combinationMethod = "EN 1990 6.4.3(6.10)"; + DA.GetData("CombinationMethod", ref combinationMethod); + + LoadCombinationMethod _combinationMethod = FemDesign.GenericClasses.EnumParser.Parse(combinationMethod); + + var fU = true; + DA.GetData("fU", ref fU); + + var fUa = true; + DA.GetData("fUa", ref fUa); + + var fUs = true; + DA.GetData("fUs", ref fUs); + + var fSq = true; + DA.GetData("fSq", ref fSq); + + var fSf = true; + DA.GetData("fSf", ref fSf); + + var fSc = true; + DA.GetData("fSc", ref fSc); + + var fSeisSigned = true; + DA.GetData("fSeisSigned", ref fSeisSigned); + + var fSeisTorsion = true; + DA.GetData("fSeisTorsion", ref fSeisTorsion); + + var fSeisZdir = false; + DA.GetData("fSeisZdir", ref fSeisZdir); + + var fSkipMinDL = true; + DA.GetData("fSkipMinDL", ref fSkipMinDL); + + var fForceTemp = true; + DA.GetData("fForceTemp", ref fForceTemp); + + var fShortName = true; + DA.GetData("fShortName", ref fShortName); + + var loadCombinations = new List(); + + // Create Task + var t = Task.Run(() => + { + var connection = new FemDesignConnection( minimized: true, tempOutputDir: false); + + var model = new Model(Country.S, loadCases: _loadCases, loadGroups: loadGroups); + model.Entities.Loads.LoadGroupTable.SimpleCombinationMethod = _combinationMethod; + + connection.Open(model); + + connection.LoadGroupToLoadComb(fU, fUa, fUs, fSq, fSf, fSc, fSeisSigned, fSeisTorsion, fSeisZdir, fSkipMinDL, fForceTemp, fShortName); + + loadCombinations = connection.GetLoadCombinations().Values.ToList(); + + // Close FEM-Design + connection.Dispose(); + }); + + t.ConfigureAwait(false); + try + { + t.Wait(); + } + catch (Exception ex) + { + throw ex.InnerException; + } + + DA.SetDataList("LoadCombination", loadCombinations); + } + + protected override void BeforeSolveInstance() + { + ValueListUtils.UpdateValueLists(this, 1, new List + { "EN 1990 6.4.3(6.10)", "EN 1990 6.4.3(6.10.a, b)" }, null, GH_ValueListMode.DropDown); + } + + + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.LoadGroupToComb; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{9E952662-2BF2-4727-ABAA-094FA2D67DF9}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.hidden; + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Materials/MaterialDatabase.cs b/FemDesign.Grasshopper/Materials/MaterialDatabase.cs index 7f8b58ece..8e2453fc6 100644 --- a/FemDesign.Grasshopper/Materials/MaterialDatabase.cs +++ b/FemDesign.Grasshopper/Materials/MaterialDatabase.cs @@ -16,7 +16,7 @@ public MaterialDatabase() : base(" MaterialDatabase", "MaterialDatabase", "Load } protected override void RegisterInputParams(GH_InputParamManager pManager) { - pManager.AddTextParameter("CountryCode", "CountryCode", "Connect 'ValueList' to get the options.\nNational annex of calculation code: B/COMMON/D/DK/E/EST/FIN/GB/H/LT/N/NL/PL/RO/S/TR\n\nNote: TR (Turkish) doesn't contain the plastic material properties.", GH_ParamAccess.item, "S"); + pManager.AddTextParameter("CountryCode", "CountryCode", "Connect 'ValueList' to get the options.\nNational annex of calculation code: B/COMMON/D/DK/E/EST/FIN/GB/H/LT/N/NL/PL/RO/S/TR\n\nNote: the TR (Turkish) national annex is no longer supported by FEM-Design. The default material database doesn't contain the plastic material properties for code 'TR'.", GH_ParamAccess.item, "S"); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddTextParameter("FilePath", "FilePath", "File path to .struxml file.\nnote: `CountryCode` will not be use if `FilePath` is specified", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -77,9 +77,7 @@ public override Guid ComponentGuid protected override void BeforeSolveInstance() { - ValueListUtils.UpdateValueLists(this, 0, new List - { "B","COMMON","D","DK","E","EST","FIN","GB","H","LT","N","NL","PL","RO","S","TR" - }, null, GH_ValueListMode.DropDown); + ValueListUtils.UpdateValueLists(this, 0, Enum.GetNames(typeof(Country)).ToList(), null, GH_ValueListMode.DropDown); } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Model/ModelConstruct.cs b/FemDesign.Grasshopper/Model/ModelConstruct.cs index b275119d1..f089e2e01 100644 --- a/FemDesign.Grasshopper/Model/ModelConstruct.cs +++ b/FemDesign.Grasshopper/Model/ModelConstruct.cs @@ -19,7 +19,7 @@ public class ModelConstruct : FEM_Design_API_Component } protected override void RegisterInputParams(GH_InputParamManager pManager) { - pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code.\nConnect 'ValueList' to get the options.\nD,DK,EST,FIN,GB,H,N,PL,RO,S,TR,NL", GH_ParamAccess.item, "S"); + pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code.\nConnect 'ValueList' to get the options.\nB/COMMON/D/DK/E/EST/FIN/GB/H/LT/N/NL/PL/RO/S/TR\n\nNote: the TR (Turkish) national annex is no longer supported by FEM-Design.", GH_ParamAccess.item, "S"); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddGenericParameter("Structure Elements", "Elements", "Single structure element or list of structure elements to add. Nested lists are not supported.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; diff --git a/FemDesign.Grasshopper/ModellingTools/FictitiousShellConstruct.cs b/FemDesign.Grasshopper/ModellingTools/FictitiousShellConstruct.cs index e2b32359e..bd0ee71f4 100644 --- a/FemDesign.Grasshopper/ModellingTools/FictitiousShellConstruct.cs +++ b/FemDesign.Grasshopper/ModellingTools/FictitiousShellConstruct.cs @@ -30,7 +30,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager[pManager.ParamCount - 1].Optional = true; pManager.AddBooleanParameter("IgnoreInStImpCalc", "IgnoreInStImpCalc", "Ignore in stability/imperfection calculation", GH_ParamAccess.item, false); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "Optional, rigid if undefined.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "Optional, rigid if undefined.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -48,102 +48,60 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) protected override void SolveInstance(IGH_DataAccess DA) { Rhino.Geometry.Brep brep = null; - if (!DA.GetData(0, ref brep)) - { - return; - } + if (!DA.GetData(0, ref brep)) { return; } ModellingTools.StiffnessMatrix4Type d = null; - if (!DA.GetData(1, ref d)) - { - return; - } + if (!DA.GetData(1, ref d)) { return; } ModellingTools.StiffnessMatrix4Type k = null; - if (!DA.GetData(2, ref k)) - { - return; - } + if (!DA.GetData(2, ref k)) { return; } ModellingTools.StiffnessMatrix2Type h = null; - if (!DA.GetData(3, ref h)) - { - return; - } + if (!DA.GetData(3, ref h)) { return; } double density = 1; - if (!DA.GetData(4, ref density)) - { - // pass - } + DA.GetData(4, ref density); double t1 = 0.1; - if (!DA.GetData(5, ref t1)) - { - // pass - } + DA.GetData(5, ref t1); double t2 = 0.1; - if (!DA.GetData(6, ref t2)) - { - // pass - } + DA.GetData(6, ref t2); double alpha1 = 0.00001; - if (!DA.GetData(7, ref alpha1)) - { - // pass - } + DA.GetData(7, ref alpha1); double alpha2 = 0.00001; - if (!DA.GetData(8, ref alpha2)) - { - // pass - } + DA.GetData(8, ref alpha2); bool ignore = false; - if (!DA.GetData(9, ref ignore)) - { - // pass - } + DA.GetData(9, ref ignore); - Shells.EdgeConnection edgeConnection = Shells.EdgeConnection.Default; - if (!DA.GetData(10, ref edgeConnection)) - { - // pass - } + List edgeConnections = new List(); + DA.GetDataList(10, edgeConnections); Rhino.Geometry.Vector3d x = Vector3d.Zero; - if (!DA.GetData(11, ref x)) - { - // pass - } + DA.GetData(11, ref x); Rhino.Geometry.Vector3d z = Vector3d.Zero; - if (!DA.GetData(12, ref z)) - { - // pass - } + DA.GetData(12, ref z); double mesh = 0; - if (!DA.GetData(13, ref mesh)) - { - // pass - } + DA.GetData(13, ref mesh); string identifier = "FS"; - if (!DA.GetData(14, ref identifier)) - { - // pass - } + DA.GetData(14, ref identifier); // convert geometry Geometry.Region region = brep.FromRhino(); // add edge connection - region.SetEdgeConnections(edgeConnection); + if(edgeConnections?.Count == 0 || edgeConnections == null) + region.SetEdgeConnections(FemDesign.Shells.EdgeConnection.Default); + else + region.SetEdgeConnections(edgeConnections); - // + // create fictitious shell ModellingTools.FictitiousShell obj = new ModellingTools.FictitiousShell(region, d, k, h, density, t1, t2, alpha1, alpha2, ignore, mesh, identifier); // set local x-axis @@ -170,7 +128,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("f9544346-eb4d-455e-804c-fee34b0d16a6"); } + get { return new Guid("{9C98A02F-8FA0-4BDE-8C7D-E60984316545}"); } } public override GH_Exposure Exposure => GH_Exposure.secondary; diff --git a/FemDesign.Grasshopper/ModellingTools/FictitiousShellSetEdgeConnection.cs b/FemDesign.Grasshopper/ModellingTools/FictitiousShellSetEdgeConnection.cs index 22d690de2..b7fc12544 100644 --- a/FemDesign.Grasshopper/ModellingTools/FictitiousShellSetEdgeConnection.cs +++ b/FemDesign.Grasshopper/ModellingTools/FictitiousShellSetEdgeConnection.cs @@ -7,14 +7,14 @@ namespace FemDesign.Grasshopper { public class FictitiousShellSetEdgeConnection: FEM_Design_API_Component { - public FictitiousShellSetEdgeConnection(): base("FictitiousShell.SetEdgeConnection", "SetEdgeConnection", "Set EdgeConnection by index. Index for each respective edge can be extracted using FictitiousShellDeconstruct.", "FEM-Design", "ModellingTools") + public FictitiousShellSetEdgeConnection(): base("FictitiousShell.SetEdgeConnection", "SetEdgeConnection", "Set EdgeConnection by index. Index for each respective edge can be extracted using FictitiousShellDeconstruct.", CategoryName.Name(), "ModellingTools") { } protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddGenericParameter("FictitiousShell", "FictitiousShell", "FictitiousShell.", GH_ParamAccess.item); - pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection.", GH_ParamAccess.list); pManager.AddIntegerParameter("Index", "Index", "Index for edge.", GH_ParamAccess.list); } protected override void RegisterOutputParams(GH_OutputParamManager pManager) @@ -23,31 +23,40 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { - // get input + // get inputs FemDesign.ModellingTools.FictitiousShell fictShell = null; - FemDesign.Shells.EdgeConnection shellEdgeConnection = null; + if (!DA.GetData(0, ref fictShell)){ return; } + if (fictShell == null) { return; } + + List edgeConnections = new List(); + if (!DA.GetDataList(1, edgeConnections)) { return; } + List indices = new List(); - if (!DA.GetData(0, ref fictShell)) + if (!DA.GetDataList(2, indices)) { return; } + + // set edge connections on object + ModellingTools.FictitiousShell obj; + if (edgeConnections.Count == 0) { + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, $"No edge connection added to fictious shell {fictShell.Name}"); return; } - if (!DA.GetData(1, ref shellEdgeConnection)) + else if (edgeConnections.Count == 1) { - return; + obj = ModellingTools.FictitiousShell.UpdateEdgeConnection(fictShell, edgeConnections[0], indices); } - if (!DA.GetDataList(2, indices)) + else if (edgeConnections.Count == indices.Count) { - return; + obj = ModellingTools.FictitiousShell.UpdateEdgeConnection(fictShell, edgeConnections[0], indices[0]); + for (int i = 0; i < edgeConnections.Count; i++) + obj = ModellingTools.FictitiousShell.UpdateEdgeConnection(obj, edgeConnections[i], indices[i]); } - if (fictShell == null) + else { - return; + throw new ArgumentException($"The number of EdgeConnections must be 1 or equal to the number of indices provided. Recieved {edgeConnections.Count} and {indices.Count}"); } - // - FemDesign.ModellingTools.FictitiousShell obj = FemDesign.ModellingTools.FictitiousShell.UpdateEdgeConnection(fictShell, shellEdgeConnection, indices); - - // + // get output DA.SetData(0, obj); } protected override System.Drawing.Bitmap Icon @@ -59,7 +68,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("41ca29fd-c058-4272-8409-f201ff1496eb"); } + get { return new Guid("{0D7CA5E0-B3C4-4EA4-8856-FE4B21E6143C}"); } } public override GH_Exposure Exposure => GH_Exposure.secondary; diff --git a/FemDesign.Grasshopper/ModellingTools/OBSOLETE/FictitiousShellConstruct_OBSOLETE2304.cs b/FemDesign.Grasshopper/ModellingTools/OBSOLETE/FictitiousShellConstruct_OBSOLETE2304.cs new file mode 100644 index 000000000..6879bc4ec --- /dev/null +++ b/FemDesign.Grasshopper/ModellingTools/OBSOLETE/FictitiousShellConstruct_OBSOLETE2304.cs @@ -0,0 +1,179 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class FictitiousShellConstruct_OBSOLETE2304 : FEM_Design_API_Component + { + public FictitiousShellConstruct_OBSOLETE2304(): base("FictitiousShell.Construct", "Construct", "Construct a fictitious shell", "FEM-Design", "ModellingTools") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Srf", "Surface.", GH_ParamAccess.item); + pManager.AddGenericParameter("StiffnessMatrix4Type", "D", "Membrane stiffness matrix", GH_ParamAccess.item); + pManager.AddGenericParameter("StiffnessMatrix4Type", "K", "Flexural stiffness matrix", GH_ParamAccess.item); + pManager.AddGenericParameter("StiffnessMatrix2Type", "H", "Shear stiffness matrix", GH_ParamAccess.item); + pManager.AddNumberParameter("Density", "Density", "Density [t/m2]", GH_ParamAccess.item, 1); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("t1", "t1", "t1 [m]", GH_ParamAccess.item, 0.1); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("t2", "t2", "t2 [m]", GH_ParamAccess.item, 0.1); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("Alpha1", "Alpha1", "Alpha1 [1/°C]", GH_ParamAccess.item, 0.00001); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("Alpha2", "Alpha2", "Alpha2 [1/°C]", GH_ParamAccess.item, 0.00001); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("IgnoreInStImpCalc", "IgnoreInStImpCalc", "Ignore in stability/imperfection calculation", GH_ParamAccess.item, false); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "Optional, rigid if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("AverageSurfaceElementSize", "AvgSrfElemSize", "Finite element size. Set average surface element size. If set to 0 FEM-Design will automatically caculate the average surface element size. [m]", GH_ParamAccess.item, 0); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier.", GH_ParamAccess.item, "FS"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("FictitiousShell", "FS", "FictitiousShell", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + Rhino.Geometry.Brep brep = null; + if (!DA.GetData(0, ref brep)) + { + return; + } + + ModellingTools.StiffnessMatrix4Type d = null; + if (!DA.GetData(1, ref d)) + { + return; + } + + ModellingTools.StiffnessMatrix4Type k = null; + if (!DA.GetData(2, ref k)) + { + return; + } + + ModellingTools.StiffnessMatrix2Type h = null; + if (!DA.GetData(3, ref h)) + { + return; + } + + double density = 1; + if (!DA.GetData(4, ref density)) + { + // pass + } + + double t1 = 0.1; + if (!DA.GetData(5, ref t1)) + { + // pass + } + + double t2 = 0.1; + if (!DA.GetData(6, ref t2)) + { + // pass + } + + double alpha1 = 0.00001; + if (!DA.GetData(7, ref alpha1)) + { + // pass + } + + double alpha2 = 0.00001; + if (!DA.GetData(8, ref alpha2)) + { + // pass + } + + bool ignore = false; + if (!DA.GetData(9, ref ignore)) + { + // pass + } + + Shells.EdgeConnection edgeConnection = Shells.EdgeConnection.Default; + if (!DA.GetData(10, ref edgeConnection)) + { + // pass + } + + Rhino.Geometry.Vector3d x = Vector3d.Zero; + if (!DA.GetData(11, ref x)) + { + // pass + } + + Rhino.Geometry.Vector3d z = Vector3d.Zero; + if (!DA.GetData(12, ref z)) + { + // pass + } + + double mesh = 0; + if (!DA.GetData(13, ref mesh)) + { + // pass + } + + string identifier = "FS"; + if (!DA.GetData(14, ref identifier)) + { + // pass + } + + // convert geometry + Geometry.Region region = brep.FromRhino(); + + // add edge connection + region.SetEdgeConnections(edgeConnection); + + // + ModellingTools.FictitiousShell obj = new ModellingTools.FictitiousShell(region, d, k, h, density, t1, t2, alpha1, alpha2, ignore, mesh, identifier); + + // set local x-axis + if (!x.Equals(Vector3d.Zero)) + { + obj.LocalX = x.FromRhino(); + } + + // set local z-axis + if (!z.Equals(Vector3d.Zero)) + { + obj.LocalZ = z.FromRhino(); + } + + // return + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.FictShell; + } + } + public override Guid ComponentGuid + { + get { return new Guid("f9544346-eb4d-455e-804c-fee34b0d16a6"); } + } + + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/ModellingTools/OBSOLETE/FictitiousShellSetEdgeConnection_OBSOLETE2304.cs b/FemDesign.Grasshopper/ModellingTools/OBSOLETE/FictitiousShellSetEdgeConnection_OBSOLETE2304.cs new file mode 100644 index 000000000..980a9e6aa --- /dev/null +++ b/FemDesign.Grasshopper/ModellingTools/OBSOLETE/FictitiousShellSetEdgeConnection_OBSOLETE2304.cs @@ -0,0 +1,68 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; + +namespace FemDesign.Grasshopper +{ + public class FictitiousShellSetEdgeConnection_OBSOLETE2304 : FEM_Design_API_Component + { + public FictitiousShellSetEdgeConnection_OBSOLETE2304(): base("FictitiousShell.SetEdgeConnection", "SetEdgeConnection", "Set EdgeConnection by index. Index for each respective edge can be extracted using FictitiousShellDeconstruct.", "FEM-Design", "ModellingTools") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("FictitiousShell", "FictitiousShell", "FictitiousShell.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection.", GH_ParamAccess.item); + pManager.AddIntegerParameter("Index", "Index", "Index for edge.", GH_ParamAccess.list); + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("FictitiousShell", "FictitiousShell", "Passed FictitiousShell.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + FemDesign.ModellingTools.FictitiousShell fictShell = null; + FemDesign.Shells.EdgeConnection shellEdgeConnection = null; + List indices = new List(); + if (!DA.GetData(0, ref fictShell)) + { + return; + } + if (!DA.GetData(1, ref shellEdgeConnection)) + { + return; + } + if (!DA.GetDataList(2, indices)) + { + return; + } + if (fictShell == null) + { + return; + } + + // + FemDesign.ModellingTools.FictitiousShell obj = FemDesign.ModellingTools.FictitiousShell.UpdateEdgeConnection(fictShell, shellEdgeConnection, indices); + + // + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.SlabSetEdgeConnection; + } + } + public override Guid ComponentGuid + { + get { return new Guid("41ca29fd-c058-4272-8409-f201ff1496eb"); } + } + + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Pipe/PipeResultFromBsc.cs b/FemDesign.Grasshopper/Pipe/PipeResultFromBsc.cs index 1b82d9838..0884ca242 100644 --- a/FemDesign.Grasshopper/Pipe/PipeResultFromBsc.cs +++ b/FemDesign.Grasshopper/Pipe/PipeResultFromBsc.cs @@ -90,13 +90,12 @@ public override void DoWork(Action ReportProgress, Action Done) ReportProgress("", ""); - var results = bscPath.Zip(csvPath, (bsc, csv) => _connection.GetResultsFromBsc(bsc, csv) ).ToList(); + var results = bscPath.Zip(csvPath, (bsc, csv) => _connection.GetResultsFromBsc(bsc, csv) ); int i = 0; foreach( var result in results) { - string[] lines = result.Split( new string[] { Environment.NewLine }, StringSplitOptions.None ); - _results.AddRange(lines, new GH_Path(i)); + _results.AddRange(result, new GH_Path(i)); i++; } _success = true; diff --git a/FemDesign.Grasshopper/Properties/Resources.resx b/FemDesign.Grasshopper/Properties/Resources.resx index a8c39591d..b43b6dbf2 100644 --- a/FemDesign.Grasshopper/Properties/Resources.resx +++ b/FemDesign.Grasshopper/Properties/Resources.resx @@ -7320,64 +7320,64 @@ ..\Resources\icons\Mass.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons\ExcitationForce.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons\ExcitationForceCombination.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons\ExcitationForceDiagram.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + - ..\Resources\CombDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\CombDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\CombDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\CombDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\ExcitationForceDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\ExcitationForceSettings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\FootfallDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\FootfallDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\FootfallDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\FootfallDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\FreqDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\FreqDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\FreqDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\FreqDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\GroundAccelerationDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\GroundAccelerationDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\GroundAccelerationDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\GroundAccelerationDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\ImperfectionDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\ImperfectionDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\ImperfectionDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\ImperfectionDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\PeriodicExcitationDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\PeriodicExcitationDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\PeriodicExcitationDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\PeriodicExcitationDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\StabilityDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\StabilityDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\StabilityDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\StabilityDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\StageDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\StageDefine2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\StageDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons\ExcitationForce.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons\ExcitationForceCombination.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons\ExcitationForceDiagram.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons\StageDefine3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/FemDesign.Grasshopper/Reinforcement/PostTensionCable/Reinforcement.Ptc.cs b/FemDesign.Grasshopper/Reinforcement/PostTensionCable/Reinforcement.Ptc.cs index f4e3ee1cd..dbea237ca 100644 --- a/FemDesign.Grasshopper/Reinforcement/PostTensionCable/Reinforcement.Ptc.cs +++ b/FemDesign.Grasshopper/Reinforcement/PostTensionCable/Reinforcement.Ptc.cs @@ -11,7 +11,7 @@ namespace FemDesign.Grasshopper { public class ReinforcementPtc : FEM_Design_API_Component { - public static readonly List JackingSideValueList = Enum.GetNames(typeof(StruSoft.Interop.StruXml.Data.Ptc_jacking_side)).ToList(); + public static readonly List JackingSideValueList = Enum.GetNames(typeof(JackingSide)).ToList(); public static string JackingSideValueListDescription { get diff --git a/FemDesign.Grasshopper/Reinforcement/SurfaceReinforcementLayout.cs b/FemDesign.Grasshopper/Reinforcement/SurfaceReinforcementLayout.cs index 2219e84d4..41ebb6ae5 100644 --- a/FemDesign.Grasshopper/Reinforcement/SurfaceReinforcementLayout.cs +++ b/FemDesign.Grasshopper/Reinforcement/SurfaceReinforcementLayout.cs @@ -1,6 +1,11 @@ // https://strusoft.com/ using System; +using System.Linq; + using Grasshopper.Kernel; +using Grasshopper.Kernel.Special; + +using FemDesign.Grasshopper.Extension.ComponentExtension; using FemDesign.GenericClasses; using FemDesign.Reinforcement; @@ -14,9 +19,9 @@ public class SurfaceReinforcementLayout: FEM_Design_API_Component } protected override void RegisterInputParams(GH_InputParamManager pManager) { - pManager.AddTextParameter("Direction", "Direction", "Reinforcement layout direction. Allowed values: x/y.", GH_ParamAccess.item); + pManager.AddTextParameter("Direction", "Direction", "Reinforcement layout direction. Connect 'ValueList' to get the options.\n\nAllowed values:\nx\ny", GH_ParamAccess.item); pManager.AddNumberParameter("Space", "Space", "Spacing between bars. [m]", GH_ParamAccess.item); - pManager.AddTextParameter("Face", "Face", "Surface reinforcement face. Allowed values: top/mid/bottom.", GH_ParamAccess.item); + pManager.AddTextParameter("Face", "Face", "Surface reinforcement face. Connect 'ValueList' to get the options.\n\nAllowed values:\ntop\nmid\nbottom", GH_ParamAccess.item); pManager.AddNumberParameter("Cover", "Cover", "Reinforcement concrete cover. [m]", GH_ParamAccess.item, 0.02); pManager[pManager.ParamCount - 1].Optional = true; } @@ -50,13 +55,18 @@ protected override void SolveInstance(IGH_DataAccess DA) return; } - Face _face = EnumParser.Parse(face); ReinforcementDirection _direction = EnumParser.Parse(direction); + Face _face = EnumParser.Parse(face); FemDesign.Reinforcement.Straight obj = new FemDesign.Reinforcement.Straight(_direction, space, _face, cover); // return DA.SetData(0, obj); } + protected override void BeforeSolveInstance() + { + ValueListUtils.UpdateValueLists(this, 0, Enum.GetNames(typeof(ReinforcementDirection)).ToList(), null, GH_ValueListMode.DropDown); + ValueListUtils.UpdateValueLists(this, 2, Enum.GetNames(typeof(Face)).ToList(), null, GH_ValueListMode.DropDown); + } protected override System.Drawing.Bitmap Icon { get diff --git a/FemDesign.Grasshopper/Reinforcement/WireDefine.cs b/FemDesign.Grasshopper/Reinforcement/WireDefine.cs index eaf87b3c7..6cf17ece1 100644 --- a/FemDesign.Grasshopper/Reinforcement/WireDefine.cs +++ b/FemDesign.Grasshopper/Reinforcement/WireDefine.cs @@ -1,10 +1,15 @@ // https://strusoft.com/ using System; +using System.Linq; using System.Collections.Generic; + using Grasshopper.Kernel; +using Grasshopper.Kernel.Special; using Rhino.Geometry; + using FemDesign.GenericClasses; using FemDesign.Reinforcement; +using FemDesign.Grasshopper.Extension.ComponentExtension; namespace FemDesign.Grasshopper { @@ -18,7 +23,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddNumberParameter("Diameter", "Diameter", "Diameter of reinforcement bar.", GH_ParamAccess.item); pManager.AddGenericParameter("Material", "Material", "Material of reinforcement bar.", GH_ParamAccess.item); - pManager.AddTextParameter("Profile", "Profile", "Profile of reinforcement bar. Allowed values: smooth/ribbed", GH_ParamAccess.item, "ribbed"); + pManager.AddTextParameter("Profile", "Profile", "Profile of reinforcement bar. Connect 'ValueList' to get the options.\n\nAllowed values:\nsmooth\nribbed", GH_ParamAccess.item, "ribbed"); pManager[pManager.ParamCount - 1].Optional = true; } protected override void RegisterOutputParams(GH_OutputParamManager pManager) @@ -42,6 +47,10 @@ protected override void SolveInstance(IGH_DataAccess DA) DA.SetData(0, obj); } + protected override void BeforeSolveInstance() + { + ValueListUtils.UpdateValueLists(this, 2, Enum.GetNames(typeof(WireProfileType)).ToList(), null, GH_ValueListMode.DropDown); + } protected override System.Drawing.Bitmap Icon { get diff --git a/FemDesign.Grasshopper/Resources/ExcitationForceDefine2.png b/FemDesign.Grasshopper/Resources/ExcitationForceDefine2.png deleted file mode 100644 index 8c3540d65..000000000 Binary files a/FemDesign.Grasshopper/Resources/ExcitationForceDefine2.png and /dev/null differ diff --git a/FemDesign.Grasshopper/Resources/CombDefine2.png b/FemDesign.Grasshopper/Resources/icons/CombDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/CombDefine2.png rename to FemDesign.Grasshopper/Resources/icons/CombDefine2.png diff --git a/FemDesign.Grasshopper/Resources/CombDefine3.png b/FemDesign.Grasshopper/Resources/icons/CombDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/CombDefine3.png rename to FemDesign.Grasshopper/Resources/icons/CombDefine3.png diff --git a/FemDesign.Grasshopper/Resources/ExcitationForceDefine3.png b/FemDesign.Grasshopper/Resources/icons/ExcitationForceSettings.png similarity index 100% rename from FemDesign.Grasshopper/Resources/ExcitationForceDefine3.png rename to FemDesign.Grasshopper/Resources/icons/ExcitationForceSettings.png diff --git a/FemDesign.Grasshopper/Resources/Fd_TabIcon_24_24.png b/FemDesign.Grasshopper/Resources/icons/Fd_TabIcon_24_24.png similarity index 100% rename from FemDesign.Grasshopper/Resources/Fd_TabIcon_24_24.png rename to FemDesign.Grasshopper/Resources/icons/Fd_TabIcon_24_24.png diff --git a/FemDesign.Grasshopper/Resources/FootfallDefine2.png b/FemDesign.Grasshopper/Resources/icons/FootfallDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/FootfallDefine2.png rename to FemDesign.Grasshopper/Resources/icons/FootfallDefine2.png diff --git a/FemDesign.Grasshopper/Resources/FootfallDefine3.png b/FemDesign.Grasshopper/Resources/icons/FootfallDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/FootfallDefine3.png rename to FemDesign.Grasshopper/Resources/icons/FootfallDefine3.png diff --git a/FemDesign.Grasshopper/Resources/FreqDefine2.png b/FemDesign.Grasshopper/Resources/icons/FreqDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/FreqDefine2.png rename to FemDesign.Grasshopper/Resources/icons/FreqDefine2.png diff --git a/FemDesign.Grasshopper/Resources/FreqDefine3.png b/FemDesign.Grasshopper/Resources/icons/FreqDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/FreqDefine3.png rename to FemDesign.Grasshopper/Resources/icons/FreqDefine3.png diff --git a/FemDesign.Grasshopper/Resources/GroundAccelerationDefine2.png b/FemDesign.Grasshopper/Resources/icons/GroundAccelerationDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/GroundAccelerationDefine2.png rename to FemDesign.Grasshopper/Resources/icons/GroundAccelerationDefine2.png diff --git a/FemDesign.Grasshopper/Resources/GroundAccelerationDefine3.png b/FemDesign.Grasshopper/Resources/icons/GroundAccelerationDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/GroundAccelerationDefine3.png rename to FemDesign.Grasshopper/Resources/icons/GroundAccelerationDefine3.png diff --git a/FemDesign.Grasshopper/Resources/ImperfectionDefine2.png b/FemDesign.Grasshopper/Resources/icons/ImperfectionDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/ImperfectionDefine2.png rename to FemDesign.Grasshopper/Resources/icons/ImperfectionDefine2.png diff --git a/FemDesign.Grasshopper/Resources/ImperfectionDefine3.png b/FemDesign.Grasshopper/Resources/icons/ImperfectionDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/ImperfectionDefine3.png rename to FemDesign.Grasshopper/Resources/icons/ImperfectionDefine3.png diff --git a/FemDesign.Grasshopper/Resources/PeriodicExcitationDefine2.png b/FemDesign.Grasshopper/Resources/icons/PeriodicExcitationDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/PeriodicExcitationDefine2.png rename to FemDesign.Grasshopper/Resources/icons/PeriodicExcitationDefine2.png diff --git a/FemDesign.Grasshopper/Resources/PeriodicExcitationDefine3.png b/FemDesign.Grasshopper/Resources/icons/PeriodicExcitationDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/PeriodicExcitationDefine3.png rename to FemDesign.Grasshopper/Resources/icons/PeriodicExcitationDefine3.png diff --git a/FemDesign.Grasshopper/Resources/StabilityDefine2.png b/FemDesign.Grasshopper/Resources/icons/StabilityDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/StabilityDefine2.png rename to FemDesign.Grasshopper/Resources/icons/StabilityDefine2.png diff --git a/FemDesign.Grasshopper/Resources/StabilityDefine3.png b/FemDesign.Grasshopper/Resources/icons/StabilityDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/StabilityDefine3.png rename to FemDesign.Grasshopper/Resources/icons/StabilityDefine3.png diff --git a/FemDesign.Grasshopper/Resources/StageDefine2.png b/FemDesign.Grasshopper/Resources/icons/StageDefine2.png similarity index 100% rename from FemDesign.Grasshopper/Resources/StageDefine2.png rename to FemDesign.Grasshopper/Resources/icons/StageDefine2.png diff --git a/FemDesign.Grasshopper/Resources/StageDefine3.png b/FemDesign.Grasshopper/Resources/icons/StageDefine3.png similarity index 100% rename from FemDesign.Grasshopper/Resources/StageDefine3.png rename to FemDesign.Grasshopper/Resources/icons/StageDefine3.png diff --git a/FemDesign.Grasshopper/Results/LabelledSection/LabelledSectionGeometry.cs b/FemDesign.Grasshopper/Results/LabelledSection/LabelledSectionGeometry.cs new file mode 100644 index 000000000..d4bc41a54 --- /dev/null +++ b/FemDesign.Grasshopper/Results/LabelledSection/LabelledSectionGeometry.cs @@ -0,0 +1,65 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using System.Linq; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class LabelledSectionGeometry : FEM_Design_API_Component + { + public LabelledSectionGeometry() : base("LabelledSection", "LabelledSection", "Define LabelledSection from a Line or Polyline", CategoryName.Name(), SubCategoryName.Cat7b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddCurveParameter("Curve", "Curve", "Line or Polyline", GH_ParamAccess.item); + pManager.AddTextParameter("Identifier", "Identifier", "Identifier. Optional, default value if undefined.", GH_ParamAccess.item, "LS"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("LabelledSection", "LabelledSection", "", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + Rhino.Geometry.Curve curve = null; + DA.GetData(0, ref curve); + + if (!curve.TryGetPolyline(out Polyline poly)) + throw new ArgumentException("Input Curve is not 'Line' or 'Polyline'"); + + + string identifier = "LS"; + DA.GetData(1, ref identifier); + + var points = new List(); + for (int index = 0; index < poly.Count; index++) + { + points.Add(poly.ElementAt(index).FromRhino()); + } + + var labelledSection = new FemDesign.AuxiliaryResults.LabelledSection(points, identifier); + + // output + DA.SetData(0, labelledSection); + + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.LabelledSection; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{B8EF1A4A-C8F6-48A3-92E0-B6DE7CE16182}"); } + } + public override GH_Exposure Exposure => GH_Exposure.primary; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Results/LabelledSection/LabelledSection.cs b/FemDesign.Grasshopper/Results/LabelledSection/OBSOLETE/LabelledSection.cs similarity index 86% rename from FemDesign.Grasshopper/Results/LabelledSection/LabelledSection.cs rename to FemDesign.Grasshopper/Results/LabelledSection/OBSOLETE/LabelledSection.cs index 3e4597744..9002775c0 100644 --- a/FemDesign.Grasshopper/Results/LabelledSection/LabelledSection.cs +++ b/FemDesign.Grasshopper/Results/LabelledSection/OBSOLETE/LabelledSection.cs @@ -7,9 +7,9 @@ namespace FemDesign.Grasshopper { - public class LabelledSection : FEM_Design_API_Component + public class LabelledSection_OBSOLETE : FEM_Design_API_Component { - public LabelledSection() : base("LabelledSection", "LabelledSection", "Define LabelledSection from a Line or Polyline", CategoryName.Name(), SubCategoryName.Cat7b()) + public LabelledSection_OBSOLETE() : base("LabelledSection", "LabelledSection", "Define LabelledSection from a Line or Polyline", CategoryName.Name(), SubCategoryName.Cat7b()) { } @@ -59,7 +59,7 @@ public override Guid ComponentGuid { get { return new Guid("{6FC92A88-5970-4B00-B272-A7B681447F7E}"); } } - public override GH_Exposure Exposure => GH_Exposure.primary; + public override GH_Exposure Exposure => GH_Exposure.hidden; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/OBSOLETE/PanelSetExternalEdgeConnectionForContinuousAnalyticalModel_OBSOLETE2304.cs b/FemDesign.Grasshopper/Shells/OBSOLETE/PanelSetExternalEdgeConnectionForContinuousAnalyticalModel_OBSOLETE2304.cs new file mode 100644 index 000000000..b6e141553 --- /dev/null +++ b/FemDesign.Grasshopper/Shells/OBSOLETE/PanelSetExternalEdgeConnectionForContinuousAnalyticalModel_OBSOLETE2304.cs @@ -0,0 +1,71 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; + +namespace FemDesign.Grasshopper +{ + public class PanelSetExternalEdgeConnectionForContinuousAnalyticalModel_OBSOLETE2304 : FEM_Design_API_Component + { + public PanelSetExternalEdgeConnectionForContinuousAnalyticalModel_OBSOLETE2304(): base("Panel.SetExtEdgeConnectionForContAnalModel", "SetExtEdgeConnectionContAnalModel", "Set EdgeConnection by index on a panel with a continuous analytical model. Index for each respective edge can be extracted using PanelDeconstruct.", CategoryName.Name(), SubCategoryName.Cat2b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("Panel", "Panel", "Panel.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection.", GH_ParamAccess.item); + pManager.AddIntegerParameter("Index", "Index", "Index for edge.", GH_ParamAccess.list); + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("Panel", "Panel", "Passed panel.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + FemDesign.Shells.Panel panel = null; + if (!DA.GetData(0, ref panel)) + { + return; + } + + FemDesign.Shells.EdgeConnection shellEdgeConnection = null; + if (!DA.GetData(1, ref shellEdgeConnection)) + { + return; + } + + List indices = new List(); + if (!DA.GetDataList(2, indices)) + { + return; + } + if (panel == null) + { + return; + } + + // clone + FemDesign.Shells.Panel panelClone = panel.DeepClone(); + + // set edge connections + panelClone.SetExternalEdgeConnectionsForContinuousAnalyticalModel(shellEdgeConnection, indices); + + // + DA.SetData(0, panelClone); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.SlabSetEdgeConnection; + } + } + public override Guid ComponentGuid + { + get { return new Guid("a78149dd-9104-4174-a8a9-5197fed30988"); } + } + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/OBSOLETE/ProfiledPlateConstruct_OBSOLETE2304.cs b/FemDesign.Grasshopper/Shells/OBSOLETE/ProfiledPlateConstruct_OBSOLETE2304.cs new file mode 100644 index 000000000..5d90594a7 --- /dev/null +++ b/FemDesign.Grasshopper/Shells/OBSOLETE/ProfiledPlateConstruct_OBSOLETE2304.cs @@ -0,0 +1,144 @@ +// https://strusoft.com/ +using System; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class ProfiledPlateConstruct_OBSOLETE2304 : FEM_Design_API_Component + { + public ProfiledPlateConstruct_OBSOLETE2304(): base("ProfiledPlate.Construct", "Construct", "Construct a profiled plate", CategoryName.Name(), SubCategoryName.Cat2b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Srf", "Surface.", GH_ParamAccess.item); + pManager.AddGenericParameter("Material", "Mat", "Material.", GH_ParamAccess.item); + pManager.AddGenericParameter("Section", "Sec", "Section.", GH_ParamAccess.item); + pManager.AddGenericParameter("ShellEccentricity", "Eccentricity", "ShellEccentricity. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("OrthoRatio", "OrthoRatio", "Transversal flexural stiffness factor.", GH_ParamAccess.item, 1); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("BorderEdgeConnection", "BorderEdgeConnection", "EdgeConnection of the external border of the panel. Optional. If not defined hinged will be used.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("AvgMeshSize", "AverageMeshSize", "Average mesh size. If zero an automatic value will be used by FEM-Design. Optional. [m]", GH_ParamAccess.item, 0); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier. Optional.", GH_ParamAccess.item, "PP"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("ProfiledPlate", "PP", "-", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + Brep surface = null; + if (!DA.GetData(0, ref surface)) + { + return; + } + + FemDesign.Materials.Material material = null; + if (!DA.GetData(1, ref material)) + { + return; + } + + FemDesign.Sections.Section section = null; + if (!DA.GetData(2, ref section)) + { + return; + } + + FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; + if(!DA.GetData(3, ref eccentricity)) + { + // pass + } + + double orthoRatio = 1; + if(!DA.GetData(4, ref orthoRatio)) + { + // pass + } + + FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Hinged; + if(!DA.GetData(5, ref edgeConnection)) + { + // pass + } + + Rhino.Geometry.Vector3d x = Vector3d.Zero; + if (!DA.GetData(6, ref x)) + { + // pass + } + + Rhino.Geometry.Vector3d z = Vector3d.Zero; + if (!DA.GetData(7, ref z)) + { + // pass + } + + double meshSize = 0; + if (!DA.GetData(8, ref meshSize)) + { + // pass + } + + string identifier = "PP"; + if (!DA.GetData(9, ref identifier)) + { + // pass + } + + if (surface == null || material == null || section == null || eccentricity == null || edgeConnection == null || identifier == null) + { + return; + } + + + FemDesign.Geometry.Region region = surface.FromRhino(); + + // + FemDesign.Shells.Panel obj = FemDesign.Shells.Panel.DefaultContreteContinuous(region, edgeConnection, material, section, identifier, orthoRatio, eccentricity); + + // set local x-axis + if (!x.Equals(Vector3d.Zero)) + { + obj.LocalX = x.FromRhino(); + } + + // set local z-axis + if (!z.Equals(Vector3d.Zero)) + { + obj.LocalZ = z.FromRhino(); + } + + // set uniform average mesh size + obj.UniformAvgMeshSize = meshSize; + + // return + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.ProfiledPlateDefine; + } + } + public override Guid ComponentGuid + { + get { return new Guid("f2cc84f9-9831-414f-916d-65b1163ac1ce"); } + } + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/OBSOLETE/SlabPlateVariableThickness_OBSOLETE2304.cs b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabPlateVariableThickness_OBSOLETE2304.cs new file mode 100644 index 000000000..a94293c2e --- /dev/null +++ b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabPlateVariableThickness_OBSOLETE2304.cs @@ -0,0 +1,109 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class SlabPlateVariableThickness_OBSOLETE2304 : FEM_Design_API_Component + { + public SlabPlateVariableThickness_OBSOLETE2304(): base("PlateVariableThickness.Construct", "Construct", "Construct a plate element with variable thickness.", CategoryName.Name(), SubCategoryName.Cat2b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Surface", "Surface must be flat", GH_ParamAccess.item); + pManager.AddGenericParameter("Thickness", "Thickness", "Thickness. List of 3 items [t1, t2, t3]. [m]", GH_ParamAccess.list); + pManager.AddGenericParameter("Material", "Material", "Material.", GH_ParamAccess.item); + pManager.AddGenericParameter("ShellEccentricity", "Eccentricity", "ShellEccentricity. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier.", GH_ParamAccess.item, "P"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("Slab", "Slab", "Slab.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get inputs + Brep surface = null; + if(!DA.GetData(0, ref surface)) { return; } + + List thickness = new List(); + if(!DA.GetDataList(1, thickness)) { return; } + + FemDesign.Materials.Material material = null; + if(!DA.GetData(2, ref material)) { return; } + + FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; + DA.GetData(3, ref eccentricity); + + FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; + DA.GetData(4, ref orthotropy); + + FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; + DA.GetData(5, ref edgeConnection); + + Rhino.Geometry.Vector3d x = Vector3d.Zero; + DA.GetData(6, ref x); + + Rhino.Geometry.Vector3d z = Vector3d.Zero; + DA.GetData(7, ref z); + + string identifier = "P"; + DA.GetData(8, ref identifier); + + + if (surface == null || thickness == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null) { return; } + if (thickness.Count != 3) + { + throw new System.ArgumentException("Thickness must contain exactly 3 items."); + } + + // + FemDesign.Geometry.Region region = surface.FromRhino(); + + // + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Plate(identifier, material, region, edgeConnection, eccentricity, orthotropy, thickness); + + // set local x-axis + if (!x.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalX = x.FromRhino(); + } + + // set local z-axis + if (!z.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalZ = z.FromRhino(); + } + + // return + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.PlateVariableThickness; + } + } + public override Guid ComponentGuid + { + get { return new Guid("1a00487a-beed-49ba-b9e9-d4b45c201c4b"); } + } + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/OBSOLETE/SlabPlate_OBSOLETE2304.cs b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabPlate_OBSOLETE2304.cs new file mode 100644 index 000000000..8715a265a --- /dev/null +++ b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabPlate_OBSOLETE2304.cs @@ -0,0 +1,127 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class SlabPlate_OBSOLETE2304: FEM_Design_API_Component + { + public SlabPlate_OBSOLETE2304(): base("Plate", "Construct", "Construct a plate element.", CategoryName.Name(), SubCategoryName.Cat2b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Surface", "Surface must be flat.", GH_ParamAccess.item); + pManager.AddNumberParameter("Thickness", "Thickness", "Thickness. [m]", GH_ParamAccess.item, 0.15); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("Material", "Material", "Material.", GH_ParamAccess.item); + pManager.AddGenericParameter("ShellEccentricity", "Eccentricity", "ShellEccentricity. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier. Optional.", GH_ParamAccess.item, "P"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("Slab", "Slab", "Slab.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + Brep surface = null; + if(!DA.GetData(0, ref surface)) { return; } + + double thickness = 0.15; + DA.GetData(1, ref thickness); + + FemDesign.Materials.Material material = null; + if(!DA.GetData(2, ref material)) { return; } + + FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; + if(!DA.GetData(3, ref eccentricity)) + { + // pass + } + + FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; + if(!DA.GetData(4, ref orthotropy)) + { + // pass + } + + FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; + if(!DA.GetData(5, ref edgeConnection)) + { + // pass + } + + Rhino.Geometry.Vector3d x = Vector3d.Zero; + if (!DA.GetData(6, ref x)) + { + // pass + } + + Rhino.Geometry.Vector3d z = Vector3d.Zero; + if (!DA.GetData(7, ref z)) + { + // pass + } + + string identifier = "P"; + if(!DA.GetData(8, ref identifier)) + { + // pass + } + + if (surface == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null || identifier == null) { return; } + + // + FemDesign.Geometry.Region region = surface.FromRhino(); + + // + List thicknessObj = new List(); + thicknessObj.Add(new FemDesign.Shells.Thickness(region.Plane.Origin, thickness)); + + // + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Plate(identifier, material, region, edgeConnection, eccentricity, orthotropy, thicknessObj); + + // set local x-axis + if (!x.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalX = x.FromRhino(); + } + + // set local z-axis + if (!z.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalZ = z.FromRhino(); + } + + // return + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.Plate; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{2C49099C-6ABF-4EFE-A30C-45A2B81BDC79}"); } + } + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/OBSOLETE/SlabWallVariableThickness_OBSOLETE2304.cs b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabWallVariableThickness_OBSOLETE2304.cs new file mode 100644 index 000000000..5e36a9083 --- /dev/null +++ b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabWallVariableThickness_OBSOLETE2304.cs @@ -0,0 +1,126 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class SlabWallVariableThickness_OBSOLETE2304 : FEM_Design_API_Component + { + public SlabWallVariableThickness_OBSOLETE2304(): base("Slab.WallVariableThickness", "WallVariable", "Create a wall element with variable thickness.", CategoryName.Name(), SubCategoryName.Cat2b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Surface", "Surface must be flat and vertical", GH_ParamAccess.item); + pManager.AddGenericParameter("Thickness", "Thickness", "Thickness. List of 2 items [t1, t2]. [m]", GH_ParamAccess.list); + pManager.AddGenericParameter("Material", "Material", "Material.", GH_ParamAccess.item); + pManager.AddGenericParameter("ShellEccentricity", "Eccentricity", "ShellEccentricity. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier.", GH_ParamAccess.item, "W"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("Slab", "Slab", "Slab.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + + Brep surface = null; + if(!DA.GetData(0, ref surface)) { return; } + + List thickness = new List(); + if(!DA.GetDataList(1, thickness)) { return; } + + FemDesign.Materials.Material material = null; + if(!DA.GetData(2, ref material)) { return; } + + FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; + if(!DA.GetData(3, ref eccentricity)) + { + // pass + } + + FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; + if(!DA.GetData(4, ref orthotropy)) + { + // pass + } + + FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; + if(!DA.GetData(5, ref edgeConnection)) + { + // pass + } + + Rhino.Geometry.Vector3d x = Vector3d.Zero; + if (!DA.GetData(6, ref x)) + { + // pass + } + + Rhino.Geometry.Vector3d z = Vector3d.Zero; + if (!DA.GetData(7, ref z)) + { + // pass + } + + string identifier = "W"; + if(!DA.GetData(8, ref identifier)) + { + // pass + } + if (surface == null || thickness == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null) { return; } + if (thickness.Count != 2) + { + throw new System.ArgumentException("Thickness must contain exactly 2 items."); + } + + // convert geometry + FemDesign.Geometry.Region region = surface.FromRhino(); + + // + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Wall(identifier, material, region, edgeConnection, eccentricity, orthotropy, thickness); + + // set local x-axis + if (!x.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalX = x.FromRhino(); + } + + // set local z-axis + if (!z.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalZ = z.FromRhino(); + } + + // return + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.WallVariableThickness; + } + } + public override Guid ComponentGuid + { + get { return new Guid("fb3f47d6-f58d-42ec-9a24-14419b2dfa2f"); } + } + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/OBSOLETE/SlabWall_OBSOLETE2304.cs b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabWall_OBSOLETE2304.cs new file mode 100644 index 000000000..9ae7aef14 --- /dev/null +++ b/FemDesign.Grasshopper/Shells/OBSOLETE/SlabWall_OBSOLETE2304.cs @@ -0,0 +1,126 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class SlabWall_OBSOLETE2304 : FEM_Design_API_Component + { + public SlabWall_OBSOLETE2304(): base("Wall", "Construct", "Construct a wall element.", CategoryName.Name(), SubCategoryName.Cat2b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Surface", "Surface must be flat and vertical", GH_ParamAccess.item); + pManager.AddNumberParameter("Thickness", "Thickness", "Thickness. [m]", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("Material", "Material", "Material.", GH_ParamAccess.item); + pManager.AddGenericParameter("ShellEccentricity", "Eccentricity", "ShellEccentricity. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier. Optional.", GH_ParamAccess.item, "P"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("Slab", "Slab", "Slab.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + Brep surface = null; + if(!DA.GetData(0, ref surface)) { return; } + + double thickness = 0.15; + DA.GetData(1, ref thickness); + + FemDesign.Materials.Material material = null; + if (!DA.GetData(2, ref material)) { return; } + + FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; + if(!DA.GetData(3, ref eccentricity)) + { + // pass + } + + FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; + if(!DA.GetData(4, ref orthotropy)) + { + // pass + } + + FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; + if(!DA.GetData(5, ref edgeConnection)) + { + // pass + } + + Rhino.Geometry.Vector3d x = Vector3d.Zero; + if (!DA.GetData(6, ref x)) + { + // pass + } + + Rhino.Geometry.Vector3d z = Vector3d.Zero; + if (!DA.GetData(7, ref z)) + { + // pass + } + + string identifier = "P"; + if(!DA.GetData(8, ref identifier)) + { + // pass + } + if (surface == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null || identifier == null) { return; } + + // + FemDesign.Geometry.Region region = surface.FromRhino(); + + // + List thicknessObj = new List(); + thicknessObj.Add(new FemDesign.Shells.Thickness(region.Plane.Origin, thickness)); + + // + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Wall(identifier, material, region, edgeConnection, eccentricity, orthotropy, thicknessObj); + + // set local x-axis + if (!x.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalX = x.FromRhino(); + } + + // set local z-axis + if (!z.Equals(Vector3d.Zero)) + { + obj.SlabPart.LocalZ = z.FromRhino(); + } + + // return + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.Wall; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{C3C9CD9E-BEE2-4B12-B0DE-60817FA7D2F5}"); } + } + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/OBSOLETE/TimberPlateConstruct_OBSOLETE2304.cs b/FemDesign.Grasshopper/Shells/OBSOLETE/TimberPlateConstruct_OBSOLETE2304.cs new file mode 100644 index 000000000..90bd14dc1 --- /dev/null +++ b/FemDesign.Grasshopper/Shells/OBSOLETE/TimberPlateConstruct_OBSOLETE2304.cs @@ -0,0 +1,107 @@ +// https://strusoft.com/ +using System; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class TimberPlateConstruct_OBSOLETE2304 : FEM_Design_API_Component + { + public TimberPlateConstruct_OBSOLETE2304(): base("TimberPlate.Construct", "Construct", "Construct a timber plate", CategoryName.Name(), SubCategoryName.Cat2b()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Surface", "Surface.", GH_ParamAccess.item); + pManager.AddGenericParameter("TimberPlateMaterial", "Material", "Timber plate material.", GH_ParamAccess.item); + pManager.AddVectorParameter("SpanDirection", "Direction", "Span direction of the timber plate.", GH_ParamAccess.item); + pManager.AddNumberParameter("PanelWidth", "PanelWidth", "Width of each individual CLT panel in region. 1.5m if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("ShellEccentricity", "Eccentricity", "ShellEccentricity. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("BorderEdgeConnection", "BorderEdgeConnection", "EdgeConnection of the external border of the panel. Optional. If not defined hinged will be used.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("AvgMeshSize", "AverageMeshSize", "Average mesh size. If zero an automatic value will be used by FEM-Design. Optional. [m]", GH_ParamAccess.item, 0); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier. Optional.", GH_ParamAccess.item, "PP"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("TimberPlate", "TP", "Timber plate.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + Brep surface = null; + if (!DA.GetData("Surface", ref surface)) return; + + Materials.TimberPanelType timberPlateMaterialData = null; + if (!DA.GetData("TimberPlateMaterial", ref timberPlateMaterialData)) return; + + Vector3d spanDirection = new Vector3d(); + if (!DA.GetData("SpanDirection", ref spanDirection)) return; + + double panelWidth = 1.5; + DA.GetData("PanelWidth", ref panelWidth); + + Shells.ShellEccentricity eccentricity = Shells.ShellEccentricity.Default; + DA.GetData("ShellEccentricity", ref eccentricity); + + Shells.EdgeConnection edgeConnection = Shells.EdgeConnection.Hinged; + DA.GetData("BorderEdgeConnection", ref edgeConnection); + + Rhino.Geometry.Vector3d x = Vector3d.Zero; + DA.GetData("LocalX", ref x); + + Rhino.Geometry.Vector3d z = Vector3d.Zero; + DA.GetData("LocalZ", ref z); + + double meshSize = 0; + DA.GetData("AvgMeshSize", ref meshSize); + + string identifier = "PP"; + DA.GetData("Identifier", ref identifier); + + if (surface == null || timberPlateMaterialData == null || eccentricity == null || edgeConnection == null || identifier == null) + return; + + + Geometry.Region region = surface.FromRhino(); + Geometry.Vector3d dir = spanDirection.FromRhino(); + Shells.Panel obj = Shells.Panel.DefaultTimberContinuous(region, timberPlateMaterialData, dir, edgeConnection, identifier, eccentricity, panelWidth); + + // set local x-axis + if (!x.Equals(Vector3d.Zero)) + obj.LocalX = x.FromRhino(); + + // set local z-axis + if (!z.Equals(Vector3d.Zero)) + obj.LocalZ = z.FromRhino(); + + // set uniform average mesh size + obj.UniformAvgMeshSize = meshSize; + + // return + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.PanelTimberPlateDefine; + } + } + public override Guid ComponentGuid + { + get { return new Guid("22baacb3-0b76-41f4-a5bc-cd9e60d13be7"); } + } + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Shells/PanelSetExternalEdgeConnectionForContinuousAnalyticalModel.cs b/FemDesign.Grasshopper/Shells/PanelSetExternalEdgeConnectionForContinuousAnalyticalModel.cs index 3715e0548..486a73440 100644 --- a/FemDesign.Grasshopper/Shells/PanelSetExternalEdgeConnectionForContinuousAnalyticalModel.cs +++ b/FemDesign.Grasshopper/Shells/PanelSetExternalEdgeConnectionForContinuousAnalyticalModel.cs @@ -1,6 +1,7 @@ // https://strusoft.com/ using System; using System.Collections.Generic; +using FemDesign.Shells; using Grasshopper.Kernel; namespace FemDesign.Grasshopper @@ -14,7 +15,7 @@ public class PanelSetExternalEdgeConnectionForContinuousAnalycitalModel: FEM_Des protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddGenericParameter("Panel", "Panel", "Panel.", GH_ParamAccess.item); - pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection.", GH_ParamAccess.list); pManager.AddIntegerParameter("Index", "Index", "Index for edge.", GH_ParamAccess.list); } protected override void RegisterOutputParams(GH_OutputParamManager pManager) @@ -23,25 +24,21 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { + // get inputs FemDesign.Shells.Panel panel = null; - if (!DA.GetData(0, ref panel)) - { - return; - } + if (!DA.GetData(0, ref panel)) { return; } - FemDesign.Shells.EdgeConnection shellEdgeConnection = null; - if (!DA.GetData(1, ref shellEdgeConnection)) - { - return; - } + List edgeConnections = new List(); + if (!DA.GetDataList(1, edgeConnections)) { return; } List indices = new List(); - if (!DA.GetDataList(2, indices)) - { - return; - } - if (panel == null) + if (!DA.GetDataList(2, indices)) { return; } + + // check inputs + if (panel == null || edgeConnections == null || indices == null) { return; } + if (edgeConnections.Count == 0) { + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, $"No edge connection added to panel {panel.Name}"); return; } @@ -49,9 +46,21 @@ protected override void SolveInstance(IGH_DataAccess DA) FemDesign.Shells.Panel panelClone = panel.DeepClone(); // set edge connections - panelClone.SetExternalEdgeConnectionsForContinuousAnalyticalModel(shellEdgeConnection, indices); + if(edgeConnections.Count == 1) + { + panelClone.SetExternalEdgeConnectionsForContinuousAnalyticalModel(edgeConnections[0], indices); + } + else if (edgeConnections.Count == indices.Count) + { + for (int i = 0; i < edgeConnections.Count; i++) + panelClone.SetExternalEdgeConnectionAtIndexForContinousAnalyticalModel(edgeConnections[i], indices[i]); + } + else + { + throw new ArgumentException($"The number of EdgeConnections must be 1 or equal to the number of indices provided. Recieved {edgeConnections.Count} and {indices.Count}"); + } - // + // set output DA.SetData(0, panelClone); } protected override System.Drawing.Bitmap Icon @@ -63,7 +72,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("a78149dd-9104-4174-a8a9-5197fed30988"); } + get { return new Guid("{BAB2DB6B-818D-40ED-9D62-E716C97A20C2}"); } } public override GH_Exposure Exposure => GH_Exposure.secondary; diff --git a/FemDesign.Grasshopper/Shells/ProfiledPlateConstruct.cs b/FemDesign.Grasshopper/Shells/ProfiledPlateConstruct.cs index db28cd2f7..f53c9cde3 100644 --- a/FemDesign.Grasshopper/Shells/ProfiledPlateConstruct.cs +++ b/FemDesign.Grasshopper/Shells/ProfiledPlateConstruct.cs @@ -1,5 +1,7 @@ // https://strusoft.com/ using System; +using System.Collections.Generic; +using FemDesign.Shells; using Grasshopper.Kernel; using Rhino.Geometry; @@ -20,7 +22,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager[pManager.ParamCount - 1].Optional = true; pManager.AddNumberParameter("OrthoRatio", "OrthoRatio", "Transversal flexural stiffness factor.", GH_ParamAccess.item, 1); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("BorderEdgeConnection", "BorderEdgeConnection", "EdgeConnection of the external border of the panel. Optional. If not defined hinged will be used.", GH_ParamAccess.item); + pManager.AddGenericParameter("BorderEdgeConnection", "BorderEdgeConnection", "EdgeConnection of the external border of the panel. Optional. If not defined hinged will be used.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -39,75 +41,47 @@ protected override void SolveInstance(IGH_DataAccess DA) { // get input Brep surface = null; - if (!DA.GetData(0, ref surface)) - { - return; - } + if (!DA.GetData(0, ref surface)) { return; } FemDesign.Materials.Material material = null; - if (!DA.GetData(1, ref material)) - { - return; - } + if (!DA.GetData(1, ref material)) { return; } FemDesign.Sections.Section section = null; - if (!DA.GetData(2, ref section)) - { - return; - } + if (!DA.GetData(2, ref section)) { return; } FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; - if(!DA.GetData(3, ref eccentricity)) - { - // pass - } + DA.GetData(3, ref eccentricity); double orthoRatio = 1; - if(!DA.GetData(4, ref orthoRatio)) - { - // pass - } - - FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Hinged; - if(!DA.GetData(5, ref edgeConnection)) - { - // pass - } + DA.GetData(4, ref orthoRatio); + + List edgeConnections = new List { Shells.EdgeConnection.Hinged }; + DA.GetDataList(5, edgeConnections); Rhino.Geometry.Vector3d x = Vector3d.Zero; - if (!DA.GetData(6, ref x)) - { - // pass - } + DA.GetData(6, ref x); Rhino.Geometry.Vector3d z = Vector3d.Zero; - if (!DA.GetData(7, ref z)) - { - // pass - } + DA.GetData(7, ref z); double meshSize = 0; - if (!DA.GetData(8, ref meshSize)) - { - // pass - } + DA.GetData(8, ref meshSize); string identifier = "PP"; - if (!DA.GetData(9, ref identifier)) - { - // pass - } + DA.GetData(9, ref identifier); - if (surface == null || material == null || section == null || eccentricity == null || edgeConnection == null || identifier == null) + if (surface == null || material == null || section == null || eccentricity == null || edgeConnections == null || identifier == null) { return; } + if (edgeConnections.Count == 0) { + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, $"No edge connection added!"); return; } - + // convert geometry FemDesign.Geometry.Region region = surface.FromRhino(); - // - FemDesign.Shells.Panel obj = FemDesign.Shells.Panel.DefaultContreteContinuous(region, edgeConnection, material, section, identifier, orthoRatio, eccentricity); + // create panel + FemDesign.Shells.Panel obj = FemDesign.Shells.Panel.DefaultContreteContinuous(region, edgeConnections, material, section, identifier, orthoRatio, eccentricity); // set local x-axis if (!x.Equals(Vector3d.Zero)) @@ -136,7 +110,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("f2cc84f9-9831-414f-916d-65b1163ac1ce"); } + get { return new Guid("{08931C40-C956-42A5-A007-E0C754D84848}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Shells/SlabPlate.cs b/FemDesign.Grasshopper/Shells/SlabPlate.cs index 27a3881f8..3b6b0bdac 100644 --- a/FemDesign.Grasshopper/Shells/SlabPlate.cs +++ b/FemDesign.Grasshopper/Shells/SlabPlate.cs @@ -1,6 +1,7 @@ // https://strusoft.com/ using System; using System.Collections.Generic; +using System.Linq; using Grasshopper.Kernel; using Rhino.Geometry; @@ -22,7 +23,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager[pManager.ParamCount - 1].Optional = true; pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -37,7 +38,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { - // get input + // get inputs Brep surface = null; if(!DA.GetData(0, ref surface)) { return; } @@ -48,52 +49,40 @@ protected override void SolveInstance(IGH_DataAccess DA) if(!DA.GetData(2, ref material)) { return; } FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; - if(!DA.GetData(3, ref eccentricity)) - { - // pass - } + DA.GetData(3, ref eccentricity); FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; - if(!DA.GetData(4, ref orthotropy)) - { - // pass - } + DA.GetData(4, ref orthotropy); - FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; - if(!DA.GetData(5, ref edgeConnection)) - { - // pass - } + List edgeConnections = new List(); + DA.GetDataList(5, edgeConnections); Rhino.Geometry.Vector3d x = Vector3d.Zero; - if (!DA.GetData(6, ref x)) - { - // pass - } + DA.GetData(6, ref x); Rhino.Geometry.Vector3d z = Vector3d.Zero; - if (!DA.GetData(7, ref z)) - { - // pass - } + DA.GetData(7, ref z); string identifier = "P"; - if(!DA.GetData(8, ref identifier)) - { - // pass - } + DA.GetData(8, ref identifier); - if (surface == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null || identifier == null) { return; } + // check inputs + if (surface == null || material == null || eccentricity == null || orthotropy == null || identifier == null) { return; } - // + // convert geometry FemDesign.Geometry.Region region = surface.FromRhino(); - // + // get thickness List thicknessObj = new List(); thicknessObj.Add(new FemDesign.Shells.Thickness(region.Plane.Origin, thickness)); + + + // create a slab plate + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Plate(identifier, material, region, FemDesign.Shells.EdgeConnection.Rigid, eccentricity, orthotropy, thicknessObj); + - // - FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Plate(identifier, material, region, edgeConnection, eccentricity, orthotropy, thicknessObj); + // set edge connections on slab + obj.SlabPart.Region.SetEdgeConnections(edgeConnections); // set local x-axis if (!x.Equals(Vector3d.Zero)) @@ -119,7 +108,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("{2C49099C-6ABF-4EFE-A30C-45A2B81BDC79}"); } + get { return new Guid("{9CC107E2-4647-4F9D-97DE-96348736C1E9}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Shells/SlabPlateVariableThickness.cs b/FemDesign.Grasshopper/Shells/SlabPlateVariableThickness.cs index ce77b0825..830c59978 100644 --- a/FemDesign.Grasshopper/Shells/SlabPlateVariableThickness.cs +++ b/FemDesign.Grasshopper/Shells/SlabPlateVariableThickness.cs @@ -21,7 +21,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager[pManager.ParamCount - 1].Optional = true; pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -36,7 +36,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { - // get input + // get inputs Brep surface = null; if(!DA.GetData(0, ref surface)) { return; } @@ -47,51 +47,40 @@ protected override void SolveInstance(IGH_DataAccess DA) if(!DA.GetData(2, ref material)) { return; } FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; - if(!DA.GetData(3, ref eccentricity)) - { - // pass - } + DA.GetData(3, ref eccentricity); FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; - if(!DA.GetData(4, ref orthotropy)) - { - // pass - } - - FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; - if(!DA.GetData(5, ref edgeConnection)) - { - // pass - } + DA.GetData(4, ref orthotropy); + + List edgeConnections = new List(); + DA.GetDataList(5, edgeConnections); Rhino.Geometry.Vector3d x = Vector3d.Zero; - if (!DA.GetData(6, ref x)) - { - // pass - } + DA.GetData(6, ref x); Rhino.Geometry.Vector3d z = Vector3d.Zero; - if (!DA.GetData(7, ref z)) - { - // pass - } + DA.GetData(7, ref z); string identifier = "P"; - if(!DA.GetData(8, ref identifier)) - { - // pass - } - if (surface == null || thickness == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null) { return; } + DA.GetData(8, ref identifier); + + // check inputs + if (surface == null || thickness == null || material == null || eccentricity == null || orthotropy == null) { return; } if (thickness.Count != 3) { throw new System.ArgumentException("Thickness must contain exactly 3 items."); } - // + // convert geometry FemDesign.Geometry.Region region = surface.FromRhino(); - // - FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Plate(identifier, material, region, edgeConnection, eccentricity, orthotropy, thickness); + + // create a slab plate + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Plate(identifier, material, region, FemDesign.Shells.EdgeConnection.Rigid, eccentricity, orthotropy, thickness); + + + // set edge connections on slab + obj.SlabPart.Region.SetEdgeConnections(edgeConnections); // set local x-axis if (!x.Equals(Vector3d.Zero)) @@ -117,7 +106,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("1a00487a-beed-49ba-b9e9-d4b45c201c4b"); } + get { return new Guid("{B53609A9-9A1E-45CD-ACB9-6252326DFA12}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Shells/SlabSetEdgeConnection.cs b/FemDesign.Grasshopper/Shells/SlabSetEdgeConnection.cs index 964d2febd..a1d2aead8 100644 --- a/FemDesign.Grasshopper/Shells/SlabSetEdgeConnection.cs +++ b/FemDesign.Grasshopper/Shells/SlabSetEdgeConnection.cs @@ -23,36 +23,43 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { + // get inputs Shells.Slab slab = null; + if (!DA.GetData(0, ref slab)) { return; } + + List shellEdgeConnections = new List(); + if (!DA.GetDataList(1, shellEdgeConnections)) { return; } + List indices = new List(); - if (!DA.GetData(0, ref slab)) return; - if (!DA.GetDataList(1, shellEdgeConnections)) return; - if (!DA.GetDataList(2, indices)) return; - if (slab == null) return; + if (!DA.GetDataList(2, indices)) { return; } - Shells.Slab obj; + // check inputs + if (slab == null || shellEdgeConnections == null || indices == null) { return; } if (shellEdgeConnections.Count == 0) { - AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, $"No shell edge connection added to shell {slab.Name}"); + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, $"No edge connection added to shell {slab.Name}"); return; } - else if (shellEdgeConnections.Count == 1) + + // set edge connections on object + Shells.Slab obj; + if (shellEdgeConnections.Count == 1) { - var shellEdgeConnection = shellEdgeConnections[0]; - obj = Shells.Slab.SetEdgeConnection(slab, shellEdgeConnection, indices); + obj = Shells.Slab.SetEdgeConnection(slab, shellEdgeConnections[0], indices); } else if (shellEdgeConnections.Count == indices.Count) { obj = Shells.Slab.SetEdgeConnection(slab, shellEdgeConnections[0], indices[0]); - for (int i = 1; i < shellEdgeConnections.Count; i++) + for (int i = 0; i < shellEdgeConnections.Count; i++) obj = Shells.Slab.SetEdgeConnection(obj, shellEdgeConnections[i], indices[i]); } else { - throw new ArgumentException($"The number of shellEdgeConnections must be 1 or eqal to the number of indices provided. Recieved {shellEdgeConnections.Count} and {indices.Count}"); + throw new ArgumentException($"The number of EdgeConnections must be 1 or equal to the number of indices provided. Recieved {shellEdgeConnections.Count} and {indices.Count}"); } + // get output DA.SetData(0, obj); } protected override System.Drawing.Bitmap Icon diff --git a/FemDesign.Grasshopper/Shells/SlabWall.cs b/FemDesign.Grasshopper/Shells/SlabWall.cs index c9bb4547b..4520badb3 100644 --- a/FemDesign.Grasshopper/Shells/SlabWall.cs +++ b/FemDesign.Grasshopper/Shells/SlabWall.cs @@ -22,7 +22,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager[pManager.ParamCount - 1].Optional = true; pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -37,7 +37,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { - // get input + // get inputs Brep surface = null; if(!DA.GetData(0, ref surface)) { return; } @@ -48,51 +48,40 @@ protected override void SolveInstance(IGH_DataAccess DA) if (!DA.GetData(2, ref material)) { return; } FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; - if(!DA.GetData(3, ref eccentricity)) - { - // pass - } + DA.GetData(3, ref eccentricity); FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; - if(!DA.GetData(4, ref orthotropy)) - { - // pass - } - - FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; - if(!DA.GetData(5, ref edgeConnection)) - { - // pass - } + DA.GetData(4, ref orthotropy); + + List edgeConnections = new List(); + DA.GetDataList(5, edgeConnections); Rhino.Geometry.Vector3d x = Vector3d.Zero; - if (!DA.GetData(6, ref x)) - { - // pass - } + DA.GetData(6, ref x); Rhino.Geometry.Vector3d z = Vector3d.Zero; - if (!DA.GetData(7, ref z)) - { - // pass - } + DA.GetData(7, ref z); string identifier = "P"; - if(!DA.GetData(8, ref identifier)) - { - // pass - } - if (surface == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null || identifier == null) { return; } + DA.GetData(8, ref identifier); - // + // check inputs + if (surface == null || material == null || eccentricity == null || orthotropy == null || identifier == null) { return; } + + // convert geometry FemDesign.Geometry.Region region = surface.FromRhino(); - // + // get thickness List thicknessObj = new List(); thicknessObj.Add(new FemDesign.Shells.Thickness(region.Plane.Origin, thickness)); - // - FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Wall(identifier, material, region, edgeConnection, eccentricity, orthotropy, thicknessObj); + + // create a slab plate + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Wall(identifier, material, region, FemDesign.Shells.EdgeConnection.Rigid, eccentricity, orthotropy, thicknessObj); + + + // set edge connections on slab + obj.SlabPart.Region.SetEdgeConnections(edgeConnections); // set local x-axis if (!x.Equals(Vector3d.Zero)) @@ -118,7 +107,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("{C3C9CD9E-BEE2-4B12-B0DE-60817FA7D2F5}"); } + get { return new Guid("{F14614E3-B6B9-48D3-AC01-A1909A3A9A6C}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Shells/SlabWallVariableThickness.cs b/FemDesign.Grasshopper/Shells/SlabWallVariableThickness.cs index 48a06104d..808a57aa1 100644 --- a/FemDesign.Grasshopper/Shells/SlabWallVariableThickness.cs +++ b/FemDesign.Grasshopper/Shells/SlabWallVariableThickness.cs @@ -21,7 +21,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager[pManager.ParamCount - 1].Optional = true; pManager.AddGenericParameter("ShellOrthotropy", "Orthotropy", "ShellOrthotropy. Optional.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.item); + pManager.AddGenericParameter("EdgeConnection", "EdgeConnection", "EdgeConnection. Optional.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -36,8 +36,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { - // get input - + // get inputs Brep surface = null; if(!DA.GetData(0, ref surface)) { return; } @@ -48,41 +47,25 @@ protected override void SolveInstance(IGH_DataAccess DA) if(!DA.GetData(2, ref material)) { return; } FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.Default; - if(!DA.GetData(3, ref eccentricity)) - { - // pass - } + DA.GetData(3, ref eccentricity); FemDesign.Shells.ShellOrthotropy orthotropy = FemDesign.Shells.ShellOrthotropy.Default; - if(!DA.GetData(4, ref orthotropy)) - { - // pass - } - - FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.Rigid; - if(!DA.GetData(5, ref edgeConnection)) - { - // pass - } + DA.GetData(4, ref orthotropy); + + List edgeConnections = new List(); + DA.GetDataList(5, edgeConnections); Rhino.Geometry.Vector3d x = Vector3d.Zero; - if (!DA.GetData(6, ref x)) - { - // pass - } + DA.GetData(6, ref x); Rhino.Geometry.Vector3d z = Vector3d.Zero; - if (!DA.GetData(7, ref z)) - { - // pass - } + DA.GetData(7, ref z); string identifier = "W"; - if(!DA.GetData(8, ref identifier)) - { - // pass - } - if (surface == null || thickness == null || material == null || eccentricity == null || orthotropy == null || edgeConnection == null) { return; } + DA.GetData(8, ref identifier); + + // check inputs + if (surface == null || thickness == null || material == null || eccentricity == null || orthotropy == null) { return; } if (thickness.Count != 2) { throw new System.ArgumentException("Thickness must contain exactly 2 items."); @@ -91,8 +74,12 @@ protected override void SolveInstance(IGH_DataAccess DA) // convert geometry FemDesign.Geometry.Region region = surface.FromRhino(); - // - FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Wall(identifier, material, region, edgeConnection, eccentricity, orthotropy, thickness); + // create a slab plate + FemDesign.Shells.Slab obj = FemDesign.Shells.Slab.Wall(identifier, material, region, FemDesign.Shells.EdgeConnection.Rigid, eccentricity, orthotropy, thickness); + + + // set edge connections on slab + obj.SlabPart.Region.SetEdgeConnections(edgeConnections); // set local x-axis if (!x.Equals(Vector3d.Zero)) @@ -118,7 +105,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("fb3f47d6-f58d-42ec-9a24-14419b2dfa2f"); } + get { return new Guid("{D8B69867-E60E-4DDA-8031-5979C0E901A2}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Shells/TimberPlateConstruct.cs b/FemDesign.Grasshopper/Shells/TimberPlateConstruct.cs index 58a661140..2b471585b 100644 --- a/FemDesign.Grasshopper/Shells/TimberPlateConstruct.cs +++ b/FemDesign.Grasshopper/Shells/TimberPlateConstruct.cs @@ -1,5 +1,6 @@ // https://strusoft.com/ using System; +using System.Collections.Generic; using Grasshopper.Kernel; using Rhino.Geometry; @@ -20,7 +21,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager[pManager.ParamCount - 1].Optional = true; pManager.AddGenericParameter("ShellEccentricity", "Eccentricity", "ShellEccentricity. Optional.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("BorderEdgeConnection", "BorderEdgeConnection", "EdgeConnection of the external border of the panel. Optional. If not defined hinged will be used.", GH_ParamAccess.item); + pManager.AddGenericParameter("BorderEdgeConnection", "BorderEdgeConnection", "EdgeConnection of the external border of the panel. Optional. If not defined hinged will be used.", GH_ParamAccess.list); pManager[pManager.ParamCount - 1].Optional = true; pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; @@ -52,9 +53,9 @@ protected override void SolveInstance(IGH_DataAccess DA) Shells.ShellEccentricity eccentricity = Shells.ShellEccentricity.Default; DA.GetData("ShellEccentricity", ref eccentricity); - - Shells.EdgeConnection edgeConnection = Shells.EdgeConnection.Hinged; - DA.GetData("BorderEdgeConnection", ref edgeConnection); + + List edgeConnections = new List(); + DA.GetDataList("BorderEdgeConnection", edgeConnections); Rhino.Geometry.Vector3d x = Vector3d.Zero; DA.GetData("LocalX", ref x); @@ -68,13 +69,20 @@ protected override void SolveInstance(IGH_DataAccess DA) string identifier = "PP"; DA.GetData("Identifier", ref identifier); - if (surface == null || timberPlateMaterialData == null || eccentricity == null || edgeConnection == null || identifier == null) + // check input + if (surface == null || timberPlateMaterialData == null || eccentricity == null || identifier == null) return; + if (edgeConnections?.Count == 0 || edgeConnections == null) + { + edgeConnections = new List { Shells.EdgeConnection.Hinged }; + } - + // convert geometry Geometry.Region region = surface.FromRhino(); Geometry.Vector3d dir = spanDirection.FromRhino(); - Shells.Panel obj = Shells.Panel.DefaultTimberContinuous(region, timberPlateMaterialData, dir, edgeConnection, identifier, eccentricity, panelWidth); + + // create panel + Shells.Panel obj = Shells.Panel.DefaultTimberContinuous(region, timberPlateMaterialData, dir, edgeConnections, identifier, eccentricity, panelWidth); // set local x-axis if (!x.Equals(Vector3d.Zero)) @@ -99,7 +107,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("22baacb3-0b76-41f4-a5bc-cd9e60d13be7"); } + get { return new Guid("{9EE359E4-C32D-4DD7-9947-1A1FCE9CDB60}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/Supports/SurfaceSupportConstruct.cs b/FemDesign.Grasshopper/Supports/OBSOLETE/SurfaceSupportConstruct_OBSOLETE.cs similarity index 92% rename from FemDesign.Grasshopper/Supports/SurfaceSupportConstruct.cs rename to FemDesign.Grasshopper/Supports/OBSOLETE/SurfaceSupportConstruct_OBSOLETE.cs index d21378961..2666f7ed5 100644 --- a/FemDesign.Grasshopper/Supports/SurfaceSupportConstruct.cs +++ b/FemDesign.Grasshopper/Supports/OBSOLETE/SurfaceSupportConstruct_OBSOLETE.cs @@ -7,9 +7,9 @@ namespace FemDesign.Grasshopper { - public class SurfaceSupportConstruct : FEM_Design_API_Component + public class SurfaceSupportConstruct_OBSOLETE : FEM_Design_API_Component { - public SurfaceSupportConstruct() : base("SurfaceSupport.Construct", "Construct", "Construct a SurfaceSupport element.", CategoryName.Name(), + public SurfaceSupportConstruct_OBSOLETE() : base("SurfaceSupport.Construct", "Construct", "Construct a SurfaceSupport element.", CategoryName.Name(), SubCategoryName.Cat1()) { @@ -86,7 +86,7 @@ public override Guid ComponentGuid get { return new Guid("bb903392-e157-4802-954c-7208d9a48b2b"); } } - public override GH_Exposure Exposure => GH_Exposure.tertiary; + public override GH_Exposure Exposure => GH_Exposure.hidden; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Supports/SurfaceSupport.cs b/FemDesign.Grasshopper/Supports/SurfaceSupport.cs new file mode 100644 index 000000000..d7c94310a --- /dev/null +++ b/FemDesign.Grasshopper/Supports/SurfaceSupport.cs @@ -0,0 +1,109 @@ +// https://strusoft.com/ +using System; +using Grasshopper.Kernel; +using Rhino.Geometry; +using FemDesign.Releases; +using FemDesign.Grasshopper.Extension.ComponentExtension; +using System.Linq; +using Grasshopper.Kernel.Special; + +namespace FemDesign.Grasshopper +{ + public class SurfaceSupportConstruct : FEM_Design_API_Component + { + public SurfaceSupportConstruct() : base("SurfaceSupport.Construct", "Construct", "Construct a SurfaceSupport element.", CategoryName.Name(), + SubCategoryName.Cat1()) + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddSurfaceParameter("Surface", "Surface", "Surface defining the SurfaceSupport.", GH_ParamAccess.item); + pManager.AddGenericParameter("Motions", "Motions", "Motions release for the surface support.", GH_ParamAccess.item); + pManager.AddGenericParameter("Plastic Limits Forces Motions", "PlaLimM", "Plastic limits forces for motion springs. Optional.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to surface local z-axis. Local y-axis will be adjusted accordingly. Optional, local x-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalZ", "LocalZ", "Set local z-axis. Vector must be perpendicular to surface local x-axis. Local y-axis will be adjusted accordingly. Optional, local z-axis from surface coordinate system used if undefined.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("DetachType", "DetachType", "Detach type. Optional.", GH_ParamAccess.item, "None"); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Identifier. Optional, default value if undefined.", GH_ParamAccess.item, "S"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("SurfaceSupport", "SurfaceSupport", "Define SurfaceSupport.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + Brep surface = null; + Motions motions = null; + MotionsPlasticLimits motionsPlasticLimit = null; + Rhino.Geometry.Vector3d x = Vector3d.Zero; + Rhino.Geometry.Vector3d z = Vector3d.Zero; + string _detachType = "None"; + string identifier = "S"; + + if (!DA.GetData(0, ref surface)) + { + return; + } + if (!DA.GetData(1, ref motions)) + { + return; + } + DA.GetData(2, ref motionsPlasticLimit); + DA.GetData(3, ref x); + DA.GetData(4, ref z); + DA.GetData(5, ref _detachType); + DA.GetData(6, ref identifier); + + if (surface == null || motions == null || identifier == null) + { + return; + } + + var detachType = (Releases.DetachType)Enum.Parse(typeof(Releases.DetachType), _detachType); + Geometry.Region region = surface.FromRhino(); + + var _motions = motions.DeepClone(); + + Supports.SurfaceSupport obj = new Supports.SurfaceSupport(region, _motions, motionsPlasticLimit, detachType, identifier); + + + // Set local x-axis + if (!x.Equals(Vector3d.Zero)) + { + obj.Plane.SetXAroundZ(x.FromRhino()); + } + + // Set local z-axis + if (!z.Equals(Vector3d.Zero)) + { + obj.Plane.SetZAroundX(z.FromRhino()); + } + + DA.SetData(0, obj); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.SurfaceSupport; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{CB1DC4B1-782E-44F8-8A2E-709B90BE814C}"); } + } + + protected override void BeforeSolveInstance() + { + ValueListUtils.UpdateValueLists(this, 5, Enum.GetNames(typeof(Releases.DetachType)).ToList(), null, GH_ValueListMode.DropDown); + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + } +} \ No newline at end of file diff --git a/FemDesign.Tests/Calculate/FdscriptTests.cs b/FemDesign.Tests/Calculate/FdscriptTests.cs index b6546f89a..86a1b4265 100644 --- a/FemDesign.Tests/Calculate/FdscriptTests.cs +++ b/FemDesign.Tests/Calculate/FdscriptTests.cs @@ -96,8 +96,8 @@ public void CombItemTest() Assert.IsTrue(combItem.NLE == true); Assert.IsTrue(combItem._nle == 1); - Assert.IsTrue(combItem.PL == true); - Assert.IsTrue(combItem._pl == 1); + Assert.IsTrue(combItem.PL == false); + Assert.IsTrue(combItem._pl == 0); Assert.IsTrue(combItem.NLS == true); Assert.IsTrue(combItem._nls == 1); diff --git a/femdesign-api.sln b/femdesign-api.sln index e2e877b97..0a0098f39 100644 --- a/femdesign-api.sln +++ b/femdesign-api.sln @@ -32,7 +32,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FemDesign.Tests", "FemDesign.Tests\FemDesign.Tests.csproj", "{CCADA385-E5FB-4F08-BC50-1826BBEF9794}" ProjectSection(ProjectDependencies) = postProject {04FA45B2-F2AF-4394-99F8-E50A82E91658} = {04FA45B2-F2AF-4394-99F8-E50A82E91658} - {1428F873-E8E8-4A23-974F-2633FDA060C4} = {1428F873-E8E8-4A23-974F-2633FDA060C4} {1E5D535D-C21B-454B-A62E-1DF4D968E677} = {1E5D535D-C21B-454B-A62E-1DF4D968E677} {2747D6C1-1E22-4262-A938-44FEE99A022C} = {2747D6C1-1E22-4262-A938-44FEE99A022C} {3C028AB2-5847-4300-B8A1-C1212A5F767E} = {3C028AB2-5847-4300-B8A1-C1212A5F767E} @@ -46,8 +45,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FemDesign.Tests", "FemDesig {8954D8AD-051F-4B44-87A4-559C00DB1CD6} = {8954D8AD-051F-4B44-87A4-559C00DB1CD6} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Practical example - Windows forms", "FemDesign.Examples\C#\Practical example - Windows forms\Practical example - Windows forms.csproj", "{1428F873-E8E8-4A23-974F-2633FDA060C4}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Practical example - ResultsToJSON", "FemDesign.Examples\C#\Practical example - ResultsToJSON\Practical example - ResultsToJSON.csproj", "{2747D6C1-1E22-4262-A938-44FEE99A022C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FemDesign.TestsGh", "FemDesign.GhTest\FemDesign.TestsGh.csproj", "{8EA7E166-D55A-40F0-83FE-E2CFB2013415}" @@ -68,6 +65,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Practical example - Run ana EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example - Dynamic Loads", "FemDesign.Examples\C#\Example - Dynamic Loads\Example - Dynamic Loads.csproj", "{C22928AC-7359-40E3-8042-5C5BCF90343B}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Practical example - Windows Presentation Foundation (WPF)", "FemDesign.Examples\C#\Practical example - WPF\Practical example - Windows Presentation Foundation (WPF).csproj", "{0FB2E28B-8C5B-49C4-98B3-E34B6EE9F2FF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -115,9 +114,6 @@ Global {CCADA385-E5FB-4F08-BC50-1826BBEF9794}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CCADA385-E5FB-4F08-BC50-1826BBEF9794}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCADA385-E5FB-4F08-BC50-1826BBEF9794}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1428F873-E8E8-4A23-974F-2633FDA060C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1428F873-E8E8-4A23-974F-2633FDA060C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1428F873-E8E8-4A23-974F-2633FDA060C4}.Release|Any CPU.ActiveCfg = Release|Any CPU {2747D6C1-1E22-4262-A938-44FEE99A022C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2747D6C1-1E22-4262-A938-44FEE99A022C}.Debug|Any CPU.Build.0 = Debug|Any CPU {2747D6C1-1E22-4262-A938-44FEE99A022C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -145,11 +141,12 @@ Global {A3DEC58E-F148-486E-9812-9B01484F1E58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A3DEC58E-F148-486E-9812-9B01484F1E58}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3DEC58E-F148-486E-9812-9B01484F1E58}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A3DEC58E-F148-486E-9812-9B01484F1E58}.Release|Any CPU.Build.0 = Release|Any CPU {C22928AC-7359-40E3-8042-5C5BCF90343B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C22928AC-7359-40E3-8042-5C5BCF90343B}.Debug|Any CPU.Build.0 = Debug|Any CPU {C22928AC-7359-40E3-8042-5C5BCF90343B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C22928AC-7359-40E3-8042-5C5BCF90343B}.Release|Any CPU.Build.0 = Release|Any CPU + {0FB2E28B-8C5B-49C4-98B3-E34B6EE9F2FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FB2E28B-8C5B-49C4-98B3-E34B6EE9F2FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FB2E28B-8C5B-49C4-98B3-E34B6EE9F2FF}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -165,7 +162,6 @@ Global {7EA66312-63D3-4125-8A65-7FA414152F33} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} {8954D8AD-051F-4B44-87A4-559C00DB1CD6} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} {04FA45B2-F2AF-4394-99F8-E50A82E91658} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} - {1428F873-E8E8-4A23-974F-2633FDA060C4} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} {2747D6C1-1E22-4262-A938-44FEE99A022C} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} {7A17B115-949E-48F2-86E5-F8BEBBAA61B4} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} {649E8E00-EBE9-4F65-A75F-AF9F8B0FE601} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} @@ -175,6 +171,7 @@ Global {EA1F0B6B-317D-44DF-BDD0-7FEE2339EE04} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} {A3DEC58E-F148-486E-9812-9B01484F1E58} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} {C22928AC-7359-40E3-8042-5C5BCF90343B} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} + {0FB2E28B-8C5B-49C4-98B3-E34B6EE9F2FF} = {C68FA42C-7B20-4FE3-AED6-8B6619EE5410} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DDF9D949-F79B-4EA6-A766-976B0BE0BC79}