-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(Navisworks): CNX-1064 - Add hierarchy path property to converted Navisworks objects #500
Open
jsdbroughton
wants to merge
6
commits into
dev
Choose a base branch
from
jonathon/cnx-1064-implement-full-path-breadcrumb-property-for-flat-mode
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+96
−9
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds a new file, `DisplayPathHelper.cs`, which contains a helper class for generating display paths by traversing Navisworks model item ancestors. The `GenerateDisplayPath` method takes a `ModelItem` as input and returns a string representing the full path of display names from ancestors, stopping at the first object ancestor. If no first object ancestor is found, it returns just the model item's display name. The helper class uses a constant `PATH_DELIMITER` to separate the display names in the generated path. It throws an exception if the input `modelItem` is null. The algorithm works by starting from the first object ancestor and traversing backwards to the root, collecting non-empty display names along the way. Finally, it reverses the collected names and joins them with the delimiter to form the final display path string. These changes improve code reusability and readability by encapsulating logic related to generating display paths in Navisworks models.
- Modified the CreateNavisworksObject method to handle cases where the convertedBase or groupKey is null and return null in those cases - Added a new private method GetDisplayPath to retrieve the modelItem and displayPath based on the applicationId - Updated the CreateNavisworksObject methods to include the displayNamePath property in the returned NavisworksObject
…me method This commit adds a new private method, FindMeaningfulAncestorName, to the NavisworksRootObjectBuilder class. This method is used to find the name of the most meaningful ancestor of a given NAV.ModelItem object. It iterates through the ancestors until it finds an ancestor with a non-empty DisplayName and no geometry. The found name is then used as the "name" property in the created NavisworksObject instances. Additionally, the "displayNamePath" property has been renamed to "path" for consistency.
- Update the helper class to generate display paths by traversing meaningful Navisworks model item ancestors. - Skip nodes without meaningful names or geometry nodes when generating the display path. - Reverse the collected names to build the path from root to leaf.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #500 +/- ##
=====================================
Coverage 9.15% 9.15%
=====================================
Files 228 228
Lines 4306 4306
Branches 542 542
=====================================
Hits 394 394
Misses 3896 3896
Partials 16 16 ☔ View full report in Codecov by Sentry. |
- Renamed the file from "DisplayPathHelper.cs" to "HierarchyHelper.cs" - Updated all references to the renamed file Refactor helper class for generating display paths - Refactored the helper class to extract hierarchical context from Navisworks model items in a single traversal - Changed the method name from "GenerateDisplayPath" to "ExtractContext" - Modified the method signature to return a tuple of strings (Name, Path) - Updated the implementation logic accordingly Improve traversal and extraction logic - Improved the traversal logic by collecting both name and path information while traversing up the tree once - Extracted meaningful name and path information from model items in a more efficient way - Handled cases where model item has no meaningful name or is a geometry node
- Extracted the GetContext method to retrieve the name and path of a model item - Replaced calls to GetDisplayPath with calls to GetContext for consistency - Updated CreateNavisworksObject and ConvertBase methods to use the extracted context information instead of finding meaningful ancestor names - Updated the "path" property in the returned NavisworksObject instances with the extracted path
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds path information to converted Navisworks objects to provide better context about their location in the model hierarchy. Instead of returning a hierarchical data structure, each object in the list is flat but has hierarchical information in the
path
.Closes CNX-1064 & CNX-1067
Key changes:
path
property to all converted objects, showing their hierarchical location in the modelDisplayPathHelper
to generate standardized paths by traversing meaningful ancestorsNavisworksRootObjectBuilder
to handle path generation for both individual and grouped geometry objectsExample:
This change improves object identification and filtering capabilities by providing a clear hierarchical context for each object in the converted model.
Manual Tests:
Source object in the selection tree
As name and path as published