ModelItem: Check if it is a partition/Find parent Partition

ModelItem: Check if it is a partition/Find parent Partition

alexisDVJML
Collaborator Collaborator
235 Views
0 Replies
Message 1 of 1

ModelItem: Check if it is a partition/Find parent Partition

alexisDVJML
Collaborator
Collaborator

Context: In a Navisworks document, partitions are model items that indicate/refer to original source file.

For some use cases, and typically in our plugin, there are an important model item type. 

Thus the need:
1/ to check if a ModelItem is partition

2/ to find the parent partition of a ModelItem.

 

For 1/ I currently use 

anItem.ClassName == @"LcOaPartition"

 

And for 2/ I loop through anItem.Parent until I found one matching 1/ or reach the top (which should never happen)

 

Works nice.


However:
1/ I don't like to use such hard-coded string based comparison, was surprised there isn't a IsPartition property in ModelItem
2/ looping through parents is **** slow

 

Any options I would have missed?

 

 

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
236 Views
0 Replies
Replies (0)