diff --git a/FemDesign.Core/FemDesign.Core.csproj b/FemDesign.Core/FemDesign.Core.csproj index 5981ff0c7..b504af7b2 100644 --- a/FemDesign.Core/FemDesign.Core.csproj +++ b/FemDesign.Core/FemDesign.Core.csproj @@ -149,9 +149,9 @@ - - - + + + diff --git a/FemDesign.Core/GenericClasses/GuidListType.cs b/FemDesign.Core/GenericClasses/GuidListType.cs index f10f8c773..8cd82587c 100644 --- a/FemDesign.Core/GenericClasses/GuidListType.cs +++ b/FemDesign.Core/GenericClasses/GuidListType.cs @@ -27,12 +27,16 @@ public GuidListType(Guid guid) this.Guid = guid; } - /// /// Implicit conversion of a Entity to its Global Unique Identifier. /// /// public static implicit operator GuidListType(EntityBase entity) => new GuidListType(entity.Guid); + + public override string ToString() + { + return $"{this.Guid}"; + } } /// diff --git a/FemDesign.Core/Model/Entities.cs b/FemDesign.Core/Model/Entities.cs index d993567d0..f071b19d6 100644 --- a/FemDesign.Core/Model/Entities.cs +++ b/FemDesign.Core/Model/Entities.cs @@ -96,7 +96,7 @@ public partial class Entities public Supports.Supports Supports { get; set; } = new Supports.Supports(); [XmlElement("advanced-fem", Order = 28)] - public AdvancedFem AdvancedFem { get; set; } = new AdvancedFem(); + public ModellingTools.AdvancedFem AdvancedFem { get; set; } = new ModellingTools.AdvancedFem(); [XmlElement("storeys", Order = 29)] public StructureGrid.Storeys Storeys { get; set; } diff --git a/FemDesign.Core/Model/Model.cs b/FemDesign.Core/Model/Model.cs index ef7fd93c0..47828bfc8 100644 --- a/FemDesign.Core/Model/Model.cs +++ b/FemDesign.Core/Model/Model.cs @@ -270,6 +270,8 @@ public static Model DeserializeFromFilePath(string filePath) model.GetPointConnections(); if (model.Entities.AdvancedFem.ConnectedLines.Any()) model.GetLineConnections(); + if (model.Entities.AdvancedFem.SurfaceConnections.Any()) + model.GetSurfaceConnections(); if (model.ConstructionStages != null && model.ConstructionStages.Stages.Any()) model.GetConstructionStages(); if (model.Entities?.Loads?.LoadCombinations != null && model.Entities.Loads.LoadCombinations.Any()) @@ -435,7 +437,7 @@ public string SerializeToString() /// /// Add entities to Model. /// - public Model AddEntities(List bars, List fictitiousBars, List shells, List fictitiousShells, List panels, List covers, List loads, List loadCases, List loadCombinations, List supports, List storeys, List axes, List loadGroups, bool overwrite) + public Model AddEntities(List bars, List fictitiousBars, List shells, List fictitiousShells, List panels, List covers, List loads, List loadCases, List loadCombinations, List supports, List storeys, List axes, List loadGroups, bool overwrite) { // check if model contains entities, sections and materials if (this.Entities == null) @@ -502,7 +504,7 @@ public Model AddEntities(List bars, List if (covers != null) { - foreach (Cover cover in covers) + foreach (ModellingTools.Cover cover in covers) { this.AddCover(cover, overwrite); } @@ -900,7 +902,7 @@ private void AddComplexComposite(StruSoft.Interop.StruXml.Data.Complex_composite /// /// Add Cover to Model. /// - private void AddCover(Cover obj, bool overwrite) + private void AddCover(ModellingTools.Cover obj, bool overwrite) { // in model? bool inModel = this.CoverInModel(obj); @@ -924,9 +926,9 @@ private void AddCover(Cover obj, bool overwrite) /// /// Check if Cover in Model. /// - private bool CoverInModel(Cover obj) + private bool CoverInModel(ModellingTools.Cover obj) { - foreach (Cover elem in this.Entities.AdvancedFem.Covers) + foreach (ModellingTools.Cover elem in this.Entities.AdvancedFem.Covers) { if (elem.Guid == obj.Guid) { @@ -936,12 +938,79 @@ private bool CoverInModel(Cover obj) return false; } + private void AddSurfaceConnection(ModellingTools.SurfaceConnection obj, bool overwrite) + { + // advanced fem null? + if (this.Entities.AdvancedFem == null) + { + this.Entities.AdvancedFem = new ModellingTools.AdvancedFem(); + } + + // surface connection null? + if (this.Entities.AdvancedFem.SurfaceConnections == null) + { + this.Entities.AdvancedFem.SurfaceConnections = new List(); + } + + // in model? + bool inModel = this.Entities.AdvancedFem.SurfaceConnections.Any(x => x.Guid == obj.Guid); + + // in model, don't overwrite + if (inModel && !overwrite) + { + throw new System.ArgumentException($"{obj.GetType().FullName} with guid: {obj.Guid} has already been added to model. Are you adding the same element twice?"); + } + + // in model, overwrite + else if (inModel && overwrite) + { + this.Entities.AdvancedFem.SurfaceConnections.RemoveAll(x => x.Guid == obj.Guid); + } + + // add surface connection + this.Entities.AdvancedFem.SurfaceConnections.Add(obj); + + // add predefined rigidity + if (obj.PredefRigidity != null) + { + this.AddSurfaceConnectionLibItem(obj.PredefRigidity, overwrite); + } + } + + private void AddSurfaceConnectionLibItem(Releases.RigidityDataLibType1 obj, bool overwrite) + { + // if null create new element + if (this.SurfaceConnectionTypes == null) + { + this.SurfaceConnectionTypes = new LibraryItems.SurfaceConnectionTypes(); + this.SurfaceConnectionTypes.PredefinedTypes = new List(); + } + + // in model? + bool inModel = this.SurfaceConnectionTypes.PredefinedTypes.Any(x => x.Guid == obj.Guid); + + // in model, don't overwrite + if (inModel && !overwrite) + { + throw new System.ArgumentException($"{obj.GetType().FullName} with guid: {obj.Guid} has already been added to model. Are you adding the same element twice?"); + } + + // in model, overwrite + else if (inModel && overwrite) + { + this.SurfaceConnectionTypes.PredefinedTypes.RemoveAll(x => x.Guid == obj.Guid); + } + + // add lib item + this.SurfaceConnectionTypes.PredefinedTypes.Add(obj); + } + private void AddConnectedLine(ModellingTools.ConnectedLines obj, bool overwrite) { // advanced fem null? if (this.Entities.AdvancedFem == null) { - this.Entities.AdvancedFem = new AdvancedFem(); + this.Entities.AdvancedFem = new ModellingTools.AdvancedFem(); } // connected lines null? @@ -1008,7 +1077,7 @@ private void AddConnectedPoints(ModellingTools.ConnectedPoints obj, bool overwri // advanced fem null? if (this.Entities.AdvancedFem == null) { - this.Entities.AdvancedFem = new AdvancedFem(); + this.Entities.AdvancedFem = new ModellingTools.AdvancedFem(); } // connected points null? @@ -1993,7 +2062,7 @@ private void AddPredefinedRigidity(Releases.RigidityDataLibType3 obj, bool overw } /// - /// Check if Material (reinforcring) in Model. + /// Check if predefined rigidity. /// private bool PredefRigidityInModel(Releases.RigidityDataLibType3 obj) { @@ -3405,13 +3474,13 @@ public Model AddSupports(params T[] supports) where T : ISupportElement private void AddEntity(Reinforcement.Ptc obj, bool overwrite) => AddPtc(obj, overwrite); - private void AddEntity(Cover obj, bool overwrite) => AddCover(obj, overwrite); + private void AddEntity(ModellingTools.Cover obj, bool overwrite) => AddCover(obj, overwrite); private void AddEntity(ModellingTools.FictitiousShell obj, bool overwrite) => AddFictShell(obj, overwrite); private void AddEntity(ModellingTools.FictitiousBar obj, bool overwrite) => AddFictBar(obj, overwrite); private void AddEntity(ModellingTools.ConnectedPoints obj, bool overwrite) => AddConnectedPoints(obj, overwrite); private void AddEntity(ModellingTools.ConnectedLines obj, bool overwrite) => AddConnectedLine(obj, overwrite); - //private void AddEntity(ModellingTools.SurfaceConnection obj, bool overwrite) => AddSurfaceConnection(obj, overwrite); + private void AddEntity(ModellingTools.SurfaceConnection obj, bool overwrite) => AddSurfaceConnection(obj, overwrite); private void AddEntity(ModellingTools.Diaphragm obj, bool overwrite) => AddDiaphragm(obj, overwrite); private void AddEntity(AuxiliaryResults.LabelledSection obj, bool overwrite) => AddLabelledSection(obj, overwrite); @@ -3910,6 +3979,24 @@ internal void GetLineConnections() } } + internal void GetSurfaceConnections() + { + foreach (ModellingTools.SurfaceConnection connectedSurf in this.Entities.AdvancedFem.SurfaceConnections) + { + // predefined rigidity + if (this.SurfaceConnectionTypes != null && this.SurfaceConnectionTypes.PredefinedTypes != null) + { + foreach (Releases.RigidityDataLibType1 predefinedType in this.SurfaceConnectionTypes.PredefinedTypes) + { + if (connectedSurf._predefRigidityRef != null && predefinedType.Guid == connectedSurf._predefRigidityRef.Guid) + { + connectedSurf.PredefRigidity = predefinedType; + } + } + } + } + } + internal void GetConstructionStages() { var loadCaseNames = this.Entities.Loads.LoadCases?.ToDictionary(lc => lc.Guid, lc => lc.Name); diff --git a/FemDesign.Core/AdvancedFem/AdvancedFem.cs b/FemDesign.Core/ModellingTools/AdvancedFem.cs similarity index 56% rename from FemDesign.Core/AdvancedFem/AdvancedFem.cs rename to FemDesign.Core/ModellingTools/AdvancedFem.cs index 0645ba851..cd08b1617 100644 --- a/FemDesign.Core/AdvancedFem/AdvancedFem.cs +++ b/FemDesign.Core/ModellingTools/AdvancedFem.cs @@ -3,7 +3,7 @@ using System.Xml.Serialization; -namespace FemDesign +namespace FemDesign.ModellingTools { /// /// Connections and virtual objects @@ -12,22 +12,22 @@ namespace FemDesign public partial class AdvancedFem { [XmlElement("connected_points", Order = 1)] - public List ConnectedPoints { get; set; } = new List(); + public List ConnectedPoints { get; set; } = new List(); [XmlElement("connected_lines", Order = 2)] - public List ConnectedLines { get; set; } = new List(); + public List ConnectedLines { get; set; } = new List(); [XmlElement("surface_connection", Order = 3)] - public ModellingTools.SurfaceConnection[] SurfaceConnections { get; set; } + public List SurfaceConnections { get; set; } = new List(); [XmlElement("virtual_bar", Order = 4)] - public List FictitiousBars = new List(); + public List FictitiousBars = new List(); [XmlElement("virtual_shell", Order = 5)] - public List FictitiousShells = new List(); + public List FictitiousShells = new List(); [XmlElement("diaphragm", Order = 6)] - public List Diaphragms { get; set; } = new List(); + public List Diaphragms { get; set; } = new List(); [XmlElement("steel_joint", Order = 7)] diff --git a/FemDesign.Core/ModellingTools/ConnectedLines.cs b/FemDesign.Core/ModellingTools/ConnectedLines.cs index 905ea5c6d..1258cd186 100644 --- a/FemDesign.Core/ModellingTools/ConnectedLines.cs +++ b/FemDesign.Core/ModellingTools/ConnectedLines.cs @@ -1,3 +1,5 @@ +// https://strusoft.com/ +using System.Linq; using System.Collections.Generic; using System.Xml.Serialization; using FemDesign.GenericClasses; @@ -22,11 +24,82 @@ public partial class ConnectedLines: NamedEntityBase, IStructureElement [XmlElement("point", Order = 2)] public Geometry.Point3d[] Points { get; set; } + [XmlIgnore] + private Geometry.Plane _plane; + + [XmlIgnore] + public Geometry.Plane Plane + { + get + { + if (this._plane == null) + { + this._plane = new Geometry.Plane(new Geometry.Point3d(0, 0, 0), this.LocalX, this.LocalY); + return this._plane; + } + else + { + return this._plane; + } + } + set + { + this._plane = value; + this._localX = value.LocalX; + this._localY = value.LocalY; + } + } + [XmlElement("local_x", Order = 3)] - public Geometry.Vector3d LocalX { get; set; } + public Geometry.Vector3d _localX; + + [XmlIgnore] + public Geometry.Vector3d LocalX + { + get + { + return this._localX; + } + set + { + this.Plane.SetXAroundZ(value); + this._localX = this.Plane.LocalX; + this._localY = this.Plane.LocalY; + } + } [XmlElement("local_y", Order = 4)] - public Geometry.Vector3d LocalY { get; set; } + public Geometry.Vector3d _localY; + + [XmlIgnore] + public Geometry.Vector3d LocalY + { + get + { + return this._localY; + } + set + { + this.Plane.SetYAroundZ(value); + this._localX = this.Plane.LocalX; + this._localY = this.Plane.LocalY; + } + } + + [XmlIgnore] + public Geometry.Vector3d LocalZ + { + get + { + return this.Plane.LocalZ; + } + set + { + this.Plane.SetZAroundX(value); + this._localX = this.Plane.LocalX; + this._localY = this.Plane.LocalY; + } + } // simple stiffness choice @@ -60,8 +133,21 @@ public Releases.RigidityDataLibType3 PredefRigidity [XmlElement("ref", Order = 7)] public GuidListType[] References { get; set; } + [XmlIgnore] + private bool _movingLocal = false; + [XmlAttribute("moving_local")] - public bool MovingLocal { get; set; } + public bool MovingLocal + { + get + { + return this._movingLocal; + } + set + { + this._movingLocal = value; + } + } [XmlIgnore] private double[] _interface = new double[2]{ 0.5, 0.5 }; @@ -101,18 +187,78 @@ private ConnectedLines() } /// - /// Constructor + /// Create a line connection /// - public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Vector3d localX, Geometry.Vector3d localY, Releases.RigidityDataType3 rigidity, GuidListType[] references, string identifier, bool movingLocal, double interfaceStart, double interfaceEnd) + public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Vector3d localX, Geometry.Vector3d localY, Releases.RigidityDataType3 rigidity, GuidListType[] references, string identifier = "CL", bool movingLocal = false, double interfaceStart = 0.5, double interfaceEnd = 0.5) + { + this.Initialize(firstEdge, secondEdge, localX, localY, rigidity, references, identifier, movingLocal, interfaceStart, interfaceEnd); + } + + /// + /// Create a line connection. Local coordinate system declared by a plane object. + /// + public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Plane localPlane, Releases.RigidityDataType3 rigidity, GuidListType[] references, string identifier = "CL", bool movingLocal = false, double interfaceStart = 0.5, double interfaceEnd = 0.5) + { + this.Initialize(firstEdge, secondEdge, localPlane.LocalX, localPlane.LocalY, rigidity, references, identifier, movingLocal, interfaceStart, interfaceEnd); + } + + /// + /// Create a line connection using motions and rotations. Local coordinate system declared by a plane object. + /// + public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Plane localPlane, Releases.Motions motions, Releases.Rotations rotations, GuidListType[] references, string identifier = "CL", bool movingLocal = false, double interfaceStart = 0.5, double interfaceEnd = 0.5) + { + Releases.RigidityDataType3 rigidity = new Releases.RigidityDataType3(motions, rotations); + this.Initialize(firstEdge, secondEdge, localPlane.LocalX, localPlane.LocalY, rigidity, references, identifier, movingLocal, interfaceStart, interfaceEnd); + } + + /// + /// Create a line connection using motions, rotations and plastic limits. Local coordinate system declared by a plane object. + /// + public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Plane localPlane, Releases.Motions motions, Releases.MotionsPlasticLimits motionsPlasticLimits, Releases.Rotations rotations, Releases.RotationsPlasticLimits rotationPlasticLimits, GuidListType[] references, string identifier = "CL", bool movingLocal = false, double interfaceStart = 0.5, double interfaceEnd = 0.5) + { + Releases.RigidityDataType3 rigidity = new Releases.RigidityDataType3(motions, motionsPlasticLimits, rotations, rotationPlasticLimits); + this.Initialize(firstEdge, secondEdge, localPlane.LocalX, localPlane.LocalY, rigidity, references, identifier, movingLocal, interfaceStart, interfaceEnd); + } + + /// + /// Create a line connection. Local coordinate system declared by a plane object. + /// + public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Plane localPlane, Releases.RigidityDataType3 rigidity, IEnumerable elements, string identifier = "CL", bool movingLocal = false, double interfaceStart = 0.5, double interfaceEnd = 0.5) + { + GuidListType[] references = elements.Select(r => new GuidListType(r)).ToArray(); + this.Initialize(firstEdge, secondEdge, localPlane.LocalX, localPlane.LocalY, rigidity, references, identifier, movingLocal, interfaceStart, interfaceEnd); + } + + /// + /// Create a line connection using motions and rotations. Local coordinate system declared by a plane object. + /// + public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Plane localPlane, Releases.Motions motions, Releases.Rotations rotations, IEnumerable elements, string identifier = "CL", bool movingLocal = false, double interfaceStart = 0.5, double interfaceEnd = 0.5) + { + GuidListType[] references = elements.Select(r => new GuidListType(r)).ToArray(); + Releases.RigidityDataType3 rigidity = new Releases.RigidityDataType3(motions, rotations); + this.Initialize(firstEdge, secondEdge, localPlane.LocalX, localPlane.LocalY, rigidity, references, identifier, movingLocal, interfaceStart, interfaceEnd); + } + + /// + /// Create a line connection using motions, rotations and plastic limits. Local coordinate system declared by a plane object. + /// + public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Plane localPlane, Releases.Motions motions, Releases.MotionsPlasticLimits motionsPlasticLimits, Releases.Rotations rotations, Releases.RotationsPlasticLimits rotationPlasticLimits, IEnumerable elements, string identifier = "CL", bool movingLocal = false, double interfaceStart = 0.5, double interfaceEnd = 0.5) + { + GuidListType[] references = elements.Select(r => new GuidListType(r)).ToArray(); + Releases.RigidityDataType3 rigidity = new Releases.RigidityDataType3(motions, motionsPlasticLimits, rotations, rotationPlasticLimits); + this.Initialize(firstEdge, secondEdge, localPlane.LocalX, localPlane.LocalY, rigidity, references, identifier, movingLocal, interfaceStart, interfaceEnd); + } + + private void Initialize(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.Vector3d localX, Geometry.Vector3d localY, Releases.RigidityDataType3 rigidity, GuidListType[] references, string identifier, bool movingLocal, double interfaceStart, double interfaceEnd) { this.EntityCreated(); + this.Edges = new Geometry.Edge[2] { firstEdge, secondEdge }; - this.LocalX = localX; - this.LocalY = localY; + this.Plane = new Geometry.Plane(new Geometry.Point3d(0, 0, 0), localX, localY); this.Rigidity = rigidity; this.References = references; this.Identifier = identifier; diff --git a/FemDesign.Core/ModellingTools/ConnectedPoints.cs b/FemDesign.Core/ModellingTools/ConnectedPoints.cs index 6e073d9bf..a9c28c41c 100644 --- a/FemDesign.Core/ModellingTools/ConnectedPoints.cs +++ b/FemDesign.Core/ModellingTools/ConnectedPoints.cs @@ -38,11 +38,82 @@ public Point3d[] Points } } + [XmlIgnore] + private Geometry.Plane _plane; + + [XmlIgnore] + public Geometry.Plane Plane + { + get + { + if (this._plane == null) + { + this._plane = new Geometry.Plane(new Point3d(0, 0, 0), this.LocalX, this.LocalY); + return this._plane; + } + else + { + return this._plane; + } + } + set + { + this._plane = value; + this._localX = value.LocalX; + this._localY = value.LocalY; + } + } + [XmlElement("local_x", Order = 2)] - public Vector3d LocalX { get; set; } + public Geometry.Vector3d _localX; + + [XmlIgnore] + public Geometry.Vector3d LocalX + { + get + { + return this._localX; + } + set + { + this.Plane.SetXAroundZ(value); + this._localX = this.Plane.LocalX; + this._localY = this.Plane.LocalY; + } + } [XmlElement("local_y", Order = 3)] - public Vector3d LocalY { get; set; } + public Geometry.Vector3d _localY; + + [XmlIgnore] + public Geometry.Vector3d LocalY + { + get + { + return this._localY; + } + set + { + this.Plane.SetYAroundZ(value); + this._localX = this.Plane.LocalX; + this._localY = this.Plane.LocalY; + } + } + + [XmlIgnore] + public Geometry.Vector3d LocalZ + { + get + { + return this.Plane.LocalZ; + } + set + { + this.Plane.SetZAroundX(value); + this._localX = this.Plane.LocalX; + this._localY = this.Plane.LocalY; + } + } // rigidity data choice @@ -161,24 +232,33 @@ public ConnectedPoints(Plane plane, Point3d firstPoint, Point3d secondPoint, Mot Initialize(firstPoint, secondPoint, rigidity, references, identifier); this.LocalX = plane.LocalX; this.LocalY = plane.LocalY; + } + + /// + /// Create a connected point between 2 points with coordinate system, rigidity (motions, rotations) and plastic limits (forces, moments). + /// + public ConnectedPoints(Plane plane, Point3d firstPoint, Point3d secondPoint, Motions motions, MotionsPlasticLimits motionsPlasticLimits, Rotations rotations, RotationsPlasticLimits rotationsPlasticLimits, GuidListType[] references, string identifier = "CP") + { + RigidityDataType2 rigidity = new RigidityDataType2(motions, motionsPlasticLimits, rotations, rotationsPlasticLimits); + Initialize(firstPoint, secondPoint, rigidity, references, identifier); + this.Plane = plane; } private void Initialize(Point3d firstPoint, Point3d secondPoint, RigidityDataType2 rigidity, GuidListType[] references, string identifier) { this.EntityCreated(); + this.Points = new Point3d[2] { firstPoint, secondPoint }; - this.LocalX = Vector3d.UnitX; + this.Plane = new Plane(new Point3d(0, 0, 0), Vector3d.UnitX, Vector3d.UnitY); this.LocalY = Vector3d.UnitY; this.Rigidity = rigidity; this.References = references; this.Identifier = identifier; - } - - + } } } diff --git a/FemDesign.Core/AdvancedFem/Cover.cs b/FemDesign.Core/ModellingTools/Cover.cs similarity index 99% rename from FemDesign.Core/AdvancedFem/Cover.cs rename to FemDesign.Core/ModellingTools/Cover.cs index d3eac3092..9081fb610 100644 --- a/FemDesign.Core/AdvancedFem/Cover.cs +++ b/FemDesign.Core/ModellingTools/Cover.cs @@ -5,7 +5,7 @@ using FemDesign.GenericClasses; -namespace FemDesign +namespace FemDesign.ModellingTools { /// /// cover_type diff --git a/FemDesign.Core/AdvancedFem/CoverReferenceList.cs b/FemDesign.Core/ModellingTools/CoverReferenceList.cs similarity index 98% rename from FemDesign.Core/AdvancedFem/CoverReferenceList.cs rename to FemDesign.Core/ModellingTools/CoverReferenceList.cs index 848e07a6d..e437a19ae 100644 --- a/FemDesign.Core/AdvancedFem/CoverReferenceList.cs +++ b/FemDesign.Core/ModellingTools/CoverReferenceList.cs @@ -3,7 +3,7 @@ using System.Xml.Serialization; -namespace FemDesign +namespace FemDesign.ModellingTools { /// /// cover_referencelist_type diff --git a/FemDesign.Core/ModellingTools/Diaphragm.cs b/FemDesign.Core/ModellingTools/Diaphragm.cs index 3beafa501..e118fc0e2 100644 --- a/FemDesign.Core/ModellingTools/Diaphragm.cs +++ b/FemDesign.Core/ModellingTools/Diaphragm.cs @@ -13,9 +13,6 @@ public partial class Diaphragm: NamedEntityBase, IStructureElement, IStageElemen [XmlElement("region", Order = 1)] public Geometry.Region Region { get; set; } - [XmlAttribute("name")] - public string _name; - [XmlAttribute("stage")] public int StageId { get; set; } = 1; diff --git a/FemDesign.Core/ModellingTools/SurfaceConnection.cs b/FemDesign.Core/ModellingTools/SurfaceConnection.cs index 2198f69f4..f2a8a3493 100644 --- a/FemDesign.Core/ModellingTools/SurfaceConnection.cs +++ b/FemDesign.Core/ModellingTools/SurfaceConnection.cs @@ -1,6 +1,12 @@ +// https://strusoft.com/ using System; +using System.Linq; using System.Xml.Serialization; +using System.Collections.Generic; using FemDesign.GenericClasses; +using FemDesign.Geometry; +using FemDesign.Releases; + namespace FemDesign.ModellingTools @@ -17,7 +23,7 @@ public partial class SurfaceConnection: NamedEntityBase, IStructureElement // choice rigidity data [XmlElement("rigidity", Order = 2)] - public Releases.RigidityDataType2 Rigidity { get; set; } + public Releases.RigidityDataType1 Rigidity { get; set; } [XmlElement("predefined_rigidity", Order = 3)] public GuidListType _predefRigidityRef; @@ -49,8 +55,60 @@ public Releases.RigidityDataLibType1 PredefRigidity private Geometry.CoordinateSystem CoordinateSystem; [XmlElement("local_system", Order = 5)] - public Geometry.Plane Plane { get; set; } + public Geometry.Plane _plane; + + [XmlIgnore] + public Geometry.Plane Plane + { + get + { + return this._plane; + } + set + { + this._plane = value; + } + } + + [XmlIgnore] + public Geometry.Vector3d LocalX + { + get + { + return this.Plane.LocalX; + } + set + { + this.Plane.SetXAroundZ(value); + } + } + [XmlIgnore] + public Geometry.Vector3d LocalY + { + get + { + return this.Plane.LocalY; + } + set + { + this.Plane.SetYAroundZ(value); + } + } + + [XmlIgnore] + public Geometry.Vector3d LocalZ + { + get + { + return this.Plane.LocalZ; + } + set + { + this.Plane.SetZAroundX(value); + } + } + [XmlAttribute("distance")] public double _distance; @@ -63,7 +121,7 @@ public double Distance } set { - this.Distance = RestrictedDouble.AbsMax_10000(value); + this._distance = RestrictedDouble.AbsMax_10000(value); } } @@ -82,6 +140,81 @@ public double Interface this._interface = RestrictedDouble.NonNegMax_1(value); } } - + + /// + /// Parameterless constructor for serialization + /// + public SurfaceConnection() + { + + } + + /// + /// Create a surface connection between surface structural elements (e.g. slabs, surface supports, etc.) using their GUIDs and rigidity. + /// + public SurfaceConnection(Region region, RigidityDataType1 rigidity, GuidListType[] references, string identifier = "CS", double distance = 0, double interfaceAttribute = 0) + { + this.Initialize(region, rigidity, references, identifier, distance, interfaceAttribute); + } + + /// + /// Create a surface connection between surface structural elements (e.g. slabs, surface supports, etc.) using their GUIDs and rigidity (motions). + /// + public SurfaceConnection(Region region, Motions motions, GuidListType[] references, string identifier = "CS", double distance = 0, double interfaceAttribute = 0) + { + RigidityDataType1 rigidity = new RigidityDataType1(motions); + this.Initialize(region, rigidity, references, identifier, distance, interfaceAttribute); + } + + /// + /// Create a surface connection between surface structural elements (e.g. slabs, surface supports, etc.) using their GUIDs and rigidity (motions and platic limits). + /// + public SurfaceConnection(Region region, Motions motions, MotionsPlasticLimits motionsPlasticLimits, GuidListType[] references, string identifier = "CS", double distance = 0, double interfaceAttribute = 0) + { + RigidityDataType1 rigidity = new RigidityDataType1(motions, motionsPlasticLimits); + this.Initialize(region, rigidity, references, identifier, distance, interfaceAttribute); + } + + /// + /// Create a surface connection between surface structural elements (e.g. slabs, surface supports, etc.) using elements and rigidity. + /// + public SurfaceConnection(Region region, RigidityDataType1 rigidity, IEnumerable elements, string identifier = "CS", double distance = 0, double interfaceAttribute = 0) + { + GuidListType[] references = elements.Select(r => new GuidListType(r)).ToArray(); + this.Initialize(region, rigidity, references, identifier, distance, interfaceAttribute); + } + + /// + /// Create a surface connection between surface structural elements (e.g. slabs, surface supports, etc.) using their GUIDs and rigidity (motions). + /// + public SurfaceConnection(Region region, Motions motions, IEnumerable elements, string identifier = "CS", double distance = 0, double interfaceAttribute = 0) + { + RigidityDataType1 rigidity = new RigidityDataType1(motions); + GuidListType[] references = elements.Select(r => new GuidListType(r)).ToArray(); + this.Initialize(region, rigidity, references, identifier, distance, interfaceAttribute); + } + + /// + /// Create a surface connection between surface structural elements (e.g. slabs, surface supports, etc.) using their GUIDs and rigidity (motions and platic limits). + /// + public SurfaceConnection(Region region, Motions motions, MotionsPlasticLimits motionsPlasticLimits, IEnumerable elements, string identifier = "CS", double distance = 0, double interfaceAttribute = 0) + { + RigidityDataType1 rigidity = new RigidityDataType1(motions, motionsPlasticLimits); + GuidListType[] references = elements.Select(r => new GuidListType(r)).ToArray(); + this.Initialize(region, rigidity, references, identifier, distance, interfaceAttribute); + } + + private void Initialize(Region region, RigidityDataType1 rigidity, GuidListType[] references, string identifier, double distance, double interfaceAttribute) + { + this.EntityCreated(); + + this.Region = region; + this.Plane = region.Plane; + this.Rigidity = rigidity; + this.References = references; + this.Identifier = identifier; + this.Distance = distance; + this.Interface = interfaceAttribute; + } } } \ No newline at end of file diff --git a/FemDesign.Core/Releases/Motions.cs b/FemDesign.Core/Releases/Motions.cs index cd722cedd..2580e3921 100644 --- a/FemDesign.Core/Releases/Motions.cs +++ b/FemDesign.Core/Releases/Motions.cs @@ -15,6 +15,10 @@ public partial class Motions : StiffnessType /// public static double ValueRigidLine = 1e7; /// + /// Rigid translation/rotation stiffness value for surface support. [kN/m2/m] + /// + public static double ValueRigidSurface = 1e5; + /// /// Parameterless constructor for serialization. /// private Motions() @@ -71,6 +75,14 @@ public static Motions RigidLine() return new Motions(val, val, val, val, val, val); } /// + /// /// Define a rigid translation release for a surface-type release (1.000e+5) + /// + public static Motions RigidSurface() + { + double val = Motions.ValueRigidSurface; + return new Motions(val, val, val, val, val, val); + } + /// /// Define a free translation release. /// public static Motions Free() diff --git a/FemDesign.Grasshopper/Deconstruct/Drawing/DimensionLinearDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Drawing/DimensionLinearDeconstruct.cs new file mode 100644 index 000000000..19f7a3ae5 --- /dev/null +++ b/FemDesign.Grasshopper/Deconstruct/Drawing/DimensionLinearDeconstruct.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Grasshopper.Kernel; +using Rhino.Geometry; + +using Struxml = StruSoft.Interop.StruXml.Data; +using FemDesign.Grasshopper.Extension.ComponentExtension; + +using Grasshopper.Kernel.Special; + +namespace FemDesign.Grasshopper +{ + public class DimensionLinearDeconstruct : FEM_Design_API_Component + { + public DimensionLinearDeconstruct() : base("LinearDimensionDeconstruct", "LnDimDecon", "Deconstruct or modify a linear dimension.", CategoryName.Name(), "Deconstruct") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("LinearDimension", "LnDim", "Linear dimension.", GH_ParamAccess.item); + pManager.AddPlaneParameter("Point|Plane", "Point|Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddPointParameter("ReferencePoints", "RefPoints", "Points on dimension line to measure between.", GH_ParamAccess.list); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("ArrowType", "ArrowType", $"Dimension line arrow type. Connect 'ValueList' to get the options: {DimensionLinear.ArrowTypeValueListDescription}", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddIntegerParameter("Decimals", "Decimals", "Number of decimals of measurements.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("LengthUnit", "LengthUnit", $"Length unit of measurements. Connect 'ValueList' to get the options: {DimensionLinear.LengthUnitValueListDescription}", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddBooleanParameter("ShowUnit", "ShowUnit", "Show length unit on measurement.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("LinearDimension", "LnDim", "Linear dimension.", GH_ParamAccess.item); + pManager.AddPlaneParameter("Plane", "Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); + pManager.AddPointParameter("ReferencePoints", "RefPoints", "Points on dimension line to measure between.", GH_ParamAccess.list); + pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); + pManager.AddTextParameter("ArrowType", "ArrowType", $"Dimension line arrow type.", GH_ParamAccess.item); + pManager.AddIntegerParameter("Decimals", "Decimals", "Number of decimals of measurements.", GH_ParamAccess.item); + pManager.AddTextParameter("LengthUnit", "LengthUnit", "Length unit of measurements", GH_ParamAccess.item); + pManager.AddBooleanParameter("ShowUnit", "ShowUnit", "Show length unit on measurement.", GH_ParamAccess.item); + } + + protected override void BeforeSolveInstance() + { + ValueListUtils.updateValueLists(this, 4, DimensionLinear.ArrowTypeValueList, null, 0); + ValueListUtils.updateValueLists(this, 6, DimensionLinear.LengthUnitValueList, null, 0); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + Drawing.DimensionLinear dim = null; + if (!DA.GetData(0, ref dim)) + { + return; + } + + var plane = dim.Plane.ToRhinoPlane(); + if (DA.GetData(1, ref plane)) + { + dim.Plane = plane.ToPlane(); + } + + List refPoints = dim.ReferencePoints.Select(x => x.ToRhino()).ToList(); + if (!DA.GetDataList(2, refPoints)) + { + dim.ReferencePoints = refPoints.Select(x => x.FromRhino()).ToList(); + } + + double size = dim.Font.Size; + if (DA.GetData(3, ref size)) + { + dim.Font.Size = size; + } + + string arrowType = dim.Arrow.Type.ToString(); + if (DA.GetData(4, ref arrowType)) + { + if (Enum.TryParse(arrowType, out Struxml.Arrowtype_type arrowTypeEnum)) + { + dim.Arrow.Type = arrowTypeEnum; + } + else + { + throw new System.ArgumentException($"Invalid horisontal alignment value: {arrowType}, must be one of the following values: {DimensionLinear.ArrowTypeValueListDescription}"); + } + } + + int decimals = dim.Decimals; + if (DA.GetData(5, ref decimals)) + { + dim.Decimals = decimals; + } + + string lengthUnit = dim.LengthUnit.ToString(); + if (DA.GetData(6, ref lengthUnit)) + { + if (Enum.TryParse(lengthUnit, out Struxml.Lengthunit_type lengthUnitEnum)) + { + dim.LengthUnit = lengthUnitEnum; + } + else + { + throw new System.ArgumentException($"Invalid horisontal alignment value: {lengthUnit}, must be one of the following values: {DimensionLinear.LengthUnitValueListDescription}"); + } + } + + bool showUnit = dim.ShowUnit; + if (DA.GetData(7, ref showUnit)) + { + dim.ShowUnit = showUnit; + } + + DA.SetData(0, dim); + DA.SetData(1, plane); + DA.SetDataList(2, refPoints); + DA.SetData(3, size); + DA.SetData(4, arrowType); + DA.SetData(5, decimals); + DA.SetData(6, lengthUnit); + DA.SetData(7, showUnit); + + } + + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.DimensionLinearDeconstruct; + } + } + public override Guid ComponentGuid + { + get { return new Guid("7D89524B-5FAC-4C0E-AD73-65AA08FCC2E6"); } + } + + public override GH_Exposure Exposure => GH_Exposure.senary; + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/Drawing/TextAnnotationDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Drawing/TextAnnotationDeconstruct.cs new file mode 100644 index 000000000..57ed68c1b --- /dev/null +++ b/FemDesign.Grasshopper/Deconstruct/Drawing/TextAnnotationDeconstruct.cs @@ -0,0 +1,135 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using System.Linq; +using Eto.Forms; +using FemDesign.Grasshopper.Extension.ComponentExtension; +using Grasshopper.Kernel; +using Grasshopper.Kernel.Special; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class TextAnnotationDeconstruct : FEM_Design_API_Component + { + public TextAnnotationDeconstruct() : base("TextAnnotationDeconstruct", "TxtAnnotDecon", "Deconstruct or modify a text annotation.", CategoryName.Name(), "Deconstruct") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("TextAnnotation", "TextAnnotation", "TextAnnotation", GH_ParamAccess.item); + pManager.AddPlaneParameter("Point|Plane", "Point|Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Text", "Text", "Text.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddColourParameter("Colour", "Colour", "Colour of text. [ARGB]", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("HorisontalAligment", "HorAlign", $"Horisontal alignement of text. Connect 'ValueList' to get the options: {TextAnnotation.HorAlignValueListDescription}", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("VerticalAligment", "VerAlign", $"Vertical alignement of text. Connect 'ValueList' to get the options: {TextAnnotation.VerAlignValueListDescription}", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("TextAnnotation", "TextAnnotation", "TextAnnotation.", GH_ParamAccess.item); + pManager.AddPlaneParameter("Plane", "Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); + pManager.AddTextParameter("Text", "Text", "Text.", GH_ParamAccess.item); + pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); + pManager.AddColourParameter("Colour", "Colour", "Colour of text [ARGB]", GH_ParamAccess.item); + pManager.AddTextParameter("HorisontalAligment", "HorAlign", "Horisontal alignement of text", GH_ParamAccess.item); + pManager.AddTextParameter("VerticalAligment", "VerAlign", "Vertical alignement of text", GH_ParamAccess.item); + } + protected override void BeforeSolveInstance() + { + ValueListUtils.updateValueLists(this, 5, TextAnnotation.HorAlignValueList, null, 0); + ValueListUtils.updateValueLists(this, 6, TextAnnotation.VerAlignValueList, null, 0); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + Drawing.TextAnnotation origTextAnnot = null; + if (!DA.GetData(0, ref origTextAnnot)) + { + return; + } + + var textAnnot = origTextAnnot.DeepClone(); + + var plane = new Plane(textAnnot.Position.ToRhino(), textAnnot.LocalX.ToRhino(), textAnnot.LocalY.ToRhino()); + if (DA.GetData(1, ref plane)) + { + textAnnot.Position = plane.Origin.FromRhino(); + textAnnot.LocalX = plane.XAxis.FromRhino(); + textAnnot.LocalY = plane.YAxis.FromRhino(); + } + + string text = textAnnot.Text; + if (DA.GetData(2, ref text)) + { + textAnnot.Text = text; + } + + double size = textAnnot.StyleType.Font.Size; + if (DA.GetData(3, ref size)) + { + textAnnot.StyleType.Font.Size = size; + } + + System.Drawing.Color color = textAnnot.StyleType.GetColor; + if (DA.GetData(4, ref color)) + { + textAnnot.StyleType.SetColor = color; + } + + string horAlign = textAnnot.StyleType.Font.H_align.ToString(); + if (DA.GetData(5, ref horAlign)) + { + if (Enum.TryParse(horAlign, out StruSoft.Interop.StruXml.Data.Hor_align horAlignEnum)) + { + textAnnot.StyleType.Font.H_align = horAlignEnum; + } + else + { + throw new System.ArgumentException($"Invalid horisontal alignment value: {horAlign}, must be one of the following values: {TextAnnotation.HorAlignValueListDescription}"); + } + } + + string verAlign = textAnnot.StyleType.Font.V_align.ToString(); + if (DA.GetData(6, ref verAlign)) + { + if (Enum.TryParse(verAlign, out StruSoft.Interop.StruXml.Data.Ver_align verAlignEnum)) + { + textAnnot.StyleType.Font.V_align = verAlignEnum; + } + else + { + throw new System.ArgumentException($"Invalid vertical alignment value: {verAlign}, must be one of the following values: {TextAnnotation.VerAlignValueListDescription}"); + } + } + + DA.SetData(0, textAnnot); + DA.SetData(1, plane); + DA.SetData(2, text); + DA.SetData(3, size); + DA.SetData(4, color); + DA.SetData(5, horAlign); + DA.SetData(6, verAlign); + } + + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.TextAnnotationDeconstruct; + } + } + public override Guid ComponentGuid + { + get { return new Guid("7C35D2FF-75B1-4561-A9BE-B7D22FE93B95"); } + } + + public override GH_Exposure Exposure => GH_Exposure.senary; + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/IsolatedFoundationDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Foundations/IsolatedFoundationDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/IsolatedFoundationDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Foundations/IsolatedFoundationDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/LineLoadDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/LineLoadDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LineLoadDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/LineLoadDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/LineStressLoadDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/LineStressLoadDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LineStressLoadDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/LineStressLoadDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/LineTemperatureLoadDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/LineTemperatureLoadDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LineTemperatureLoadDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/LineTemperatureLoadDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/LoadCaseDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/LoadCaseDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LoadCaseDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/LoadCaseDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/LoadCategoryDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/LoadCategoryDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LoadCategoryDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/LoadCategoryDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/LoadCombinationDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/LoadCombinationDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LoadCombinationDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/LoadCombinationDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/LoadGroupDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/LoadGroupDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LoadGroupDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/LoadGroupDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/PointLoadDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/PointLoadDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/PointLoadDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/PointLoadDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/PressureLoadDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/PressureLoadDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/PressureLoadDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/PressureLoadDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SortLoads.cs b/FemDesign.Grasshopper/Deconstruct/Loads/SortLoads.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SortLoads.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/SortLoads.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SurfaceLoadDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/SurfaceLoadDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SurfaceLoadDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/SurfaceLoadDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SurfaceTemperatureLoadDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/SurfaceTemperatureLoadDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SurfaceTemperatureLoadDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/SurfaceTemperatureLoadDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/TopBotLocValDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Loads/TopBotLocValDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/TopBotLocValDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Loads/TopBotLocValDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs index 79c0e69d9..b82377378 100644 --- a/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/ModelDeconstruct.cs @@ -17,17 +17,12 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) } protected override void RegisterOutputParams(GH_OutputParamManager pManager) { - pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code D/DK/EST/FIN/GB/H/N/PL/RO/S/TR", 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("FictitiousBars", "FictBars", "Single fictitious bar element or list of fictitious bar elements.", GH_ParamAccess.list); pManager.AddGenericParameter("Shells", "Shells", "Single shell element or list of shell elements.", GH_ParamAccess.list); - pManager.AddGenericParameter("FictitiousShells", "FictShells", "Single fictitious shell element or list of fictitious shell elements.", GH_ParamAccess.list); - pManager.AddGenericParameter("Diaphragms", "Diaphragms", "Single diaphragm element or list of diaphragm elements.", GH_ParamAccess.list); pManager.AddGenericParameter("LabelledSection", "LabelledSection", "Single LabelledSection element or list of LabelledSection elements.", GH_ParamAccess.list); pManager.AddGenericParameter("Panels", "Panels", "Single panel element or list of panel elements.", GH_ParamAccess.list); - pManager.AddGenericParameter("Covers", "Covers", "Single cover element or list of cover elements.", GH_ParamAccess.list); pManager.AddGenericParameter("Loads", "Loads", "Single load element or list of load elements.", GH_ParamAccess.list); pManager.AddGenericParameter("LoadCases", "LoadCases", "Single LoadCase element or list of LoadCase elements.", GH_ParamAccess.list); pManager.AddGenericParameter("LoadCombinations", "LoadCombinations", "Single LoadCombination element or list of LoadCombination elements.", GH_ParamAccess.list); @@ -38,6 +33,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) pManager.AddGenericParameter("Stages", "Stages", "Single Stage element of list of stage elements.", GH_ParamAccess.list); pManager.AddGenericParameter("PeakSmoothingRegion", "SmRegion", "Single peak smoothing region element or list of peak smoothing region elements.", GH_ParamAccess.list); pManager.AddGenericParameter("ResultPoints", "ResultPoints", "Single result point or list of result points.", GH_ParamAccess.list); + pManager.AddGenericParameter("ModellingTools", "ModellingTools", "Modelling tools and Covers.", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { @@ -98,13 +94,9 @@ protected override void SolveInstance(IGH_DataAccess DA) DA.SetData("CountryCode", model.Country.ToString()); DA.SetDataList("Foundations", model.Entities.Foundations.GetFoundations()); DA.SetDataList("Bars", model.Entities.Bars); - DA.SetDataList("FictitiousBars", model.Entities.AdvancedFem.FictitiousBars); DA.SetDataList("Shells", model.Entities.Slabs); - DA.SetDataList("FictitiousShells", model.Entities.AdvancedFem.FictitiousShells); - DA.SetDataList("Diaphragms", model.Entities.AdvancedFem.Diaphragms); DA.SetDataList("LabelledSection", labelledSections); DA.SetDataList("Panels", model.Entities.Panels); - DA.SetDataList("Covers", model.Entities.AdvancedFem.Covers); DA.SetDataList("Loads", model.Entities.Loads.GetLoads()); DA.SetDataList("LoadCases", model.Entities.Loads.LoadCases); DA.SetDataList("LoadCombinations", model.Entities.Loads.LoadCombinations); @@ -115,6 +107,7 @@ protected override void SolveInstance(IGH_DataAccess DA) DA.SetDataList("Stages", stages); DA.SetDataList("PeakSmoothingRegion", model.Entities.PeakSmoothingRegions); DA.SetDataList("ResultPoints", resPoints); + DA.SetData("ModellingTools", model.Entities.AdvancedFem); } protected override System.Drawing.Bitmap Icon { @@ -125,7 +118,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("{57480A5B-E2B2-4C1C-8A11-6700A77F89BC}"); } + get { return new Guid("{99062FE8-8F0D-4F2D-8483-77573958469C}"); } } public override GH_Exposure Exposure => GH_Exposure.secondary; diff --git a/FemDesign.Grasshopper/Deconstruct/ModellingTools/AdvancedFemDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/AdvancedFemDeconstruct.cs new file mode 100644 index 000000000..93b590e3f --- /dev/null +++ b/FemDesign.Grasshopper/Deconstruct/ModellingTools/AdvancedFemDeconstruct.cs @@ -0,0 +1,58 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class AdvancedFemDeconstruct : FEM_Design_API_Component + { + public AdvancedFemDeconstruct(): base("ModellingTools.Deconstruct", "Deconstruct", "Deconstruct a ModellingTools object. Returns Modelling tools and Covers.", CategoryName.Name(), "Deconstruct") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("ModellingTools", "ModellingTools", "ModellingTools object from Model.Deconstruct.", GH_ParamAccess.item); + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("PointConnections", "PtConn", "Single fictitious bar element or list of fictitious bar elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("LineConnections", "LnConn", "Single fictitious bar element or list of fictitious bar elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("SurfaceConnections", "SrfConn", "Single fictitious bar element or list of fictitious bar elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("FictitiousBars", "FictBars", "Single fictitious bar element or list of fictitious bar elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("FictitiousShells", "FictShells", "Single fictitious shell element or list of fictitious shell elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Diaphragms", "Diaphragms", "Single diaphragm element or list of diaphragm elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Covers", "Covers", "Single cover element or list of cover elements.", GH_ParamAccess.list); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + FemDesign.ModellingTools.AdvancedFem obj = null; + if (!DA.GetData(0, ref obj)) { return; } + if (obj == null) { return; } + + // get output + DA.SetDataList("PointConnections", obj.ConnectedPoints); + DA.SetDataList("LineConnections", obj.ConnectedLines); + DA.SetDataList("SurfaceConnections", obj.SurfaceConnections); + DA.SetDataList("FictitiousBars", obj.FictitiousBars); + DA.SetDataList("FictitiousShells", obj.FictitiousShells); + DA.SetDataList("Diaphragms", obj.Diaphragms); + DA.SetDataList("Covers", obj.Covers); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.ModellingToolsDeconstruct; + } + } + public override Guid ComponentGuid + { + get { return new Guid("E966C625-CA8B-4044-82E9-2E1585D50A9D"); } + } + public override GH_Exposure Exposure => GH_Exposure.senary; + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/CoverDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/CoverDeconstruct.cs similarity index 93% rename from FemDesign.Grasshopper/Deconstruct/CoverDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/ModellingTools/CoverDeconstruct.cs index fdcc3fa3b..de1c1b5ad 100644 --- a/FemDesign.Grasshopper/Deconstruct/CoverDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/ModellingTools/CoverDeconstruct.cs @@ -25,7 +25,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) protected override void SolveInstance(IGH_DataAccess DA) { // get input - FemDesign.Cover cover = null; + FemDesign.ModellingTools.Cover cover = null; if (!DA.GetData(0, ref cover)) { return; @@ -54,7 +54,7 @@ public override Guid ComponentGuid get { return new Guid("145f6331-bf19-4d89-9e81-9e5e0d137f87"); } } - public override GH_Exposure Exposure => GH_Exposure.quinary; + public override GH_Exposure Exposure => GH_Exposure.senary; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/DiaphragmDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/DiaphragmDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/DiaphragmDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/ModellingTools/DiaphragmDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/FictitiousBarDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/FictitiousBarDeconstruct.cs similarity index 97% rename from FemDesign.Grasshopper/Deconstruct/FictitiousBarDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/ModellingTools/FictitiousBarDeconstruct.cs index d23968cb5..38cdf1fef 100644 --- a/FemDesign.Grasshopper/Deconstruct/FictitiousBarDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/ModellingTools/FictitiousBarDeconstruct.cs @@ -63,7 +63,7 @@ public override Guid ComponentGuid { get { return new Guid("3aa81ad1-53d6-494b-9307-761b75e8d8da"); } } - public override GH_Exposure Exposure => GH_Exposure.primary; + public override GH_Exposure Exposure => GH_Exposure.senary; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/FictitiousShellDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/FictitiousShellDeconstruct.cs similarity index 98% rename from FemDesign.Grasshopper/Deconstruct/FictitiousShellDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/ModellingTools/FictitiousShellDeconstruct.cs index bb773d53f..4459011a5 100644 --- a/FemDesign.Grasshopper/Deconstruct/FictitiousShellDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/ModellingTools/FictitiousShellDeconstruct.cs @@ -77,7 +77,7 @@ public override Guid ComponentGuid { get { return new Guid("2e3394cb-dfa8-4ebf-b9e2-c389abe4c59b"); } } - public override GH_Exposure Exposure => GH_Exposure.primary; + public override GH_Exposure Exposure => GH_Exposure.senary; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/ModellingTools/LineConnectionDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/LineConnectionDeconstruct.cs new file mode 100644 index 000000000..a0da4048a --- /dev/null +++ b/FemDesign.Grasshopper/Deconstruct/ModellingTools/LineConnectionDeconstruct.cs @@ -0,0 +1,69 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using System.Linq; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class LineConnectionDeconstruct : FEM_Design_API_Component + { + public LineConnectionDeconstruct() : base("LineConnection.Deconstruct", "Deconstruct", "Deconstruct a LineConnection.", CategoryName.Name(), "Deconstruct") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("LineConnection", "LnConnect", "LineConnection from ModellingTools.", GH_ParamAccess.item); + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddTextParameter("Guid", "Guid", "Guid.", GH_ParamAccess.item); + pManager.AddGenericParameter("ConnectedElementsReference", "Ref", "GUIDs of connected structural elements (e.g. slabs, surface supports, fictious shells, etc).", GH_ParamAccess.list); + pManager.AddLineParameter("Lines", "Lns", "Master line and slave line.", GH_ParamAccess.list); + pManager.AddGenericParameter("Motion", "Mot", "Motion release.", GH_ParamAccess.item); + pManager.AddGenericParameter("MotionsPlasticLimits", "PlaLimM", "Plastic limits forces for motion springs.", GH_ParamAccess.item); + pManager.AddGenericParameter("Rotation", "Rot", "Rotation release.", GH_ParamAccess.item); + pManager.AddGenericParameter("RotationsPlasticLimits", "PlaLimR", "Plastic limits moments for rotation springs.", GH_ParamAccess.item); + pManager.AddVectorParameter("LocalX", "X", "Local x-axis.", GH_ParamAccess.item); + pManager.AddVectorParameter("LocalY", "Y", "Local y-axis.", GH_ParamAccess.item); + pManager.AddTextParameter("Identifier", "ID", "Identifier.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + FemDesign.ModellingTools.ConnectedLines obj = null; + if (!DA.GetData(0, ref obj)) { return; } + if (obj == null) { return; } + + var rhinoLines = obj.Edges.Select(l => l.ToRhino()).ToList(); + + // get output + DA.SetData(0, obj.Guid); + DA.SetDataList(1, obj.References); + DA.SetDataList(2, rhinoLines); + DA.SetData(3, obj.Rigidity.Motions); + DA.SetData(4, obj.Rigidity.PlasticLimitForces); + DA.SetData(5, obj.Rigidity.Rotations); + DA.SetData(6, obj.Rigidity.PlasticLimitMoments); + DA.SetData(7, obj.LocalX.ToRhino()); + DA.SetData(8, obj.LocalY.ToRhino()); + DA.SetData(9, obj.Identifier); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.LineConnectionDeconstruct; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{B4480216-0C2E-4B63-AA52-3764992D3886}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.senary; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/ModellingTools/PointConnectionDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/PointConnectionDeconstruct.cs new file mode 100644 index 000000000..77f83cc2d --- /dev/null +++ b/FemDesign.Grasshopper/Deconstruct/ModellingTools/PointConnectionDeconstruct.cs @@ -0,0 +1,69 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using System.Linq; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class PointConnectionDeconstruct : FEM_Design_API_Component + { + public PointConnectionDeconstruct() : base("PointConnection.Deconstruct", "Deconstruct", "Deconstruct a PointConnection.", CategoryName.Name(), "Deconstruct") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("PointConnection", "PtConnect", "PointConnection from ModellingTools.", GH_ParamAccess.item); + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddTextParameter("Guid", "Guid", "Guid.", GH_ParamAccess.item); + pManager.AddGenericParameter("ConnectedElementsReference", "Ref", "GUIDs of connected structural elements (e.g. slabs, surface supports, fictious shells, etc).", GH_ParamAccess.list); + pManager.AddPointParameter("Points", "Pts", "Master point and slave point.", GH_ParamAccess.list); + pManager.AddGenericParameter("Motion", "Mot", "Motion release.", GH_ParamAccess.item); + pManager.AddGenericParameter("MotionsPlasticLimits", "PlaLimM", "Plastic limits forces for motion springs.", GH_ParamAccess.item); + pManager.AddGenericParameter("Rotation", "Rot", "Rotation release.", GH_ParamAccess.item); + pManager.AddGenericParameter("RotationsPlasticLimits", "PlaLimR", "Plastic limits moments for rotation springs.", GH_ParamAccess.item); + pManager.AddVectorParameter("LocalX", "X", "Local x-axis.", GH_ParamAccess.item); + pManager.AddVectorParameter("LocalY", "Y", "Local y-axis.", GH_ParamAccess.item); + pManager.AddTextParameter("Identifier", "ID", "Identifier.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + FemDesign.ModellingTools.ConnectedPoints obj = null; + if(!DA.GetData(0, ref obj)) { return; } + if(obj == null) { return; } + + var rhinoPoints = obj.Points.Select(p => p.ToRhino()).ToList(); + + // get output + DA.SetData(0, obj.Guid); + DA.SetDataList(1, obj.References); + DA.SetDataList(2, rhinoPoints); + DA.SetData(3, obj.Rigidity.Motions); + DA.SetData(4, obj.Rigidity.PlasticLimitForces); + DA.SetData(5, obj.Rigidity.Rotations); + DA.SetData(6, obj.Rigidity.PlasticLimitMoments); + DA.SetData(7, obj.LocalX.ToRhino()); + DA.SetData(8, obj.LocalY.ToRhino()); + DA.SetData(9, obj.Identifier); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.PointConnectionDeconstruct; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{49D35435-806E-4E21-90CF-B13729388D0C}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.senary; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/StiffnessMatrix2TypeDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/StiffnessMatrix2TypeDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/StiffnessMatrix2TypeDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/ModellingTools/StiffnessMatrix2TypeDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/StiffnessMatrix4TypeDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/StiffnessMatrix4TypeDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/StiffnessMatrix4TypeDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/ModellingTools/StiffnessMatrix4TypeDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/ModellingTools/SurfaceConnectionDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/ModellingTools/SurfaceConnectionDeconstruct.cs new file mode 100644 index 000000000..10d303282 --- /dev/null +++ b/FemDesign.Grasshopper/Deconstruct/ModellingTools/SurfaceConnectionDeconstruct.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 SurfaceConnectionDeconstruct : FEM_Design_API_Component + { + public SurfaceConnectionDeconstruct() : base("SurfaceConnection.Deconstruct", "Deconstruct", "Deconstruct a SurfaceConnection.", CategoryName.Name(), "Deconstruct") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("SurfaceConnection", "SrfConnect", "SurfaceConnection from ModellingTools.", GH_ParamAccess.item); + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddTextParameter("Guid", "Guid", "Guid.", GH_ParamAccess.item); + pManager.AddGenericParameter("ConnectedElementsReference", "Ref", "GUIDs of connected surface structural elements (e.g. slabs, surface supports, fictious shells, etc).", GH_ParamAccess.list); + pManager.AddSurfaceParameter("Surface", "Srf", "SurfaceConnection definition surface.", GH_ParamAccess.item); + pManager.AddGenericParameter("Motion", "Mot", "Motion release.", GH_ParamAccess.item); + pManager.AddGenericParameter("MotionsPlasticLimits", "PlaLimM", "Plastic limits forces for motion springs.", GH_ParamAccess.item); + pManager.AddVectorParameter("LocalX", "X", "Local x-axis.", GH_ParamAccess.item); + pManager.AddVectorParameter("LocalZ", "Z", "Local z-axis.", GH_ParamAccess.item); + pManager.AddNumberParameter("Distance", "d", "Distance in meter.", GH_ParamAccess.item); + pManager.AddTextParameter("Identifier", "ID", "Identifier.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + FemDesign.ModellingTools.SurfaceConnection obj = null; + if(!DA.GetData(0, ref obj)) { return; } + if(obj == null) { return; } + + // get output + DA.SetData(0, obj.Guid); + DA.SetDataList(1, obj.References); + DA.SetData(2, obj.Region.ToRhinoBrep()); + DA.SetData(3, obj.Rigidity.Motions); + DA.SetData(4, obj.Rigidity.PlasticLimitForces); + DA.SetData(5, obj.LocalX.ToRhino()); + DA.SetData(6, obj.LocalZ.ToRhino()); + DA.SetData(7, obj.Distance); + DA.SetData(8, obj.Identifier); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.SurfaceConnectionDeconstruct; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{5994409D-2C7D-48E4-8968-4FBAA71A98FA}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.senary; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/OBSOLETE/ModelDeconstruct_OBSOLETE2290.cs b/FemDesign.Grasshopper/Deconstruct/OBSOLETE/ModelDeconstruct_OBSOLETE2290.cs new file mode 100644 index 000000000..cf2706028 --- /dev/null +++ b/FemDesign.Grasshopper/Deconstruct/OBSOLETE/ModelDeconstruct_OBSOLETE2290.cs @@ -0,0 +1,134 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; + +namespace FemDesign.Grasshopper +{ + public class ModelDeconstruct_OBSOLETE2290 : FEM_Design_API_Component + { + public ModelDeconstruct_OBSOLETE2290() : base("Model.Deconstruct", "Deconstruct", "Deconstruct Model.", "FEM-Design", "Deconstruct") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("Model", "Model", "Model.", GH_ParamAccess.item); + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + + pManager.AddTextParameter("CountryCode", "CountryCode", "National annex of calculation code D/DK/EST/FIN/GB/H/N/PL/RO/S/TR", 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("FictitiousBars", "FictBars", "Single fictitious bar element or list of fictitious bar elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Shells", "Shells", "Single shell element or list of shell elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("FictitiousShells", "FictShells", "Single fictitious shell element or list of fictitious shell elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Diaphragms", "Diaphragms", "Single diaphragm element or list of diaphragm elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("LabelledSection", "LabelledSection", "Single LabelledSection element or list of LabelledSection elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Panels", "Panels", "Single panel element or list of panel elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Covers", "Covers", "Single cover element or list of cover elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Loads", "Loads", "Single load element or list of load elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("LoadCases", "LoadCases", "Single LoadCase element or list of LoadCase elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("LoadCombinations", "LoadCombinations", "Single LoadCombination element or list of LoadCombination elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("LoadGroups", "LoadGroups", "Single load group or list of LoadGroup elements to add", GH_ParamAccess.list); + pManager.AddGenericParameter("Supports", "Supports", "Single Support element or list of Support elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Axes", "Axes", "Single axis element or list of axis elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Storeys", "Storeys", "Single storey element or list of storey elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("Stages", "Stages", "Single Stage element of list of stage elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("PeakSmoothingRegion", "SmRegion", "Single peak smoothing region element or list of peak smoothing region elements.", GH_ParamAccess.list); + pManager.AddGenericParameter("ResultPoints", "ResultPoints", "Single result point or list of result points.", GH_ParamAccess.list); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // set references + FemDesign.Model model = null; + if (!DA.GetData("Model", ref model)) + { + return; + } + if (model == null) + { + return; + } + + List axes; + if (model.Entities.Axes != null) + { + axes = model.Entities.Axes.Axis; + } + else + { + axes = null; + } + + List storeys; + if (model.Entities.Storeys != null) + { + storeys = model.Entities.Storeys.Storey; + } + else + { + storeys = null; + } + + List stages = null; + if (model.ConstructionStages != null) + { + stages = model.ConstructionStages.Stages; + } + + List labelledSections = null; + if (model.Entities.LabelledSections != null) + { + labelledSections = model.Entities.LabelledSections.LabelledSections; + } + + List resPoints; + if (model.Entities.ResultPoints != null) + { + resPoints = model.Entities.ResultPoints.ResultPoints; + } + else + { + resPoints = null; + } + + // return data + DA.SetData("CountryCode", model.Country.ToString()); + DA.SetDataList("Foundations", model.Entities.Foundations.GetFoundations()); + DA.SetDataList("Bars", model.Entities.Bars); + DA.SetDataList("FictitiousBars", model.Entities.AdvancedFem.FictitiousBars); + DA.SetDataList("Shells", model.Entities.Slabs); + DA.SetDataList("FictitiousShells", model.Entities.AdvancedFem.FictitiousShells); + DA.SetDataList("Diaphragms", model.Entities.AdvancedFem.Diaphragms); + DA.SetDataList("LabelledSection", labelledSections); + DA.SetDataList("Panels", model.Entities.Panels); + DA.SetDataList("Covers", model.Entities.AdvancedFem.Covers); + DA.SetDataList("Loads", model.Entities.Loads.GetLoads()); + DA.SetDataList("LoadCases", model.Entities.Loads.LoadCases); + DA.SetDataList("LoadCombinations", model.Entities.Loads.LoadCombinations); + DA.SetDataList("LoadGroups", model.Entities.Loads.GetLoadGroups()); + DA.SetDataList("Supports", model.Entities.Supports.GetSupports()); + DA.SetDataList("Axes", axes); + DA.SetDataList("Storeys", storeys); + DA.SetDataList("Stages", stages); + DA.SetDataList("PeakSmoothingRegion", model.Entities.PeakSmoothingRegions); + DA.SetDataList("ResultPoints", resPoints); + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.ModelDeconstruct; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{57480A5B-E2B2-4C1C-8A11-6700A77F89BC}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/LongitudinalBarDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Reinforcement/LongitudinalBarDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/LongitudinalBarDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Reinforcement/LongitudinalBarDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/StirrupDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Reinforcement/StirrupDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/StirrupDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Reinforcement/StirrupDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/StraightDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Reinforcement/StraightDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/StraightDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Reinforcement/StraightDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SurfaceReinforcementDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Reinforcement/SurfaceReinforcementDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SurfaceReinforcementDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Reinforcement/SurfaceReinforcementDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SurfaceReinforcementParametersDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Reinforcement/SurfaceReinforcementParametersDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SurfaceReinforcementParametersDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Reinforcement/SurfaceReinforcementParametersDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/WireDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Reinforcement/WireDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/WireDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Reinforcement/WireDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/EdgeConnectionDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Shells/EdgeConnectionDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/EdgeConnectionDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Shells/EdgeConnectionDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/PanelContinousDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Shells/PanelContinousDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/PanelContinousDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Shells/PanelContinousDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/PeakSmoothingRegionDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Shells/PeakSmoothingRegionDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/PeakSmoothingRegionDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Shells/PeakSmoothingRegionDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SlabDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Shells/SlabDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SlabDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Shells/SlabDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/ThicknessDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Shells/ThicknessDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/ThicknessDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Shells/ThicknessDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/AxisDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/StructureGrid/AxisDeconstruct.cs similarity index 96% rename from FemDesign.Grasshopper/Deconstruct/AxisDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/StructureGrid/AxisDeconstruct.cs index 0ae26a4fd..30a1042b0 100644 --- a/FemDesign.Grasshopper/Deconstruct/AxisDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/StructureGrid/AxisDeconstruct.cs @@ -53,7 +53,7 @@ public override Guid ComponentGuid { get { return new Guid("c07a9120-8013-4227-87bb-da374511fbfe"); } } - public override GH_Exposure Exposure => GH_Exposure.secondary; + public override GH_Exposure Exposure => GH_Exposure.senary; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/StoreyDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/StructureGrid/StoreyDeconstruct.cs similarity index 96% rename from FemDesign.Grasshopper/Deconstruct/StoreyDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/StructureGrid/StoreyDeconstruct.cs index b7fca64b9..f55adfcdb 100644 --- a/FemDesign.Grasshopper/Deconstruct/StoreyDeconstruct.cs +++ b/FemDesign.Grasshopper/Deconstruct/StructureGrid/StoreyDeconstruct.cs @@ -56,7 +56,7 @@ public override Guid ComponentGuid get { return new Guid("2a4592ee-9f88-484d-8409-9ae1efad88a6"); } } - public override GH_Exposure Exposure => GH_Exposure.secondary; + public override GH_Exposure Exposure => GH_Exposure.senary; } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Deconstruct/GenericSupportObjectSortSupports.cs b/FemDesign.Grasshopper/Deconstruct/Supports/GenericSupportObjectSortSupports.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/GenericSupportObjectSortSupports.cs rename to FemDesign.Grasshopper/Deconstruct/Supports/GenericSupportObjectSortSupports.cs diff --git a/FemDesign.Grasshopper/Deconstruct/MotionsDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Supports/MotionsDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/MotionsDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Supports/MotionsDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/RotationsDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Supports/RotationsDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/RotationsDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Supports/RotationsDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SupportDirectedDeconstruct.cs b/FemDesign.Grasshopper/Deconstruct/Supports/SupportDirectedDeconstruct.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SupportDirectedDeconstruct.cs rename to FemDesign.Grasshopper/Deconstruct/Supports/SupportDirectedDeconstruct.cs diff --git a/FemDesign.Grasshopper/Deconstruct/SupportGroupDeconstuctor.cs b/FemDesign.Grasshopper/Deconstruct/Supports/SupportGroupDeconstuctor.cs similarity index 100% rename from FemDesign.Grasshopper/Deconstruct/SupportGroupDeconstuctor.cs rename to FemDesign.Grasshopper/Deconstruct/Supports/SupportGroupDeconstuctor.cs diff --git a/FemDesign.Grasshopper/Drawing/DimensionLinear.cs b/FemDesign.Grasshopper/Drawing/DimensionLinear.cs index 18198dd89..fcf2b2c18 100644 --- a/FemDesign.Grasshopper/Drawing/DimensionLinear.cs +++ b/FemDesign.Grasshopper/Drawing/DimensionLinear.cs @@ -145,134 +145,4 @@ public override Guid ComponentGuid public override GH_Exposure Exposure => GH_Exposure.septenary; } - public class DimensionLinearDeconstruct : FEM_Design_API_Component - { - public DimensionLinearDeconstruct() : base("LinearDimensionDeconstruct", "LnDimDecon", "Deconstruct or modify a linear dimension.", CategoryName.Name(), "Deconstruct") - { - - } - protected override void RegisterInputParams(GH_InputParamManager pManager) - { - pManager.AddGenericParameter("LinearDimension", "LnDim", "Linear dimension.", GH_ParamAccess.item); - pManager.AddPlaneParameter("Point|Plane", "Point|Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddPointParameter("ReferencePoints", "RefPoints", "Points on dimension line to measure between.", GH_ParamAccess.list); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("ArrowType", "ArrowType", $"Dimension line arrow type. Connect 'ValueList' to get the options: {DimensionLinear.ArrowTypeValueListDescription}", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddIntegerParameter("Decimals", "Decimals", "Number of decimals of measurements.", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("LengthUnit", "LengthUnit", $"Length unit of measurements. Connect 'ValueList' to get the options: {DimensionLinear.LengthUnitValueListDescription}", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddBooleanParameter("ShowUnit", "ShowUnit", "Show length unit on measurement.", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - } - protected override void RegisterOutputParams(GH_OutputParamManager pManager) - { - pManager.AddGenericParameter("LinearDimension", "LnDim", "Linear dimension.", GH_ParamAccess.item); - pManager.AddPlaneParameter("Plane", "Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); - pManager.AddPointParameter("ReferencePoints", "RefPoints", "Points on dimension line to measure between.", GH_ParamAccess.list); - pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); - pManager.AddTextParameter("ArrowType", "ArrowType", $"Dimension line arrow type.", GH_ParamAccess.item); - pManager.AddIntegerParameter("Decimals", "Decimals", "Number of decimals of measurements.", GH_ParamAccess.item); - pManager.AddTextParameter("LengthUnit", "LengthUnit", "Length unit of measurements", GH_ParamAccess.item); - pManager.AddBooleanParameter("ShowUnit", "ShowUnit", "Show length unit on measurement.", GH_ParamAccess.item); - } - - protected override void BeforeSolveInstance() - { - ValueListUtils.updateValueLists(this, 4, DimensionLinear.ArrowTypeValueList, null, 0); - ValueListUtils.updateValueLists(this, 6, DimensionLinear.LengthUnitValueList, null, 0); - } - protected override void SolveInstance(IGH_DataAccess DA) - { - Drawing.DimensionLinear dim = null; - if (!DA.GetData(0, ref dim)) - { - return; - } - - var plane = dim.Plane.ToRhinoPlane(); - if (DA.GetData(1, ref plane)) - { - dim.Plane = plane.ToPlane(); - } - - List refPoints = dim.ReferencePoints.Select(x => x.ToRhino()).ToList(); - if (!DA.GetDataList(2, refPoints)) - { - dim.ReferencePoints = refPoints.Select(x => x.FromRhino()).ToList(); - } - - double size = dim.Font.Size; - if (DA.GetData(3, ref size)) - { - dim.Font.Size = size; - } - - string arrowType = dim.Arrow.Type.ToString(); - if (DA.GetData(4, ref arrowType)) - { - if (Enum.TryParse(arrowType, out Struxml.Arrowtype_type arrowTypeEnum)) - { - dim.Arrow.Type = arrowTypeEnum; - } - else - { - throw new System.ArgumentException($"Invalid horisontal alignment value: {arrowType}, must be one of the following values: {DimensionLinear.ArrowTypeValueListDescription}"); - } - } - - int decimals = dim.Decimals; - if (DA.GetData(5, ref decimals)) - { - dim.Decimals = decimals; - } - - string lengthUnit = dim.LengthUnit.ToString(); - if (DA.GetData(6, ref lengthUnit)) - { - if (Enum.TryParse(lengthUnit, out Struxml.Lengthunit_type lengthUnitEnum)) - { - dim.LengthUnit = lengthUnitEnum; - } - else - { - throw new System.ArgumentException($"Invalid horisontal alignment value: {lengthUnit}, must be one of the following values: {DimensionLinear.LengthUnitValueListDescription}"); - } - } - - bool showUnit = dim.ShowUnit; - if (DA.GetData(7, ref showUnit)) - { - dim.ShowUnit = showUnit; - } - - DA.SetData(0, dim); - DA.SetData(1, plane); - DA.SetDataList(2, refPoints); - DA.SetData(3, size); - DA.SetData(4, arrowType); - DA.SetData(5, decimals); - DA.SetData(6, lengthUnit); - DA.SetData(7, showUnit); - - } - - protected override System.Drawing.Bitmap Icon - { - get - { - return FemDesign.Properties.Resources.DimensionLinearDeconstruct; - } - } - public override Guid ComponentGuid - { - get { return new Guid("7D89524B-5FAC-4C0E-AD73-65AA08FCC2E6"); } - } - - public override GH_Exposure Exposure => GH_Exposure.secondary; - } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/Drawing/TextAnnotation.cs b/FemDesign.Grasshopper/Drawing/TextAnnotation.cs index 627cd2ae2..dd3e775c6 100644 --- a/FemDesign.Grasshopper/Drawing/TextAnnotation.cs +++ b/FemDesign.Grasshopper/Drawing/TextAnnotation.cs @@ -146,126 +146,4 @@ public override Guid ComponentGuid public override GH_Exposure Exposure => GH_Exposure.septenary; } - public class TextAnnotationDeconstruct : FEM_Design_API_Component - { - public TextAnnotationDeconstruct() : base("TextAnnotationDeconstruct", "TxtAnnotDecon", "Deconstruct or modify a text annotation.", CategoryName.Name(), "Deconstruct") - { - - } - protected override void RegisterInputParams(GH_InputParamManager pManager) - { - pManager.AddGenericParameter("TextAnnotation", "TextAnnotation", "TextAnnotation", GH_ParamAccess.item); - pManager.AddPlaneParameter("Point|Plane", "Point|Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("Text", "Text", "Text.", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddColourParameter("Colour", "Colour", "Colour of text. [ARGB]", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("HorisontalAligment", "HorAlign", $"Horisontal alignement of text. Connect 'ValueList' to get the options: {TextAnnotation.HorAlignValueListDescription}", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("VerticalAligment", "VerAlign", $"Vertical alignement of text. Connect 'ValueList' to get the options: {TextAnnotation.VerAlignValueListDescription}", GH_ParamAccess.item); - pManager[pManager.ParamCount - 1].Optional = true; - } - protected override void RegisterOutputParams(GH_OutputParamManager pManager) - { - pManager.AddGenericParameter("TextAnnotation", "TextAnnotation", "TextAnnotation.", GH_ParamAccess.item); - pManager.AddPlaneParameter("Plane", "Plane", "Position and orientation of text. [m]", GH_ParamAccess.item); - pManager.AddTextParameter("Text", "Text", "Text.", GH_ParamAccess.item); - pManager.AddNumberParameter("FontSize", "FontSize", "Font size of text. [m]", GH_ParamAccess.item); - pManager.AddColourParameter("Colour", "Colour", "Colour of text [ARGB]", GH_ParamAccess.item); - pManager.AddTextParameter("HorisontalAligment", "HorAlign", "Horisontal alignement of text", GH_ParamAccess.item); - pManager.AddTextParameter("VerticalAligment", "VerAlign", "Vertical alignement of text", GH_ParamAccess.item); - } - protected override void BeforeSolveInstance() - { - ValueListUtils.updateValueLists(this, 5, TextAnnotation.HorAlignValueList, null, 0); - ValueListUtils.updateValueLists(this, 6, TextAnnotation.VerAlignValueList, null, 0); - } - protected override void SolveInstance(IGH_DataAccess DA) - { - Drawing.TextAnnotation origTextAnnot = null; - if (!DA.GetData(0, ref origTextAnnot)) - { - return; - } - - var textAnnot = origTextAnnot.DeepClone(); - - var plane = new Plane(textAnnot.Position.ToRhino(), textAnnot.LocalX.ToRhino(), textAnnot.LocalY.ToRhino()); - if (DA.GetData(1, ref plane)) - { - textAnnot.Position = plane.Origin.FromRhino(); - textAnnot.LocalX = plane.XAxis.FromRhino(); - textAnnot.LocalY = plane.YAxis.FromRhino(); - } - - string text = textAnnot.Text; - if (DA.GetData(2, ref text)) - { - textAnnot.Text = text; - } - - double size = textAnnot.StyleType.Font.Size; - if (DA.GetData(3, ref size)) - { - textAnnot.StyleType.Font.Size = size; - } - - System.Drawing.Color color = textAnnot.StyleType.GetColor; - if (DA.GetData(4, ref color)) - { - textAnnot.StyleType.SetColor = color; - } - - string horAlign = textAnnot.StyleType.Font.H_align.ToString(); - if (DA.GetData(5, ref horAlign)) - { - if (Enum.TryParse(horAlign, out StruSoft.Interop.StruXml.Data.Hor_align horAlignEnum)) - { - textAnnot.StyleType.Font.H_align = horAlignEnum; - } - else - { - throw new System.ArgumentException($"Invalid horisontal alignment value: {horAlign}, must be one of the following values: {TextAnnotation.HorAlignValueListDescription}"); - } - } - - string verAlign = textAnnot.StyleType.Font.V_align.ToString(); - if (DA.GetData(6, ref verAlign)) - { - if (Enum.TryParse(verAlign, out StruSoft.Interop.StruXml.Data.Ver_align verAlignEnum)) - { - textAnnot.StyleType.Font.V_align = verAlignEnum; - } - else - { - throw new System.ArgumentException($"Invalid vertical alignment value: {verAlign}, must be one of the following values: {TextAnnotation.VerAlignValueListDescription}"); - } - } - - DA.SetData(0, textAnnot); - DA.SetData(1, plane); - DA.SetData(2, text); - DA.SetData(3, size); - DA.SetData(4, color); - DA.SetData(5, horAlign); - DA.SetData(6, verAlign); - } - - protected override System.Drawing.Bitmap Icon - { - get - { - return FemDesign.Properties.Resources.TextAnnotationDeconstruct; - } - } - public override Guid ComponentGuid - { - get { return new Guid("7C35D2FF-75B1-4561-A9BE-B7D22FE93B95"); } - } - - public override GH_Exposure Exposure => GH_Exposure.secondary; - } } \ No newline at end of file diff --git a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj index 0df097273..8bbff3407 100644 --- a/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj +++ b/FemDesign.Grasshopper/FemDesign.Grasshopper.csproj @@ -69,10 +69,17 @@ Properties\GlobalAssemblyInfo.cs - - - - + + + + + + + + + + + @@ -119,9 +126,10 @@ + - + @@ -135,6 +143,8 @@ + + @@ -158,19 +168,19 @@ - - + + - - - + + + - + - - + + @@ -198,8 +208,8 @@ - - + + @@ -287,7 +297,7 @@ - + @@ -300,43 +310,43 @@ - + - - - - - - - - + + + + + + + + - + - + - - - + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + @@ -931,6 +941,11 @@ + + + + + diff --git a/FemDesign.Grasshopper/Geometry/Convert.cs b/FemDesign.Grasshopper/Geometry/Convert.cs index b2a684bb7..19face516 100644 --- a/FemDesign.Grasshopper/Geometry/Convert.cs +++ b/FemDesign.Grasshopper/Geometry/Convert.cs @@ -56,7 +56,7 @@ internal static Rhino.Geometry.Curve GetRhinoCurve(this Bars.Bar bar) /// /// Create Rhino brep from underlying Region of Cover. /// - internal static Rhino.Geometry.Brep GetRhinoSurface(this Cover cover) + internal static Rhino.Geometry.Brep GetRhinoSurface(this ModellingTools.Cover cover) { return cover.Region.ToRhinoBrep(); } @@ -64,7 +64,7 @@ internal static Rhino.Geometry.Brep GetRhinoSurface(this Cover cover) /// /// Create Rhino curves from underlying Edges in Region of Cover. /// - internal static List GetRhinoCurves(this Cover cover) + internal static List GetRhinoCurves(this ModellingTools.Cover cover) { return cover.Region.ToRhinoCurves(); } diff --git a/FemDesign.Grasshopper/Model/OBSOLETE/ModelAddElements2OBSOLETE.cs b/FemDesign.Grasshopper/Model/OBSOLETE/ModelAddElements2OBSOLETE.cs index 8de9e6da0..41b8718f4 100644 --- a/FemDesign.Grasshopper/Model/OBSOLETE/ModelAddElements2OBSOLETE.cs +++ b/FemDesign.Grasshopper/Model/OBSOLETE/ModelAddElements2OBSOLETE.cs @@ -69,7 +69,7 @@ protected override void SolveInstance(IGH_DataAccess DA) List panels = new List(); DA.GetDataList("Panels", panels); - List covers = new List(); + List covers = new List(); DA.GetDataList("Covers", covers); List loads = new List(); diff --git a/FemDesign.Grasshopper/Model/OBSOLETE/ModelCreate3OBSOLETE.cs b/FemDesign.Grasshopper/Model/OBSOLETE/ModelCreate3OBSOLETE.cs index b46c9a67f..706f222c6 100644 --- a/FemDesign.Grasshopper/Model/OBSOLETE/ModelCreate3OBSOLETE.cs +++ b/FemDesign.Grasshopper/Model/OBSOLETE/ModelCreate3OBSOLETE.cs @@ -70,7 +70,7 @@ protected override void SolveInstance(IGH_DataAccess DA) List panels = new List(); DA.GetDataList("Panels", panels); - List covers = new List(); + List covers = new List(); DA.GetDataList("Covers", covers); List loads = new List(); diff --git a/FemDesign.Grasshopper/AdvancedFem/CoverOneWay.cs b/FemDesign.Grasshopper/ModellingTools/CoverOneWay.cs similarity index 92% rename from FemDesign.Grasshopper/AdvancedFem/CoverOneWay.cs rename to FemDesign.Grasshopper/ModellingTools/CoverOneWay.cs index 01ae21c54..c7c6eef5f 100644 --- a/FemDesign.Grasshopper/AdvancedFem/CoverOneWay.cs +++ b/FemDesign.Grasshopper/ModellingTools/CoverOneWay.cs @@ -57,7 +57,7 @@ protected override void SolveInstance(IGH_DataAccess DA) FemDesign.Geometry.Vector3d fdVector3d = vector.FromRhino().Normalize(); // - FemDesign.Cover obj = FemDesign.Cover.OneWayCover(region, structures, fdVector3d, identifier); + FemDesign.ModellingTools.Cover obj = FemDesign.ModellingTools.Cover.OneWayCover(region, structures, fdVector3d, identifier); // return DA.SetData(0, obj); @@ -74,7 +74,7 @@ public override Guid ComponentGuid { get { return new Guid("{7F1B0264-54F0-4D31-BEB3-23E5F151FE09}"); } } - public override GH_Exposure Exposure => GH_Exposure.septenary; + public override GH_Exposure Exposure => GH_Exposure.quinary; } } diff --git a/FemDesign.Grasshopper/AdvancedFem/CoverTwoWay.cs b/FemDesign.Grasshopper/ModellingTools/CoverTwoWay.cs similarity index 92% rename from FemDesign.Grasshopper/AdvancedFem/CoverTwoWay.cs rename to FemDesign.Grasshopper/ModellingTools/CoverTwoWay.cs index 690fff0da..d8d73daa7 100644 --- a/FemDesign.Grasshopper/AdvancedFem/CoverTwoWay.cs +++ b/FemDesign.Grasshopper/ModellingTools/CoverTwoWay.cs @@ -48,7 +48,7 @@ protected override void SolveInstance(IGH_DataAccess DA) FemDesign.Geometry.Region region = brep.FromRhino(); // - FemDesign.Cover obj = FemDesign.Cover.TwoWayCover(region, structures, identifier); + FemDesign.ModellingTools.Cover obj = FemDesign.ModellingTools.Cover.TwoWayCover(region, structures, identifier); // return DA.SetData(0, obj); @@ -65,7 +65,7 @@ public override Guid ComponentGuid { get { return new Guid("{63D6BD65-94F5-4B78-95D8-141630B8FF9E}"); } } - public override GH_Exposure Exposure => GH_Exposure.septenary; + public override GH_Exposure Exposure => GH_Exposure.quinary; } diff --git a/FemDesign.Grasshopper/ModellingTools/DiaphragmConstruct.cs b/FemDesign.Grasshopper/ModellingTools/DiaphragmConstruct.cs index 8e12a5af6..bfc841bf3 100644 --- a/FemDesign.Grasshopper/ModellingTools/DiaphragmConstruct.cs +++ b/FemDesign.Grasshopper/ModellingTools/DiaphragmConstruct.cs @@ -8,7 +8,7 @@ namespace FemDesign.Grasshopper { public class DiaphragmConstruct: FEM_Design_API_Component { - public DiaphragmConstruct(): base("Diaphragm.Construct", "Construct", "Construct a fictitious shell", "FEM-Design", "ModellingTools") + public DiaphragmConstruct(): base("Diaphragm.Construct", "Construct", "Construct a Diaphragm.", "FEM-Design", "ModellingTools") { } diff --git a/FemDesign.Grasshopper/ModellingTools/LineConnection.cs b/FemDesign.Grasshopper/ModellingTools/LineConnection.cs index ba21c26bd..eb71878d2 100644 --- a/FemDesign.Grasshopper/ModellingTools/LineConnection.cs +++ b/FemDesign.Grasshopper/ModellingTools/LineConnection.cs @@ -8,28 +8,33 @@ namespace FemDesign.Grasshopper { public class LineConnection : FEM_Design_API_Component { - public LineConnection() : base("LineConnection", "LineConnection", "Construct a Line Connection", "FEM-Design", "ModellingTools") + public LineConnection() : base("LineConnection", "LnConnect", "Construct a Line Connection.", "FEM-Design", "ModellingTools") { } protected override void RegisterInputParams(GH_InputParamManager pManager) { - pManager.AddCurveParameter("MasterLine", "MasterLine", "LineCurve", GH_ParamAccess.item); - pManager.AddCurveParameter("SlaveLine", "SlaveLine", "LineCurve", GH_ParamAccess.item); + pManager.AddGenericParameter("ElementsToConnect", "Elements", "Structural elements to be connected (bars, slabs, supports, etc.).", GH_ParamAccess.list); + + pManager.AddCurveParameter("MasterLine", "MLine", "LineCurve", GH_ParamAccess.item); + pManager.AddCurveParameter("SlaveLine", "SLine", "LineCurve", GH_ParamAccess.item); - pManager.AddGenericParameter("Motion", "Motion", "Motion.", GH_ParamAccess.item); + pManager.AddGenericParameter("Motion", "Mot", "Motion.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("Rotation", "Rotation", "Rotation.", GH_ParamAccess.item); + pManager.AddGenericParameter("MotionsPlasticLimits", "PlaLimM", "Plastic limits forces for motion springs. No plastic limits defined by default.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to Curve mid-point local x-axis. This parameter overrides OrientLCS", GH_ParamAccess.item); + pManager.AddGenericParameter("Rotation", "Rot", "Rotation.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddVectorParameter("LocalY", "LocalY", "Set local y-axis. Vector must be perpendicular to Curve mid-point local x-axis. This parameter overrides OrientLCS", GH_ParamAccess.item); + pManager.AddGenericParameter("RotationsPlaticLimits", "PlaLimR", "Plastic limits moments for rotation springs. No plastic limits defined by default.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("ElementToConnect", "ElementToConnect", "ElementToConnect.", GH_ParamAccess.list); + pManager.AddVectorParameter("LocalX", "X", "Set local x-axis. Vector must be perpendicular to Curve mid-point local x-axis.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalY", "Y", "Set local y-axis. Vector must be perpendicular to Curve mid-point local y-axis.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("Identifier", "Identifier", "Identifier.", GH_ParamAccess.item, "CL"); + pManager.AddTextParameter("Identifier", "ID", "Identifier.", GH_ParamAccess.item, "CL"); pManager[pManager.ParamCount - 1].Optional = true; } protected override void RegisterOutputParams(GH_OutputParamManager pManager) @@ -43,48 +48,55 @@ protected override void SolveInstance(IGH_DataAccess DA) double interfaceStart = 0.50; double interfaceEnd = 0.50; + // get input + var elements = new List(); + DA.GetDataList(0, elements); Rhino.Geometry.Curve firstEdge = null; - DA.GetData(0, ref firstEdge); + DA.GetData(1, ref firstEdge); Rhino.Geometry.Curve secondEdge = null; - DA.GetData(1, ref secondEdge); + DA.GetData(2, ref secondEdge); Releases.Motions motions = null; - if (!DA.GetData(2, ref motions)) + if (!DA.GetData(3, ref motions)) { motions = Releases.Motions.RigidLine(); } + Releases.MotionsPlasticLimits motLimits = null; + DA.GetData(4, ref motLimits); + Releases.Rotations rotations = null; - if (!DA.GetData(3, ref rotations)) + if (!DA.GetData(5, ref rotations)) { rotations = Releases.Rotations.RigidLine(); } + Releases.RotationsPlasticLimits rotLimits = null; + DA.GetData(6, ref rotLimits); Plane plane; var averageCurve = Curve.CreateTweenCurves(firstEdge, secondEdge, 1, 0.01)[0]; - averageCurve.PerpendicularFrameAt(averageCurve.GetLength()/2.0, out plane); + averageCurve.PerpendicularFrameAt(averageCurve.GetLength() / 2.0, out plane); - Rhino.Geometry.Vector3d localX = Vector3d.Zero; - if (!DA.GetData(4, ref localX)) + Rhino.Geometry.Vector3d localX = plane.XAxis; + DA.GetData(7, ref localX); + if(localX == null || localX.IsZero) { - localX = plane.XAxis; + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "LocalX parameter cannot be null or zero."); } - Rhino.Geometry.Vector3d localY = Vector3d.Zero; - if (!DA.GetData(5, ref localY)) + Rhino.Geometry.Vector3d localY = plane.YAxis; + DA.GetData(8, ref localY); + if (localY == null || localY.IsZero) { - localY = plane.YAxis; + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "LocalY parameter cannot be null or zero."); } - var elements = new List(); - DA.GetDataList(6, elements); - string identifier = "CL"; - DA.GetData(7, ref identifier); + DA.GetData(9, ref identifier); GuidListType[] refs = new GuidListType[elements.Count]; for (int idx = 0; idx < refs.Length; idx++) @@ -104,11 +116,11 @@ protected override void SolveInstance(IGH_DataAccess DA) } - - var rigidity = new Releases.RigidityDataType3(motions, rotations); + var rigidity = new Releases.RigidityDataType3(motions, motLimits, rotations, rotLimits); var connectedLines = new FemDesign.ModellingTools.ConnectedLines(firstEdge.FromRhino(), secondEdge.FromRhino(), localX.FromRhino(), localY.FromRhino(), rigidity, refs, identifier, movingLocal, interfaceStart, interfaceEnd); + // output DA.SetData(0, connectedLines); @@ -122,7 +134,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("{2A493ED7-9395-47B5-8321-FF797692DEEF}"); } + get { return new Guid("{1240C784-AE43-45B4-9AA2-A75692708979}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/AdvancedFem/Obsolete/CoverOneWayOBSOLETE.cs b/FemDesign.Grasshopper/ModellingTools/Obsolete/CoverOneWayOBSOLETE.cs similarity index 96% rename from FemDesign.Grasshopper/AdvancedFem/Obsolete/CoverOneWayOBSOLETE.cs rename to FemDesign.Grasshopper/ModellingTools/Obsolete/CoverOneWayOBSOLETE.cs index 0bfc6ced7..da950ce64 100644 --- a/FemDesign.Grasshopper/AdvancedFem/Obsolete/CoverOneWayOBSOLETE.cs +++ b/FemDesign.Grasshopper/ModellingTools/Obsolete/CoverOneWayOBSOLETE.cs @@ -78,7 +78,7 @@ protected override void SolveInstance(IGH_DataAccess DA) FemDesign.Geometry.Vector3d fdVector3d = vector.FromRhino().Normalize(); // - FemDesign.Cover obj = FemDesign.Cover.OneWayCover(region, structures, fdVector3d, identifier); + FemDesign.ModellingTools.Cover obj = FemDesign.ModellingTools.Cover.OneWayCover(region, structures, fdVector3d, identifier); // return DA.SetData(0, obj); diff --git a/FemDesign.Grasshopper/AdvancedFem/Obsolete/CoverTwoWayOBSOLETE.cs b/FemDesign.Grasshopper/ModellingTools/Obsolete/CoverTwoWayOBSOLETE.cs similarity index 96% rename from FemDesign.Grasshopper/AdvancedFem/Obsolete/CoverTwoWayOBSOLETE.cs rename to FemDesign.Grasshopper/ModellingTools/Obsolete/CoverTwoWayOBSOLETE.cs index ab178227a..9759d369d 100644 --- a/FemDesign.Grasshopper/AdvancedFem/Obsolete/CoverTwoWayOBSOLETE.cs +++ b/FemDesign.Grasshopper/ModellingTools/Obsolete/CoverTwoWayOBSOLETE.cs @@ -69,7 +69,7 @@ protected override void SolveInstance(IGH_DataAccess DA) FemDesign.Geometry.Region region = brep.FromRhino(); // - FemDesign.Cover obj = FemDesign.Cover.TwoWayCover(region, structures, identifier); + FemDesign.ModellingTools.Cover obj = FemDesign.ModellingTools.Cover.TwoWayCover(region, structures, identifier); // return DA.SetData(0, obj); diff --git a/FemDesign.Grasshopper/ModellingTools/Obsolete/LineConnection_OBSOLETE.cs b/FemDesign.Grasshopper/ModellingTools/Obsolete/LineConnection_OBSOLETE.cs new file mode 100644 index 000000000..b66ed3bab --- /dev/null +++ b/FemDesign.Grasshopper/ModellingTools/Obsolete/LineConnection_OBSOLETE.cs @@ -0,0 +1,131 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class LineConnection_OBSOLETE : FEM_Design_API_Component + { + public LineConnection_OBSOLETE() : base("LineConnection", "LnConnect", "Construct a Line Connection.", "FEM-Design", "ModellingTools") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddCurveParameter("MasterLine", "MasterLine", "LineCurve", GH_ParamAccess.item); + pManager.AddCurveParameter("SlaveLine", "SlaveLine", "LineCurve", GH_ParamAccess.item); + + pManager.AddGenericParameter("Motion", "Motion", "Motion.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("Rotation", "Rotation", "Rotation.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddVectorParameter("LocalX", "LocalX", "Set local x-axis. Vector must be perpendicular to Curve mid-point local x-axis. This parameter overrides OrientLCS", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalY", "LocalY", "Set local y-axis. Vector must be perpendicular to Curve mid-point local x-axis. This parameter overrides OrientLCS", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddGenericParameter("ElementToConnect", "ElementToConnect", "ElementToConnect.", GH_ParamAccess.list); + + pManager.AddTextParameter("Identifier", "Identifier", "Identifier.", GH_ParamAccess.item, "CL"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("LineConnection", "LineConnection", "LineConnection.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // default value to do not overwhelm the user by input + bool movingLocal = true; + double interfaceStart = 0.50; + double interfaceEnd = 0.50; + + + Rhino.Geometry.Curve firstEdge = null; + DA.GetData(0, ref firstEdge); + + Rhino.Geometry.Curve secondEdge = null; + DA.GetData(1, ref secondEdge); + + + Releases.Motions motions = null; + if (!DA.GetData(2, ref motions)) + { + motions = Releases.Motions.RigidLine(); + } + + Releases.Rotations rotations = null; + if (!DA.GetData(3, ref rotations)) + { + rotations = Releases.Rotations.RigidLine(); + } + + + Plane plane; + var averageCurve = Curve.CreateTweenCurves(firstEdge, secondEdge, 1, 0.01)[0]; + averageCurve.PerpendicularFrameAt(averageCurve.GetLength()/2.0, out plane); + + Rhino.Geometry.Vector3d localX = Vector3d.Zero; + if (!DA.GetData(4, ref localX)) + { + localX = plane.XAxis; + } + + Rhino.Geometry.Vector3d localY = Vector3d.Zero; + if (!DA.GetData(5, ref localY)) + { + localY = plane.YAxis; + } + + var elements = new List(); + DA.GetDataList(6, elements); + + string identifier = "CL"; + DA.GetData(7, ref identifier); + + GuidListType[] refs = new GuidListType[elements.Count]; + for (int idx = 0; idx < refs.Length; idx++) + { + if (elements[idx] is Shells.Slab slab) + { + refs[idx] = new GuidListType(slab.SlabPart); + } + else if (elements[idx] is Bars.Bar bar) + { + refs[idx] = new GuidListType(bar.BarPart); + } + else + { + refs[idx] = new GuidListType(elements[idx]); + } + + } + + + var rigidity = new Releases.RigidityDataType3(motions, rotations); + + var connectedLines = new FemDesign.ModellingTools.ConnectedLines(firstEdge.FromRhino(), secondEdge.FromRhino(), localX.FromRhino(), localY.FromRhino(), rigidity, refs, identifier, movingLocal, interfaceStart, interfaceEnd); + + // output + DA.SetData(0, connectedLines); + + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.LineConnection; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{2A493ED7-9395-47B5-8321-FF797692DEEF}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/ModellingTools/Obsolete/PointConnection_OBSOLETE.cs b/FemDesign.Grasshopper/ModellingTools/Obsolete/PointConnection_OBSOLETE.cs new file mode 100644 index 000000000..fa2e50ab5 --- /dev/null +++ b/FemDesign.Grasshopper/ModellingTools/Obsolete/PointConnection_OBSOLETE.cs @@ -0,0 +1,105 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class PointConnection_OBSOLETE : FEM_Design_API_Component + { + public PointConnection_OBSOLETE() : base("PointConnection", "PtConnect", "Construct a Point Connection.", "FEM-Design", "ModellingTools") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + + pManager.AddPointParameter("MasterPoint", "MasterPoint", "Define a master point.", GH_ParamAccess.item); + pManager.AddPointParameter("OtherPoint", "OtherPoint", "Define an other point (slave point).", GH_ParamAccess.item); + pManager.AddGenericParameter("Motion", "Motion", "Default motion release is rigid (1.000e+10 kN/m).", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("Rotation", "Rotation", "Default rotation release is rigid (1.000e+10 kNm/rad).", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("ElementToConnect", "ElementToConnect", "Objects to connect.", GH_ParamAccess.list); + pManager.AddPlaneParameter("LocalPlane", "LocalPlane", "Default orientation is WorldXY Plane.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "Identifier", "Define an identifier (position number).", GH_ParamAccess.item, "CP"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("PointConnection", "PointConnection", "Point connection.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + Point3d masterPoint = Point3d.Unset; + DA.GetData(0, ref masterPoint); + + Rhino.Geometry.Point3d otherPoint = Point3d.Unset; + DA.GetData(1, ref otherPoint); + + Releases.Motions motions = null; + if (!DA.GetData(2, ref motions)) + { + motions = Releases.Motions.RigidPoint(); + } + + Releases.Rotations rotations = null; + if (!DA.GetData(3, ref rotations)) + { + rotations = Releases.Rotations.RigidPoint(); + } + + var elements = new List(); + DA.GetDataList(4, elements); + + Plane plane = Plane.WorldXY; + DA.GetData(5, ref plane); + //Conversion + FemDesign.Geometry.Plane fdPlane = plane.FromRhinoPlane(); + + string identifier = "CP"; + DA.GetData(6, ref identifier); + + GuidListType[] refs = new GuidListType[elements.Count]; + for (int idx = 0; idx < refs.Length; idx++) + { + if (elements[idx] is Shells.Slab slab) + { + refs[idx] = new GuidListType(slab.SlabPart); + } + else if (elements[idx] is Bars.Bar bar) + { + refs[idx] = new GuidListType(bar.BarPart); + } + else + { + refs[idx] = new GuidListType(elements[idx]); + } + } + + //var rigidity = new Releases.RigidityDataType2(motions, rotations); + + var connectedPoints = new FemDesign.ModellingTools.ConnectedPoints(fdPlane, masterPoint.FromRhino(), otherPoint.FromRhino(), motions, rotations, refs, identifier); + + // output + DA.SetData(0, connectedPoints); + + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.PointConnection; + } + } + public override Guid ComponentGuid + { + get { return new Guid("FCD121E5-3BCD-42A6-B8C8-CCEDA1DD5D80"); } + } + + public override GH_Exposure Exposure => GH_Exposure.hidden; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/ModellingTools/PointConnection.cs b/FemDesign.Grasshopper/ModellingTools/PointConnection.cs index fcf0e8b86..12b3e02d5 100644 --- a/FemDesign.Grasshopper/ModellingTools/PointConnection.cs +++ b/FemDesign.Grasshopper/ModellingTools/PointConnection.cs @@ -8,23 +8,31 @@ namespace FemDesign.Grasshopper { public class PointConnection : FEM_Design_API_Component { - public PointConnection() : base("PointConnection", "PtConnect", "Construct a Point Connection", "FEM-Design", "ModellingTools") + public PointConnection() : base("PointConnection", "PtConnect", "Construct a Point Connection.", CategoryName.Name(), "ModellingTools") { } protected override void RegisterInputParams(GH_InputParamManager pManager) { + pManager.AddGenericParameter("ElementsToConnect", "Elements", "Structural elements to be connected (bars, slabs, supports, etc.).", GH_ParamAccess.list); - pManager.AddPointParameter("MasterPoint", "MasterPoint", "Define a master point.", GH_ParamAccess.item); - pManager.AddPointParameter("OtherPoint", "OtherPoint", "Define an other point (slave point).", GH_ParamAccess.item); - pManager.AddGenericParameter("Motion", "Motion", "Default motion release is rigid (1.000e+10 kN/m).", GH_ParamAccess.item); + pManager.AddPointParameter("MasterPoint", "MPoint", "Define a master point.", GH_ParamAccess.item); + pManager.AddPointParameter("SlavePoint", "SPoint", "Define a slave point.", GH_ParamAccess.item); + + pManager.AddGenericParameter("Motion", "Mot", "Default motion release is rigid (1.000e+10 kN/m).", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("MotionsPlasticLimits", "PlaLimM", "Plastic limits forces for motion springs. No plastic limits defined by default.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + + pManager.AddGenericParameter("Rotation", "Rot", "Default rotation release is rigid (1.000e+10 kNm/rad).", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("Rotation", "Rotation", "Default rotation release is rigid (1.000e+10 kNm/rad).", GH_ParamAccess.item); + pManager.AddGenericParameter("RotationsPlaticLimits", "PlaLimR", "Plastic limits moments for rotation springs. No plastic limits defined by default.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddGenericParameter("ElementToConnect", "ElementToConnect", "Objects to connect.", GH_ParamAccess.list); - pManager.AddPlaneParameter("LocalPlane", "LocalPlane", "Default orientation is WorldXY Plane.", GH_ParamAccess.item); + + pManager.AddPlaneParameter("LocalPlane", "Plane", "Default orientation is WorldXY Plane.", GH_ParamAccess.item); pManager[pManager.ParamCount - 1].Optional = true; - pManager.AddTextParameter("Identifier", "Identifier", "Define an identifier (position number).", GH_ParamAccess.item, "CP"); + + pManager.AddTextParameter("Identifier", "ID", "Define an identifier.", GH_ParamAccess.item, "CP"); pManager[pManager.ParamCount - 1].Optional = true; } protected override void RegisterOutputParams(GH_OutputParamManager pManager) @@ -33,34 +41,42 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) } protected override void SolveInstance(IGH_DataAccess DA) { + // get input + var elements = new List(); + DA.GetDataList(0, elements); + Point3d masterPoint = Point3d.Unset; - DA.GetData(0, ref masterPoint); + DA.GetData(1, ref masterPoint); - Rhino.Geometry.Point3d otherPoint = Point3d.Unset; - DA.GetData(1, ref otherPoint); + Point3d slavePoint = Point3d.Unset; + DA.GetData(2, ref slavePoint); Releases.Motions motions = null; - if (!DA.GetData(2, ref motions)) + if (!DA.GetData(3, ref motions)) { motions = Releases.Motions.RigidPoint(); } + Releases.MotionsPlasticLimits motLimits = null; + DA.GetData(4, ref motLimits); + Releases.Rotations rotations = null; - if (!DA.GetData(3, ref rotations)) + if (!DA.GetData(5, ref rotations)) { rotations = Releases.Rotations.RigidPoint(); } - var elements = new List(); - DA.GetDataList(4, elements); + Releases.RotationsPlasticLimits rotLimits = null; + DA.GetData(6, ref rotLimits); Plane plane = Plane.WorldXY; - DA.GetData(5, ref plane); + DA.GetData(7, ref plane); //Conversion FemDesign.Geometry.Plane fdPlane = plane.FromRhinoPlane(); string identifier = "CP"; - DA.GetData(6, ref identifier); + DA.GetData(8, ref identifier); + GuidListType[] refs = new GuidListType[elements.Count]; for (int idx = 0; idx < refs.Length; idx++) @@ -79,11 +95,10 @@ protected override void SolveInstance(IGH_DataAccess DA) } } - //var rigidity = new Releases.RigidityDataType2(motions, rotations); + var connectedPoints = new FemDesign.ModellingTools.ConnectedPoints(fdPlane, masterPoint.FromRhino(), slavePoint.FromRhino(), motions, motLimits, rotations, rotLimits, refs, identifier); - var connectedPoints = new FemDesign.ModellingTools.ConnectedPoints(fdPlane, masterPoint.FromRhino(), otherPoint.FromRhino(), motions, rotations, refs, identifier); - // output + // get output DA.SetData(0, connectedPoints); } @@ -96,7 +111,7 @@ protected override System.Drawing.Bitmap Icon } public override Guid ComponentGuid { - get { return new Guid("FCD121E5-3BCD-42A6-B8C8-CCEDA1DD5D80"); } + get { return new Guid("{13F2ED2A-364C-4B5B-9D62-D725ED7CE7A1}"); } } public override GH_Exposure Exposure => GH_Exposure.primary; diff --git a/FemDesign.Grasshopper/ModellingTools/SurfaceConnection.cs b/FemDesign.Grasshopper/ModellingTools/SurfaceConnection.cs new file mode 100644 index 000000000..43d0bea4f --- /dev/null +++ b/FemDesign.Grasshopper/ModellingTools/SurfaceConnection.cs @@ -0,0 +1,121 @@ +// https://strusoft.com/ +using System; +using System.Collections.Generic; +using System.Linq; +using Grasshopper.Kernel; +using Rhino.Geometry; + +namespace FemDesign.Grasshopper +{ + public class SurfaceConnection : FEM_Design_API_Component + { + public SurfaceConnection() : base("SurfaceConnection", "SrfConnect", "Construct a Surface Connection.", CategoryName.Name(), "ModellingTools") + { + + } + protected override void RegisterInputParams(GH_InputParamManager pManager) + { + pManager.AddGenericParameter("ElementsToConnect", "Elements", "Surface structural elements to be connected (e.g. slabs, surface supports, fictious shells, etc).", GH_ParamAccess.list); + pManager.AddSurfaceParameter("Surface", "Srf", "Surface must be flat.", GH_ParamAccess.item); + pManager.AddGenericParameter("Motion", "Mot", "Default motion release is rigid (1.000e+5 kN/m2/m).", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddGenericParameter("MotionsPlasticLimits", "PlaLimM", "Plastic limits forces for motion springs. No plastic limits defined by default.", GH_ParamAccess.item); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddVectorParameter("LocalX", "X", "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", "Z", "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("Distance", "d", "Distance in meter.", GH_ParamAccess.item, 0); + pManager[pManager.ParamCount - 1].Optional = true; + pManager.AddTextParameter("Identifier", "ID", "Identifier.", GH_ParamAccess.item, "CS"); + pManager[pManager.ParamCount - 1].Optional = true; + } + protected override void RegisterOutputParams(GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("SurfaceConnection", "SrfConnect", "SurfaceConnection.", GH_ParamAccess.item); + } + protected override void SolveInstance(IGH_DataAccess DA) + { + // get input + var elements = new List(); + DA.GetDataList(0, elements); + + Brep surface = null; + if (!DA.GetData(1, ref surface)) { return; } + if (surface == null) { return; } + + Releases.Motions motions = null; + if (!DA.GetData(2, ref motions)) + { + motions = Releases.Motions.RigidSurface(); + } + + Releases.MotionsPlasticLimits limits = null; + DA.GetData(3, ref limits); + + Vector3d localX = Vector3d.Zero; + DA.GetData(4, ref localX); + + Vector3d localZ = Vector3d.Zero; + DA.GetData(5, ref localZ); + + double distance = 0; + DA.GetData(6, ref distance); + if (distance < 0) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Distance must be positive."); + } + + string identifier = "CS"; + DA.GetData(7, ref identifier); + if(identifier == null) { return; } + + + var fdSuface = surface.FromRhino(); + var rigidity = new Releases.RigidityDataType1(motions, limits); + + GuidListType[] refs = new GuidListType[elements.Count]; + for (int idx = 0; idx < refs.Length; idx++) + { + if (elements[idx] is Shells.Slab slab) + { + refs[idx] = new GuidListType(slab.SlabPart); + } + else + { + refs[idx] = new GuidListType(elements[idx]); + } + } + + var obj = new FemDesign.ModellingTools.SurfaceConnection(fdSuface, rigidity, refs, identifier, distance); + + if(!localX.Equals(Vector3d.Zero)) + { + obj.LocalX = localX.FromRhino(); + } + if (!localZ.Equals(Vector3d.Zero)) + { + obj.LocalZ = localZ.FromRhino(); + } + + + // output + DA.SetData(0, obj); + + } + protected override System.Drawing.Bitmap Icon + { + get + { + return FemDesign.Properties.Resources.SurfaceConnection; + } + } + public override Guid ComponentGuid + { + get { return new Guid("{5C965AFE-FA8F-4161-B85C-ED51B3154D37}"); } + } + + public override GH_Exposure Exposure => GH_Exposure.primary; + + } +} \ No newline at end of file diff --git a/FemDesign.Grasshopper/Obsolete/ModelAddElementsOBSOLETE.cs b/FemDesign.Grasshopper/Obsolete/ModelAddElementsOBSOLETE.cs index 748d4d4ae..059beeb57 100644 --- a/FemDesign.Grasshopper/Obsolete/ModelAddElementsOBSOLETE.cs +++ b/FemDesign.Grasshopper/Obsolete/ModelAddElementsOBSOLETE.cs @@ -88,7 +88,7 @@ protected override void SolveInstance(IGH_DataAccess DA) } } - List covers = new List(); + List covers = new List(); if (!DA.GetDataList(6, covers)) { // pass diff --git a/FemDesign.Grasshopper/Obsolete/ModelCreate2OBSOLETE.cs b/FemDesign.Grasshopper/Obsolete/ModelCreate2OBSOLETE.cs index c2af99905..b1e429def 100644 --- a/FemDesign.Grasshopper/Obsolete/ModelCreate2OBSOLETE.cs +++ b/FemDesign.Grasshopper/Obsolete/ModelCreate2OBSOLETE.cs @@ -90,7 +90,7 @@ protected override void SolveInstance(IGH_DataAccess DA) } } - List covers = new List(); + List covers = new List(); if (!DA.GetDataList(6, covers)) { // pass diff --git a/FemDesign.Grasshopper/Obsolete/ModelCreateOBSOLETE.cs b/FemDesign.Grasshopper/Obsolete/ModelCreateOBSOLETE.cs index 4753eec44..3cbe80e62 100644 --- a/FemDesign.Grasshopper/Obsolete/ModelCreateOBSOLETE.cs +++ b/FemDesign.Grasshopper/Obsolete/ModelCreateOBSOLETE.cs @@ -87,7 +87,7 @@ protected override void SolveInstance(IGH_DataAccess DA) } } - List covers = new List(); + List covers = new List(); if (!DA.GetDataList(6, covers)) { // pass diff --git a/FemDesign.Grasshopper/Properties/Resources.Designer.cs b/FemDesign.Grasshopper/Properties/Resources.Designer.cs index 981f0ea80..d7d08c14f 100644 --- a/FemDesign.Grasshopper/Properties/Resources.Designer.cs +++ b/FemDesign.Grasshopper/Properties/Resources.Designer.cs @@ -810,6 +810,16 @@ internal static System.Drawing.Bitmap LineConnection { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap LineConnectionDeconstruct { + get { + object obj = ResourceManager.GetObject("LineConnectionDeconstruct", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1250,6 +1260,16 @@ internal static System.Drawing.Bitmap ModelFromStruxml { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ModellingToolsDeconstruct { + get { + object obj = ResourceManager.GetObject("ModellingToolsDeconstruct", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1520,6 +1540,16 @@ internal static System.Drawing.Bitmap PointConnection { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap PointConnectionDeconstruct { + get { + object obj = ResourceManager.GetObject("PointConnectionDeconstruct", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -2210,6 +2240,26 @@ internal static System.Drawing.Bitmap SupportsDeconstruct { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SurfaceConnection { + get { + object obj = ResourceManager.GetObject("SurfaceConnection", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SurfaceConnectionDeconstruct { + get { + object obj = ResourceManager.GetObject("SurfaceConnectionDeconstruct", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/FemDesign.Grasshopper/Properties/Resources.resx b/FemDesign.Grasshopper/Properties/Resources.resx index 9efbe32f6..1b04624b4 100644 --- a/FemDesign.Grasshopper/Properties/Resources.resx +++ b/FemDesign.Grasshopper/Properties/Resources.resx @@ -7278,4 +7278,19 @@ ..\Resources\icons\CombSettings.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons\LineConnectionDeconstruct.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons\PointConnectionDeconstruct.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons\SurfaceConnection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons\SurfaceConnectionDeconstruct.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons\ModellingToolsDeconstruct.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/Resources/icons/LineConnectionDeconstruct.png b/FemDesign.Grasshopper/Resources/icons/LineConnectionDeconstruct.png new file mode 100644 index 000000000..0221aab84 Binary files /dev/null and b/FemDesign.Grasshopper/Resources/icons/LineConnectionDeconstruct.png differ diff --git a/FemDesign.Grasshopper/Resources/icons/ModellingToolsDeconstruct.png b/FemDesign.Grasshopper/Resources/icons/ModellingToolsDeconstruct.png new file mode 100644 index 000000000..e6e26984e Binary files /dev/null and b/FemDesign.Grasshopper/Resources/icons/ModellingToolsDeconstruct.png differ diff --git a/FemDesign.Grasshopper/Resources/icons/PointConnectionDeconstruct.png b/FemDesign.Grasshopper/Resources/icons/PointConnectionDeconstruct.png new file mode 100644 index 000000000..fb7fe6559 Binary files /dev/null and b/FemDesign.Grasshopper/Resources/icons/PointConnectionDeconstruct.png differ diff --git a/FemDesign.Grasshopper/Resources/icons/SurfaceConnection.png b/FemDesign.Grasshopper/Resources/icons/SurfaceConnection.png new file mode 100644 index 000000000..ca79f5e54 Binary files /dev/null and b/FemDesign.Grasshopper/Resources/icons/SurfaceConnection.png differ diff --git a/FemDesign.Grasshopper/Resources/icons/SurfaceConnectionDeconstruct.png b/FemDesign.Grasshopper/Resources/icons/SurfaceConnectionDeconstruct.png new file mode 100644 index 000000000..072ae2bc2 Binary files /dev/null and b/FemDesign.Grasshopper/Resources/icons/SurfaceConnectionDeconstruct.png differ