1 Reply Latest reply on Jan 2, 2017 10:17 AM by Josh Brady

    determine parent-child relationship of components from their persistent IDs

    Jana Fischer

      For a given assembly document, I have a list of persistent reference IDs of components of that assembly.

      The persistent reference IDs were gotten by using IModelDocExtension.GetPersistentReference3(...) on the assembly components.

      They are of type byte[] (i.e. array of bytes).

       

      I would like to know if it is possible to determine the parent-child relationships by just comparing these IDs, and if yes, how.

       

       

      For example, this assembly (it is attached if you want to try it out)

      nestedAssembly.png

      has these IDs:

       

      part1: [64|31|0|0|5|0|0|0|255|254|255|13|112|0|97|0|114|0|116|0|49|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|48|0|4|0|0|0|16|0|0|0|1|0|0|0|1|0|0|0|23|0|0|0]

      assy1: [64|31|0|0|5|0|0|0|255|254|255|13|97|0|115|0|115|0|121|0|49|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|48|0|4|0|0|0|16|0|0|0|1|0|0|0|1|0|0|0|21|0|0|0]

      part2: [64|31|0|0|5|0|0|0|255|254|255|27|97|0|115|0|115|0|121|0|49|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|48|0|47|0|112|0|97|0|114|0|116|0|50|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|49|0|4|0|0|0|16|0|0|0|1|0|0|0|2|0|0|0|21|0|0|0|22|0|0|0]

      assy2: [64|31|0|0|5|0|0|0|255|254|255|27|97|0|115|0|115|0|121|0|49|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|48|0|47|0|97|0|115|0|115|0|121|0|50|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|49|0|4|0|0|0|16|0|0|0|1|0|0|0|2|0|0|0|21|0|0|0|24|0|0|0]

      part3: [64|31|0|0|5|0|0|0|255|254|255|41|97|0|115|0|115|0|121|0|49|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|48|0|47|0|97|0|115|0|115|0|121|0|50|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|49|0|47|0|112|0|97|0|114|0|116|0|51|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|50|0|4|0|0|0|16|0|0|0|1|0|0|0|3|0|0|0|21|0|0|0|24|0|0|0|22|0|0|0]

      assy3: [64|31|0|0|5|0|0|0|255|254|255|41|97|0|115|0|115|0|121|0|49|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|48|0|47|0|97|0|115|0|115|0|121|0|50|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|49|0|47|0|97|0|115|0|115|0|121|0|51|0|45|0|49|0|64|0|97|0|115|0|115|0|121|0|50|0|4|0|0|0|16|0|0|0|1|0|0|0|3|0|0|0|21|0|0|0|24|0|0|0|24|0|0|0]

       

      I can see that the length of the ID determines the level of the component (deeper nested components have longer IDs), but I was not able to get anything else out of these arrays...

       

      Update:

      It seems that the length does not always determine the level of the component. I checked an assembly where all components were top level, and I got these ids:

       

      component1: [64|31|0|0|5|0|0|0|255|254|255|25|119|0|111|0|109|0|97|0|110|0|45|0|49|0|64|0|67|0|69|0|77|0|45|0|83|0|84|0|32|0|45|0|32|0|73|0|78|0|68|0|73|0|82|0|69|0|67|0|84|0|4|0|0|0|16|0|0|0|1|0|0|0|1|0|0|0|151|0|0|0]

      component2: [64|31|0|0|5|0|0|0|255|254|255|25|119|0|111|0|109|0|97|0|110|0|45|0|50|0|64|0|67|0|69|0|77|0|45|0|83|0|84|0|32|0|45|0|32|0|73|0|78|0|68|0|73|0|82|0|69|0|67|0|84|0|4|0|0|0|16|0|0|0|1|0|0|0|1|0|0|0|160|0|0|0]

      component3: [64|31|0|0|5|0|0|0|255|254|255|30|75|0|69|0|78|0|48|0|48|0|48|0|48|0|57|0|52|0|57|0|45|0|50|0|64|0|67|0|69|0|77|0|45|0|83|0|84|0|32|0|45|0|32|0|73|0|78|0|68|0|73|0|82|0|69|0|67|0|84|0|4|0|0|0|16|0|0|0|1|0|0|0|1|0|0|0|63|0|0|0]

      component4: [64|31|0|0|5|0|0|0|255|254|255|32|86|0|76|0|69|0|48|0|48|0|48|0|54|0|51|0|55|0|57|0|48|0|49|0|45|0|49|0|64|0|67|0|69|0|77|0|45|0|83|0|84|0|32|0|45|0|32|0|73|0|78|0|68|0|73|0|82|0|69|0|67|0|84|0|4|0|0|0|16|0|0|0|1|0|0|0|1|0|0|0|16|0|0|0]

      component5: [64|31|0|0|5|0|0|0|255|254|255|32|86|0|76|0|69|0|48|0|48|0|49|0|48|0|55|0|57|0|51|0|48|0|49|0|45|0|49|0|64|0|67|0|69|0|77|0|45|0|83|0|84|0|32|0|45|0|32|0|73|0|78|0|68|0|73|0|82|0|69|0|67|0|84|0|4|0|0|0|16|0|0|0|1|0|0|0|1|0|0|0|97|0|0|0]