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-880-add-sections-and-materials-as-proxies #499

Merged

Conversation

bjoernsteinhagen
Copy link
Contributor

@bjoernsteinhagen bjoernsteinhagen commented Jan 15, 2025

Description & motivation

  • Related to CNX-880
  • Functionality to extract material and section data
  • Single material can apply to numerous sections and a single section can apply to numerous objects
  • A section can be either for a PropFrame (FRAME) or PropArea (AREA)
  • To make it a little tricky, PropArea is for one of the following types: Deck, Wall or Slab. This affects the applicable api query

Changes:

Figma Link

image

  • _materialUnpacker - CsiShared implementation (eligible for both Sap2000 and Etabs)
  • _sectionUnpacker - CsiShared and host-app specific implementations (e.g. GetAllSectionProperties_2 not valid for Sap2000
  • SectionMaterialRelationshipManager and ObjectSectionRelationshipManager - Method of building relationships. Based on MaterialName for section-material relationship and sectionDesignation for object-section relationship. Both of these attributes (strings) have to be unique in Etabs world
  • Enums for project-wide consistency

To-do before merge:

  • SectionProxy and MaterialProxy (?) in the SDK. Currently using GroupProxy

Screenshots:

See Speckle Project.

  • Proxies created for materials, frame sections and shell sections:
image
  • The nested properties dictionary orientates itself on the UI:
image
  • The material-section relations are based on the unique material names (no ApplicationId).
image
  • The section-object relations are based on the ApplicationId of the object(s).
image

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.

Copy link

linear bot commented Jan 15, 2025

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 14.74%. Comparing base (e52df07) to head (c3a362e).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #499   +/-   ##
=======================================
  Coverage   14.74%   14.74%           
=======================================
  Files         239      239           
  Lines        4674     4674           
  Branches      576      576           
=======================================
  Hits          689      689           
  Misses       3954     3954           
  Partials       31       31           

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

@bjoernsteinhagen
Copy link
Contributor Author

bjoernsteinhagen commented Jan 17, 2025

@clairekuang I had a brainwave this morning and currently exploring cDatabaseTables as a way to simplify the extraction of properties and get a more formalized return (as opposed to: determine type, use specific api query for that type etc.). If it works, it should reduce the amount of code and code complexity drastically (especially for AreaSectionProperty). Concerned the cDatabaseTables queries are a little slower though but will keep an eye on this.

cc: @dogukankaratas

clairekuang and others added 2 commits January 17, 2025 17:54
- Interim solution for viewer filtering is appending the materialId to assignments for each object
- For FRAME this was easy
- For SHELL not so easy. No GetMaterial method avaiable given a AreaObj sectionName. Implemented lightweight materialCache based on cDatabaseTable. Marked as temporary based on previous discussions
@bjoernsteinhagen
Copy link
Contributor Author

bjoernsteinhagen commented Jan 20, 2025

Summary of Discussion

Etabs Model here.

Changes

  • Change sectionProperty to sectionId
  • Append materialId to Assignments for each object to get some displayable / filterable action in the viewer
image

Future Issues

  • Providing units to numeric properties. Potential barrier being the non-distance parameters like stress cannot be quantified just with a "mm" or "m"
  • cDatabaseTables shelved / out of scope of this PR. To be investigated in separate issue.

@clairekuang I had a brainwave this morning and currently exploring cDatabaseTables as a way to simplify the extraction of properties and get a more formalized return (as opposed to: determine type, use specific api query for that type etc.). If it works, it should reduce the amount of code and code complexity drastically (especially for AreaSectionProperty). Concerned the cDatabaseTables queries are a little slower though but will keep an eye on this.

cc: @dogukankaratas

…aterials-as-proxies' into bjorn/cnx-880-add-sections-and-materials-as-proxies
- Fair point for repeated strings in the CsiMaterialPropertyExtractor.cs
- Even more reason to include this across all repeated strings. Categories of properties screaming out for this. Added additionally
- Dictionary lookups for material and section proxies
- Only create proxies for assigned sections and materials (not pretty)
@bjoernsteinhagen
Copy link
Contributor Author

Commit here.

  • Explicit dictionary entries and use of consts for repeating entries
  • Direct dictionary lookups
  • Only creating proxies for sections and materials that have been assigned in the model (see screenshot below, objects will never be 0)
    image

@bjoernsteinhagen bjoernsteinhagen force-pushed the bjorn/cnx-880-add-sections-and-materials-as-proxies branch from 6d76123 to 116d077 Compare January 22, 2025 07:40
bjoernsteinhagen and others added 4 commits January 22, 2025 11:22
…ion relationships (#514)

* This is a workaround for Revit's order of operations when initializing (#511)

* This is a workaround for Revit's order of operations when initializing

* Fix event listening

* adds a singleton cache for material and section relationships to csishared

* updating extraction results and simplifying classes

* Only allow methods on classes as opposed to anonymous lambdas for Event Subscription (#512)

* This is a workaround for Revit's order of operations when initializing

* Fix event listening

* Only allow methods on classes as opposed to anonymous lambdas

* formatting

* fix tests

* weakreference found should remove subscription

* doument model store fix (#516)

* testing commit

---------

Co-authored-by: Adam Hathcock <[email protected]>
Co-authored-by: Björn <[email protected]>
- merged dev into branch
- added "type" parameter to group proxies for sections in order to distinguish between frame sections and shell sections
@clairekuang clairekuang self-requested a review January 22, 2025 21:14
@bjoernsteinhagen bjoernsteinhagen merged commit 7eb1de4 into dev Jan 22, 2025
5 checks passed
@bjoernsteinhagen bjoernsteinhagen deleted the bjorn/cnx-880-add-sections-and-materials-as-proxies branch January 22, 2025 21:43
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.

2 participants