Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristjan Nielsen committed Oct 19, 2023
2 parents 70cbf63 + a48e071 commit e689031
Show file tree
Hide file tree
Showing 179 changed files with 1,225 additions and 17,316 deletions.
2 changes: 1 addition & 1 deletion DocsGeneration/Data/Parameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private string GetClassSummary(Type paramType) {
Type valueType = gooProperty.PropertyType;
string path = "T:" + valueType.FullName;
XmlNode xmlDocuOfMethod = GsaGhDll.GsaGhXml.SelectSingleNode(
"//member[starts-with(@name, '" + path + "')]");
"//member[@name='" + path + "']");
string text = xmlDocuOfMethod.InnerXml
.Replace("<summary>", string.Empty).Replace("</summary>", string.Empty);
string cleanStr = Regex.Replace(text, @"\s+", " ");
Expand Down
21 changes: 10 additions & 11 deletions DocsGeneration/MarkDowns/Components.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@

namespace DocsGeneration.MarkDowns {
public class Components {
public static readonly string ComponentsOverview =
"# Components\n" +
"\n" +
":::caution" +
"\nGSA-Grasshopper plugin is pre-release and under active development, including further testing to be undertaken. It is provided \\\"as-is\\\" and you bear the risk of using it. Future versions may contain breaking changes. Any files, results, or other types of output information created using the plugin should not be relied upon without thorough and independent checking.\n:::\n" +
"\n" +
"![GsaGH-Ribbon](./images/RibbonLayout.gif)\n" +
"\n";

public static void CreateOverview(
Dictionary<string, List<Component>> components, List<Parameter> parameters) {
CreateComponentOverview(components.Keys.ToList());
Expand Down Expand Up @@ -48,7 +39,9 @@ private static void CreateComponent(Component component, List<string> parmeterNa
Console.WriteLine($"Writing {filePath}");

string text = $"# {component.Name}\n\n";
text += StringHelper.AddBetaWarning();
if (GsaGH.GsaGhInfo.isBeta) {
text += StringHelper.AddBetaWarning();
}

var iconHeaders = new List<string>() {
"Icon"
Expand Down Expand Up @@ -163,7 +156,13 @@ private static void CreateComponentOverview(List<string> categories) {
string filePath = $@"Output\gsagh-components.md";
Console.WriteLine($"Writing {filePath}");

string text = ComponentsOverview;
string text = "# Components\n\n";
if (GsaGH.GsaGhInfo.isBeta) {
text += StringHelper.AddBetaWarning();
text += "\n";
}

text += "![GsaGH-Ribbon](./images/RibbonLayout.gif)\n\n";

foreach (string category in categories) {
text += $"[{category} components](gsagh-{category.ToLower()}-components-overview.md)\n\n";
Expand Down
2 changes: 1 addition & 1 deletion DocsGeneration/MarkDowns/Helpers/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static string CreateParameterLink(Parameter parameter, List<string> param

if (parameterName.Contains("Unit Number")) {
string link = $"[Unit Number](gsagh-unitnumber-parameter.md)";
return parameterName.Replace("UnitNumber", link) + list + tree;
return parameterName.Replace("Unit Number", link) + list + tree;
}

parameterName = parameterName.Replace("I Geometric", "Geometry");
Expand Down
33 changes: 18 additions & 15 deletions DocsGeneration/MarkDowns/Helpers/StringHelper.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Net.Mime.MediaTypeNames;

namespace DocsGeneration.MarkDowns.Helpers {
public enum AdmonitionType {
Note,
Tip,
Info,
Caution,
Danger
}

public class StringHelper {
public static string AddBetaWarning() {
string txt = "GSA-Grasshopper plugin is pre-release and under active development, including further testing to be undertaken. It is provided \"as-is\" and you bear the risk of using it. Future versions may contain breaking changes. Any files, results, or other types of output information created using the plugin should not be relied upon without thorough and independent checking.";
return Warning(txt);
}
public static string Tip(string headline, string text) {
// :::tip Did you know?
// The `Bool6` icon takes inspiration from the central pin / hinge / charnier connection[Ove Arup's Kingsgate footbridge](https://www.arup.com/projects/kingsgate-footbridge).
// ![Kingsgate Footbridge Durham](./ images / gsagh / Kingsgate - Footbridge - Durham.jpg)
// * (c)Giles Rocholl / Arup *
// :::
return $":::tip {headline}\n{text}\n:::\n\n";
return Admonition(txt, AdmonitionType.Caution);
}
public static string Warning(string text) {
// :::danger
// GSA - Grasshopper plugin[GsaGH] is pre - release and under active development, including further testing to be undertaken. It is provided \"as-is\" and you bear the risk of using it. Future versions may contain breaking changes. Any files, results, or other types of output information created using GsaGH should not be relied upon without thorough and independent checking.
// :::
return $":::danger\n{text}\n:::\n\n";

public static string Admonition(string txt, AdmonitionType type, string headline = "") {
return $":::{type.ToString().ToLower()} {headline}\n\n{txt}\n\n:::\n\n";
}

public static string MakeBold(string text) {
Expand All @@ -30,7 +29,6 @@ public static string MakeItalic(string text) {
return $"_{text}_";
}


public static string SummaryDescription(string str) {
string markdown = ConvertSummaryToMarkup(str);
return $"## Description\n\n{markdown}\n\n";
Expand Down Expand Up @@ -67,6 +65,11 @@ public static string ComponentDescription(string str, List<string> parameterName

private static string ConvertSummaryToMarkup(string str) {
str = str.Replace("</para>", "\n\n").Replace("<para>", string.Empty);
str = str.Replace("IGsaLoad", "GsaLoad");
str = str.Replace("IGsaGridLoad", "GsaGridLoad");
str = str.Replace("IGsaStandardMaterial", "GsaStandardMaterial");
str = str.Replace("IGsaAnnotation", "GsaAnnotation");
str = str.Replace("IGsaDiagram", "GsaDiagram");

// For example:
// <see href="https://docs.oasys-software.com/structural/gsa/references/listsandembeddedlists.html">syntax</see>
Expand Down
31 changes: 15 additions & 16 deletions DocsGeneration/MarkDowns/Parameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@

namespace DocsGeneration.MarkDowns {
public class Parameters {
public static readonly string ParametersOverview =
"# Parameters\n" +
"\n" +
":::danger" +
"\nGSA-Grasshopper plugin is pre-release and under active development, including further testing to be undertaken. It is provided \\\"as-is\\\" and you bear the risk of using it. Future versions may contain breaking changes. Any files, results, or other types of output information created using the plugin should not be relied upon without thorough and independent checking.\n:::\n" +
"\n" +
"The GSA plugin introduces a new set of custom Grasshopper parameters. Parameters are what is passed from one component's output to another component's input.\n" +
"![Parameters](https://developer.rhino3d.com/api/grasshopper/media/ParameterKinds.png)\n" +
"\n" +
"## Custom GSA Parameters" +
"\n\n";


public static void CreateOverview(Dictionary<string, List<Parameter>> parameters) {
string filePath = @"Output\gsagh-parameters.md";
Console.WriteLine($"Writing {filePath}");

string text = ParametersOverview;
string text = "# Parameters\n\n";
if (GsaGH.GsaGhInfo.isBeta) {
text += StringHelper.AddBetaWarning();
text += "\n";
}

text += "The GSA plugin introduces a new set of custom Grasshopper parameters. Parameters are what is passed from one component's output to another component's input.\n" +
"![Parameters](https://developer.rhino3d.com/api/grasshopper/media/ParameterKinds.png)\n" +
"\n" +
"## Custom GSA Parameters" +
"\n\n";

var tableHeaders = new List<string>() {
" ", // icon
Expand Down Expand Up @@ -67,7 +64,9 @@ private static void CreateParameter(Parameter parameter, List<string> parmeterNa
Console.WriteLine($"Writing {filePath}");

string text = $"# {parameter.Name}\n\n";
text += StringHelper.AddBetaWarning();
if (GsaGH.GsaGhInfo.isBeta) {
text += StringHelper.AddBetaWarning();
}

var iconHeaders = new List<string>() {
"Icon"
Expand All @@ -80,7 +79,7 @@ private static void CreateParameter(Parameter parameter, List<string> parmeterNa
text += iconTable.Finalise();

if (parameter.Name == "Bool6") {
text += StringHelper.Tip("Did you know?",
text += StringHelper.Admonition("Did you know?", AdmonitionType.Info,
"The `Bool6` icon takes inspiration from the central pin/hinge/charnier connection " +
"[Ove Arup's Kingsgate footbridge](https://www.arup.com/projects/kingsgate-footbridge" +
").\r\n![Kingsgate Footbridge Durham](./images/Kingsgate-Footbridge-Durham.jpg)\r\n" +
Expand Down
2 changes: 1 addition & 1 deletion DocsGeneration/Setup/GrasshopperFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public GrasshopperFixture() {

InitializeCore();

Utility.SetupUnitsDuringLoad(true);
Utility.SetupUnitsDuringLoad();
}

public void AddPluginToGh() {
Expand Down
Binary file modified ExampleFiles/Components/Annotate.gh
Binary file not shown.
Binary file added ExampleFiles/Components/AssembleModel.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/AssembleWithIDsTestIdSequence.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/CreateEdit3dPropElemAndMem.gh
Binary file not shown.
Binary file added ExampleFiles/Components/CreateLoads.gh
Binary file not shown.
Binary file added ExampleFiles/Components/Display1d.gh
Binary file not shown.
Binary file added ExampleFiles/Components/Display2d.gh
Binary file not shown.
Binary file added ExampleFiles/Components/Display3d.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/Elem2dResults.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/GridLoadPolyline.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/LoadsFromReferenceObjects.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/NodeLocalAxisReactionForceDiagram.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/NodeReactionForceResult.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/NodeResults.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/Prop2dAxis.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/ReactionForceDiagrams.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/SectionAlignment.gh
Binary file not shown.
Binary file modified ExampleFiles/Components/SpringReactionForces.gh
Binary file not shown.
Binary file added ExampleFiles/Components/TrGen_10Display.gh
Binary file not shown.
Binary file modified ExampleFiles/GsaGH_Example1_GerberMember.gh
Binary file not shown.
Binary file modified ExampleFiles/GsaGH_Example2_Reciprocal.gh
Binary file not shown.
Binary file modified ExampleFiles/GsaGH_Example3_Truss.gh
Binary file not shown.
Binary file modified ExampleFiles/GsaGH_Example4_ReMeshing.gh
Binary file not shown.
Binary file modified ExampleFiles/GsaGH_Example5_4PointSrfMidSupport.gh
Binary file not shown.
Binary file modified ExampleFiles/GsaGH_Example6_3dBoxes.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Elements.gh
Binary file not shown.
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Members.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Nodes.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Properties.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/1_Properties/CreateProfile.gh
Binary file not shown.
Binary file not shown.
Binary file modified ExampleFiles/Parameters/1_Properties/Materials.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/3_Loads/GridPlaneSurface.gh
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion GsaGH/Components/0_Model/CreateModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Windows.Forms;
using GH_IO.Serialization;
using Grasshopper.Kernel;
using GsaGH.Components.GraveyardComp;
using GsaGH.Helpers;
using GsaGH.Helpers.Assembly;
using GsaGH.Helpers.GH;
Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/0_Model/GetModelGeometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) {
"3D Members (Design Layer) from GSA Model imported to selected unit", GH_ParamAccess.list);
}

protected override void SolveInstance(IGH_DataAccess data) {
protected override void SolveInternal(IGH_DataAccess data) {
if (InPreSolve) {
GsaModelGoo modelGoo = null;
data.GetData(0, ref modelGoo);
Expand Down
21 changes: 17 additions & 4 deletions GsaGH/Components/0_Model/SaveGsaModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class SaveGsaModel : GH_OasysDropDownComponent {
public override OasysPluginInfo PluginInfo => GsaGH.PluginInfo.Instance;
protected override Bitmap Icon => Resources.SaveGsaModel;
private string _fileNameLastSaved;
private bool _saveInputOverride = false;

public SaveGsaModel() : base("Save GSA Model", "Save",
"Saves your GSA model from this parametric nightmare", CategoryName.Name(),
Expand Down Expand Up @@ -95,8 +96,9 @@ protected override void SolveInternal(IGH_DataAccess da) {
da.GetData(2, ref fileName);

bool save = false;
if (da.GetData(1, ref save) && save) {
if (da.GetData(1, ref save) && (save || _saveInputOverride)) {
Save(ref gsaModel, fileName);
_saveInputOverride = false;
}

da.SetData(0, new GsaModelGoo(gsaModel));
Expand All @@ -121,7 +123,12 @@ internal void Save(ref GsaModel model, string fileNameAndPath) {
}

internal void SaveButtonClick() {
UpdateUI();
if (string.IsNullOrEmpty(_fileNameLastSaved)) {
SaveAsButtonClick();
return;
}

_saveInputOverride = true;
}

internal void SaveAsButtonClick() {
Expand Down Expand Up @@ -153,9 +160,15 @@ internal void SaveAsButtonClick() {
}

internal void OpenGsaExe() {
if (!string.IsNullOrEmpty(_fileNameLastSaved)) {
Process.Start(_fileNameLastSaved);
if (string.IsNullOrEmpty(_fileNameLastSaved)) {
Params.Input[0].CollectData();
var tempModel = (GsaModelGoo)Params.Input[0].VolatileData.AllData(true).First();
string tempPath = Path.GetTempPath() + tempModel.Value.Guid.ToString() + ".gwb";
GsaModel gsaModel = tempModel.Value;
Save(ref gsaModel, tempPath);
}

Process.Start(_fileNameLastSaved);
}
}
}
3 changes: 2 additions & 1 deletion GsaGH/Components/1_Properties/Create2dProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using OasysGH;
using OasysGH.Components;
using OasysGH.Helpers;
using OasysGH.Parameters;
using OasysGH.Units;
using OasysGH.Units.Helpers;
using OasysUnits;
Expand Down Expand Up @@ -51,7 +52,7 @@ private readonly IReadOnlyDictionary<SupportType, string> _supportDropDown
private Prop2dType _mode = Prop2dType.Shell;
private int _supportTypeIndex;

public Create2dProperty() : base("Create 2D Property", "Prop2d", "Create a GSA Property 2D",
public Create2dProperty() : base("Create 2D Property", "Prop2d", "Create a GSA 2D Property",
CategoryName.Name(), SubCategoryName.Cat1()) {
Hidden = true;
}
Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/1_Properties/Create3dProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Create3dProperty : GH_OasysComponent {
public override OasysPluginInfo PluginInfo => GsaGH.PluginInfo.Instance;
protected override Bitmap Icon => Resources.Create3dProperty;

public Create3dProperty() : base("Create 3D Property", "Prop3d", "Create GSA Property 3D",
public Create3dProperty() : base("Create 3D Property", "Prop3d", "Create GSA 3D Property",
CategoryName.Name(), SubCategoryName.Cat1()) {
Hidden = true;
}
Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/1_Properties/Edit3dProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Edit3dProperty : GH_OasysComponent {
public override OasysPluginInfo PluginInfo => GsaGH.PluginInfo.Instance;
protected override Bitmap Icon => Resources.Edit3dProperty;

public Edit3dProperty() : base("Edit 3D Property", "EditPV", "Modify a GSA Property 3D",
public Edit3dProperty() : base("Edit 3D Property", "EditPV", "Modify a GSA 3D Property",
CategoryName.Name(), SubCategoryName.Cat1()) {
Hidden = true;
}
Expand Down
5 changes: 2 additions & 3 deletions GsaGH/Components/2_Geometry/Create2dElementsFromBrep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Grasshopper.Kernel;
using Grasshopper.Kernel.Types;
using GsaAPI;
using GsaGH.Components.GraveyardComp;
using GsaGH.Helpers.GH;
using GsaGH.Parameters;
using GsaGH.Properties;
Expand All @@ -27,12 +26,12 @@ namespace GsaGH.Components {
/// </summary>
public class Create2dElementsFromBrep : GH_OasysDropDownComponent {
public override Guid ComponentGuid => new Guid("18c5913e-cbce-42e8-8563-18e28b079d34");
public override GH_Exposure Exposure => GH_Exposure.quarternary;
public override GH_Exposure Exposure => GH_Exposure.quarternary | GH_Exposure.obscure;
public override OasysPluginInfo PluginInfo => GsaGH.PluginInfo.Instance;
protected override Bitmap Icon => Resources.Create2dElementsFromBrep;
private LengthUnit _lengthUnit = DefaultUnits.LengthUnitGeometry;
internal ToleranceContextMenu ToleranceMenu { get; set; } = new ToleranceContextMenu();
private List<string> _meshMode = new List<string>() {
private readonly List<string> _meshMode = new List<string>() {
"Tri-6 only",
"Planar Quads",
"Quad-8 only"
Expand Down
2 changes: 2 additions & 0 deletions GsaGH/Components/3_Loads/CreateBeamThermalLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ protected override void SolveInternal(IGH_DataAccess da) {
case GsaElement1dGoo element1dGoo:
beamThermalLoad.RefObjectGuid = element1dGoo.Value.Guid;
beamThermalLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
beamThermalLoad.ReferenceType = ReferenceType.Element;
break;

case GsaMember1dGoo member1dGoo:
beamThermalLoad.RefObjectGuid = member1dGoo.Value.Guid;
beamThermalLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
beamThermalLoad.ReferenceType = ReferenceType.Member;
break;

case GsaMaterialGoo materialGoo:
Expand Down
10 changes: 9 additions & 1 deletion GsaGH/Components/3_Loads/CreateGravityLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,25 @@ protected override void SolveInstance(IGH_DataAccess da) {
case GsaElement2dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Element;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaMember1dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Member;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
break;
}
case GsaMember2dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Member;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
break;
}
case GsaMember3dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Member;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
break;
}
case GsaMaterialGoo value: {
Expand All @@ -108,21 +112,25 @@ protected override void SolveInstance(IGH_DataAccess da) {
}
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaSectionGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaProperty2dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaProperty3dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
default: {
Expand Down Expand Up @@ -164,6 +172,6 @@ protected override void SolveInstance(IGH_DataAccess da) {
gravityLoad.ApiLoad.Factor = factor;

da.SetData(0, new GsaLoadGoo(gravityLoad));
}
}
}
}
4 changes: 2 additions & 2 deletions GsaGH/Components/3_Loads/CreateGridAreaLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ protected override void SolveInternal(IGH_DataAccess da) {
== GridSurface.Element_Type.ONE_DIMENSIONAL ? "1D" : "2D");
break;
}
case Plane pln:
plane = pln;
case GH_Plane pln:
plane = pln.Value;
gridPlaneSurface = new GsaGridPlaneSurface(plane);
planeSet = true;
UpdateMessage(gridPlaneSurface.GridSurface.ElementType
Expand Down
Loading

0 comments on commit e689031

Please sign in to comment.