Skip to content

Commit

Permalink
Merge branch 'task/GSAGH-550-default-task' of github.com:arup-group/G…
Browse files Browse the repository at this point in the history
…SA-Grasshopper into task/GSAGH-550-default-task
  • Loading branch information
SandeepArup committed Dec 23, 2024
2 parents 11d54cc + e17978b commit 6857862
Show file tree
Hide file tree
Showing 37 changed files with 1,841 additions and 957 deletions.
10 changes: 8 additions & 2 deletions GsaGH/Components/0_Model/SaveGsaModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class SaveGsaModel : GH_OasysDropDownComponent {
public override OasysPluginInfo PluginInfo => GsaGH.PluginInfo.Instance;
protected override Bitmap Icon => Resources.SaveGsaModel;
private string _fileNameLastSaved;
internal string FileNameLastSavedFullPath => $"\"{Path.GetFullPath(_fileNameLastSaved)}\"";
private bool _saveInputOverride = false;

public SaveGsaModel() : base("Save GSA Model", "Save",
Expand Down Expand Up @@ -91,7 +92,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
return;
}

var gsaModel = new GsaModel();
GsaModel gsaModel;
if (ghTyp.Value is GsaModelGoo modelGoo) {
gsaModel = modelGoo.Value;
Message = string.Empty;
Expand Down Expand Up @@ -175,8 +176,13 @@ internal void OpenGsaExe() {
GsaModel gsaModel = tempModel.Value;
Save(ref gsaModel, tempPath);
}
RunGsa();
}

Process.Start(_fileNameLastSaved);
internal Process RunGsa() {
string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
string fullPath = Path.Combine(programFiles, @"Oasys\GSA 10.2\GSA.exe");
return Process.Start(fullPath, FileNameLastSavedFullPath);
}
}
}
23 changes: 21 additions & 2 deletions GsaGH/Components/2_Geometry/Edit2dElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Drawing;
using System.Linq;

using GH_IO.Serialization;

using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using Grasshopper.Kernel.Types;
Expand All @@ -28,6 +30,15 @@ public class Edit2dElement : Section3dPreviewComponent {
protected override Bitmap Icon => Resources.Edit2dElement;
private AngleUnit _angleUnit = AngleUnit.Radian;


private readonly Param_Geometry _geometryAttributes = new Param_Geometry {
Name = "Geometry",
NickName = "G",
Description = "Get analysis mesh for FE element and polyline for load panel",
Access = GH_ParamAccess.item,
Optional = true,
};

public Edit2dElement() : base("Edit 2D Element", "Elem2dEdit", "Modify GSA 2D Element",
CategoryName.Name(), SubCategoryName.Cat2()) { }

Expand All @@ -38,6 +49,14 @@ protected override void BeforeSolveInstance() {
}
}

public override bool Read(GH_IReader reader) {
bool flag = base.Read(reader);
if (Params.Output[2].Name == "Analysis Mesh") {
Params.ReplaceOutputParameter(_geometryAttributes, 2);
}
return flag;
}

protected override void RegisterInputParams(GH_InputParamManager pManager) {
pManager.AddParameter(new GsaElement2dParameter(), GsaElement2dGoo.Name,
GsaElement2dGoo.NickName,
Expand Down Expand Up @@ -73,7 +92,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) {
GsaElement2dGoo.NickName, GsaElement2dGoo.Description + " with applied changes.",
GH_ParamAccess.item);
pManager.AddIntegerParameter("Number", "ID", "Get Element Number", GH_ParamAccess.list);
pManager.AddMeshParameter("Analysis Mesh", "M", "Get Analysis Mesh", GH_ParamAccess.item);
pManager.AddGeometryParameter(_geometryAttributes.Name, _geometryAttributes.NickName, _geometryAttributes.Description, _geometryAttributes.Access);
pManager.HideParameter(2);
pManager.AddParameter(new GsaProperty2dParameter(), "2D Property", "PA",
"Get 2D Property. Input either a GSA 2D Property or an Integer to use a Property already defined in model",
Expand Down Expand Up @@ -182,7 +201,7 @@ protected override void SolveInstance(IGH_DataAccess da) {
// #### outputs ####
da.SetData(0, new GsaElement2dGoo(elem));
da.SetDataList(1, elem.Ids);
da.SetData(2, elem.Mesh);
da.SetData(2, elem.Geometry());
da.SetDataList(3, elem.Prop2ds == null ? null
: new List<GsaProperty2dGoo>(elem.Prop2ds.Select(x => new GsaProperty2dGoo(x))));
da.SetDataList(4, elem.ApiElements.Select(x => x.Group));
Expand Down
Loading

0 comments on commit 6857862

Please sign in to comment.