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

bjorn/cnx 829 add root object builder and create collection structure #435

Conversation

bjoernsteinhagen
Copy link
Contributor

Description & motivation

  • Implementation of collection structure and property extraction for CSi connectors, focusing on ETABS-specific organization while maintaining SAP2000 compatibility
  • Related to CNX-829

Changes:

  • Added root object builder and collection management system
  • Collection structure see Notion page
  • Created hierarchical architecture for CSi shared vs product-specific functionality. Included creating ETABSShared projects:
    • Base geometry conversion in CSiShared (Line, Point, Mesh)
    • Base property extraction framework (common to SAP 2000 and ETABS)
    • ETABS-specific property extraction (story, design orientation)
    • ETABS-specific collection organization by story and element type
  • Implemented clean separation between geometry and property converters

Screenshots:

Testing stream here.

image

Validation of changes:

  • Collection structure verified with ETABS test model
  • Property extraction tested with various joint, frame and shell elements
  • Geometry conversion validated against existing implementations

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

- Implemented ETABSShared projects for Connectors and Converters to account for ETABS specific things that SAP 2000 doesn't account for  such as levels or frames being further classified as Column, Beam or Brace or shells as wall or floor
- POC for ETABS collection structure
- Logic for getting further classificiations of Frames as either Column, Beam or Brace
- Same for Shells: either Wall or Floor etc.
- Placeholders for object properties
- Putting thoughts to "paper"
- A lot of the TODOs will be part of next milestone
Copy link

linear bot commented Dec 4, 2024

got deactivated and wasn't formatting on save anymore :(
Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 9.45%. Comparing base (f0e54ca) to head (3cdd1f1).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@          Coverage Diff          @@
##             dev    #435   +/-   ##
=====================================
  Coverage   9.45%   9.45%           
=====================================
  Files        223     223           
  Lines       4199    4199           
  Branches     483     483           
=====================================
  Hits         397     397           
  Misses      3786    3786           
  Partials      16      16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@clairekuang clairekuang self-requested a review December 4, 2024 19:17
Copy link
Member

@oguzhankoral oguzhankoral left a comment

Choose a reason for hiding this comment

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

It is a neat PR! Thanks for many notes and TODOs. you know already next steps!
My comments are mostly questions, willing to understand some needs better.

{
protected override HostAppVersion GetVersion() => HostAppVersion.v2021;
protected override HostAppVersion GetVersion() => HostAppVersion.v2021; // TODO: We need a v21
Copy link
Member

Choose a reason for hiding this comment

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

should not be forgotten adding v21 and v22 before release

Copy link
Contributor Author

Choose a reason for hiding this comment

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


// TODO: This is gross. Too many strings. Improve as part of next milestone. Out of scope of "First Send".
private string GetObjectType(Base convertedObject, Dictionary<string, object>? properties)
{
Copy link
Member

Choose a reason for hiding this comment

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

a bit confused on why we mutate properties on collection manager instead of converter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Probably better to add a collection parameter during the conversions and just simply use that on the collection manager to group (and not mix design concerns)

// TODO: This is gross. Too many strings. Improve as part of next milestone. Out of scope of "First Send".
public override Collection AddObjectCollectionToRoot(Base convertedObject, Collection rootObject)
{
var properties = convertedObject["properties"] as Dictionary<string, object>;
Copy link
Member

Choose a reason for hiding this comment

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

hmm, why we need properties in collection manager? this looks like anti-pattern with other connectors. happy to chat and understand if i am missing something on ETABS side

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely room for improvement here. Happy to sync

{
// frame points
// TODO: Better exception handling
Copy link
Member

Choose a reason for hiding this comment

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

ideally you should not necessarily handle exceptions here in typed converters. We handle conversion exceptions on RootObjectBuilders to report them UI. see here . But not sure you have special cases around line, let me know if so, i would like to know

Copy link
Contributor Author

@bjoernsteinhagen bjoernsteinhagen Dec 5, 2024

Choose a reason for hiding this comment

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

For Etabs' API, the return for queries is an int, saying if it was successfull or not. All of these should be returning 0 (CSi's way of saying succeeded). Currently, this is handled in the if blocks. It felt weird just discarding all of these returns and assuming a success?

image

6 => new CSiSolidWrapper { Name = name },
7 => new CSiLinkWrapper { Name = name },
6 => new CSiSolidWrapper { Name = name }, // TODO: CSiSolidWrapper
7 => new CSiLinkWrapper { Name = name }, // TODO: CSiLinkWrapper
Copy link
Member

Choose a reason for hiding this comment

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

I am curious on this wrappers. Do they needed to detect different objects in converters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, a bit of a workaround, since the API doesn't give us the instances, we can only query the selection.

image

So here we don't get objects, but an int telling us what objectType it is and an objectName which is unique for that objectType only. So, in order to be able to ResolveConverter we need to wrap this info into an "object" that keeps Etabs / Csi name and type dependencies.

else if (target is CSiShellWrapper)
{
_ = _settingsStore.Current.SapModel.AreaObj.GetGUID(target.Name, ref applicationId);
}
Copy link
Member

Choose a reason for hiding this comment

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

i guess we have assumption here if the target is unknown, we let applicationId as empty string. Just a side note for later, applicationIds are important once you start to get automation results in ETABS UI to be able highlight them etc. But this is maybe for later. For now it is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely! We have it earmarked for next milestone, here CNX-881. I am currently not happy with the state of applicationId. It is currently this way because Etabs doesn't use those when querying the model, but the name, so I haven't paid much attention to it.

return properties;
}

private void AddCommonClassProperties(CSiFrameWrapper frame, Dictionary<string, object> properties)
Copy link
Member

Choose a reason for hiding this comment

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

i will let @clairekuang to judge mutating properties on abstract class, bc we were doing them with some extractors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For sure just a placeholder for now. We discussed for CNX-882 how to do it better, so changes are coming on these definitions.

@oguzhankoral oguzhankoral merged commit 0341ebc into dev Dec 5, 2024
5 checks passed
@oguzhankoral oguzhankoral deleted the bjorn/cnx-829-add-root-object-builder-and-create-collection-structure branch December 5, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants