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

Create AnalysisStage Class and Convert Method #229

Merged
merged 3 commits into from
Feb 12, 2021

Conversation

annastigenberg
Copy link
Contributor

NOTE: Depends on

Issues addressed by this PR

Closes #222

Test files

Test file #222

Changelog

Additional comments

Creates an AnalysisStage class in the GSA_oM and adds a corresponding convert method to the GSA Adapter. Supports the following type inputs: double, int, string, ISectionProperty, LinkConstraint, ISurfaceProperty and elements supported in the GSA Adapter. Note that all inputs must either be or have a GSA Id.

@annastigenberg annastigenberg added the type:feature New capability or enhancement label Feb 9, 2021
@annastigenberg annastigenberg added this to the BHoM 4.1 β RC milestone Feb 9, 2021
@annastigenberg annastigenberg self-assigned this Feb 9, 2021
@IsakNaslundBh
Copy link
Contributor

@BHoMBot check compliance

Copy link
Contributor

@IsakNaslundBh IsakNaslundBh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial tweak of c' syntax, see below. What you have written is only valid for later versions of c#, and does not compile on all systems. (I know VisualStudio is recommending you to do that, which does not really help!)

string id = "";

// String type
if (int.TryParse(elements[i].ToString(), out int idInt))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax (putting it as 'out int idInt' does not compile with all the versions of c# we support. You will need to define the int on a row above

Suggested change
if (int.TryParse(elements[i].ToString(), out int idInt))
int idInt;
if (int.TryParse(elements[i].ToString(), out idInt))

Copy link
Contributor

@IsakNaslundBh IsakNaslundBh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally works really well, nice functionality with being able to control with properties as well as elements and or ids!

Just a comment on the index control, as we have added a Number property to the stage, we need to be able to explicitly set it. See some suggestions below:


objectIds += " " + id;
}

Copy link
Contributor

@IsakNaslundBh IsakNaslundBh Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small tweaks here so the number property makes its way into GSA:

  1. Would make the index be the number of the object, something like:
    index = stage.Number.ToString();
  2. After this is done, need to update the GSAId fragment on the stage, to make sure it matches the number. Something like this should help with that:
    stage.SetAdapterId(typeof(BH.oM.Adapters.GSA.GSAId), stage.Number);
    For this 2nd step to work, you will need to add a using: using BH.Engine.Adapter;

Copy link
Contributor

@IsakNaslundBh IsakNaslundBh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good now! 👍

@IsakNaslundBh
Copy link
Contributor

@BHoMBot check installer

2 similar comments
@IsakNaslundBh
Copy link
Contributor

@BHoMBot check installer

@IsakNaslundBh
Copy link
Contributor

@BHoMBot check installer

@bhombot-ci
Copy link

bhombot-ci bot commented Feb 12, 2021

@IsakNaslundBh to confirm, check-installer task is now queued.

@IsakNaslundBh IsakNaslundBh merged commit 1363595 into master Feb 12, 2021
@IsakNaslundBh IsakNaslundBh deleted the GSA_Toolkit-#222-Push-Analysis-Cases branch February 12, 2021 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New capability or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GSA_Toolkit: Push Analysis Stages
2 participants