Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OGH-26-GSAGH-476-Issue-with-search-in-CreateProfile-component #109

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ExampleFiles/CreateOasysProfile.gh
Binary file not shown.
2 changes: 1 addition & 1 deletion GH_UnitNumber/GH_UnitNumber.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RepositoryUrl>https://github.com/arup-group/OasysGH</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>UnitNumberLogo64.png</PackageIcon>
<Version>1.0.3</Version>
<Version>1.0.4</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<BaseOutputPath>bin\</BaseOutputPath>
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/CreateOasysProfileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static GH_Document OpenDocument() {
[InlineData("Trapezoid", "STD TR(cm) 500 100 10")]
[InlineData("T Section", "STD T(cm) 500 100 10 20")]
[InlineData("IPE100", "CAT BSI-IPE IPE100")]
[InlineData("HE200AA", "CAT BSI-HE HE200AA")]
[InlineData("HE200AA", "CAT HE HE200.AA")]
public void AssertOutput(string groupIdentifier, string expectedOutput) {
IGH_Param param = DocumentHelper.FindParameter(Document, groupIdentifier);
var output = (GH_String)param.VolatileData.get_Branch(0)[0];
Expand Down
27 changes: 23 additions & 4 deletions OasysGH/Components/CreateOasysProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,13 @@ public override bool Read(GH_IReader reader) {
_lengthUnit = (LengthUnit)UnitsHelper.Parse(typeof(LengthUnit), reader.GetString("lengthUnit"));
_catalogueIndex = reader.GetInt32("catalogueIndex");
_typeIndex = reader.GetInt32("typeIndex");
reader.TryGetBoolean("inclSS", ref _inclSS);

bool flag = base.Read(reader);
Params.Output[0].Access = GH_ParamAccess.tree;

UpdateSecionList();

return flag;
}

Expand Down Expand Up @@ -821,6 +825,7 @@ public override bool Write(GH_IWriter writer) {
writer.SetString("lengthUnit", _lengthUnit.ToString());
writer.SetInt32("catalogueIndex", _catalogueIndex);
writer.SetInt32("typeIndex", _typeIndex);
writer.SetBoolean("inclSS", _inclSS);
return base.Write(writer);
}

Expand Down Expand Up @@ -974,13 +979,13 @@ protected List<IProfile> SolveInstanceForCatalogueProfile(IGH_DataAccess da) {
if (da.GetData(1, ref incl)) {
if (_inclSS != incl) {
_inclSS = incl;
UpdateTypeData();
_sectionList = SqlReader.Instance.GetSectionsDataFromSQLite(_typeNumbers, DataSource, _inclSS);
_typeIndex = -1;
UpdateSecionList();

_selectedItems[2] = _typeNames[0];
_selectedItems[2] = "All";
_dropDownItems[2] = _typeNames;

_selectedItems[3] = _sectionList[0];
_selectedItems[3] = "All";
_dropDownItems[3] = _sectionList;

base.UpdateUI();
Expand Down Expand Up @@ -1421,6 +1426,20 @@ private void UpdateProfileDescriptions() {
_profileDescriptions = new List<string>() { "CAT " + _selectedItems[3] };
}

private void UpdateSecionList() {
UpdateTypeData();
var types = new List<int> { -1 };
if (_typeIndex != -1) {
types = new List<int> { _typeIndex };
} else if (_catalogueIndex != -1) {
types = _typeNumbers.ToList();
types.RemoveAt(0);
}

_sectionList = SqlReader.Instance.GetSectionsDataFromSQLite(types, DataSource, _inclSS);
}


private void UpdateTypeData() {
_typeData = GetTypesDataFromSQLite(_catalogueIndex, DataSource, _inclSS);
_typeNames = _typeData.Item1;
Expand Down
4 changes: 2 additions & 2 deletions OasysGH/OasysGH.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<PackageProjectUrl>https://github.com/arup-group/OasysGH</PackageProjectUrl>
<RepositoryUrl>https://github.com/arup-group/OasysGH</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.0.3</Version>
<Version>1.0.4</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<LangVersion>8.0</LangVersion>
<Description>OasysGH is a library with shared content for Oasys Grasshopper plugins.</Description>
<PackageReleaseNotes>This is a release of OasysGH 1.0.3.</PackageReleaseNotes>
<PackageReleaseNotes>This is a release of OasysGH 1.0.4.</PackageReleaseNotes>
<PackageTags>oasys;grasshopper</PackageTags>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion OasysGH/OasysPluginInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public static class OasysGHVersion {
public const bool IsBeta = false;
// this is the one place to set the version in VS:
// also update the version manually in OasysGH.csproj
public const string Version = "1.0.3";
public const string Version = "1.0.4";
}

public class OasysPluginInfo {
Expand Down
Loading