-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
@BHoMBot check compliance |
There was a problem hiding this 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)) |
There was a problem hiding this comment.
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
if (int.TryParse(elements[i].ToString(), out int idInt)) | |
int idInt; | |
if (int.TryParse(elements[i].ToString(), out idInt)) |
There was a problem hiding this 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; | ||
} | ||
|
There was a problem hiding this comment.
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:
- Would make the index be the number of the object, something like:
index = stage.Number.ToString();
- 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;
There was a problem hiding this 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! 👍
@BHoMBot check installer |
@IsakNaslundBh to confirm, |
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.