Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 740
    • Issues 740
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 198
    • Merge requests 198
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #18401
Closed
Open
Created Nov 26, 2021 by Douglas Brennan@scotsman60

vtkDataAssembly.SelectNodes() fails to return expected node IDs

I’m using Python 3.9 and vtk 9.1.0 on Windows and find that vtkDataAssembly.SelectNodes() is not working correctly. The below example populates an assembly from XML The assembly has a root node named "Model_26", with a single child named "Assembly_1" which in turn has 19 children. The example then make tqo SelectNodes calls - the first is epected to return the ID of the "Assembly_1" node and the second is expected to return the IDs of the 19 children of "Assembly_1" The first selection behaves as expected but the second returns nothing Further testing shows that any selection path with a trailing '/' returns nothing instead of returning the childern of the last node in the path

import vtk

data_assembly_xml="""<?xml version="1.0"?>
<Model_26 type="vtkDataAssembly" version="1.0" id="0">
 <Assembly_1 id="1">
  <Part_462 id="2">
   <Solid_1 id="3">
    <dataset id="0" />
   </Solid_1>
  </Part_462>
  <Part_463 id="4">
   <Mesh_1 id="5">
    <dataset id="1" />
    <dataset id="2" />
   </Mesh_1>
   <Solid_2 id="6" />
  </Part_463>
  <Part_464 id="7">
   <Solid_3 id="8">
    <dataset id="3" />
   </Solid_3>
  </Part_464>
  <Part_465 id="9">
   <Solid_4 id="10">
    <dataset id="4" />
   </Solid_4>
  </Part_465>
  <Part_466 id="11">
   <Solid_5 id="12">
    <dataset id="5" />
   </Solid_5>
  </Part_466>
  <Part_467 id="13">
   <Solid_6 id="14">
    <dataset id="6" />
   </Solid_6>
  </Part_467>
  <Part_468 id="15">
   <Solid_7 id="16">
    <dataset id="7" />
   </Solid_7>
  </Part_468>
  <Part_469 id="17">
   <Mesh_2 id="18">
    <dataset id="8" />
    <dataset id="9" />
   </Mesh_2>
   <Solid_8 id="19" />
  </Part_469>
  <Part_470 id="20">
   <Solid_9 id="21">
    <dataset id="10" />
   </Solid_9>
  </Part_470>
  <Part_471 id="22">
   <Solid_10 id="23">
    <dataset id="11" />
   </Solid_10>
  </Part_471>
  <Part_479 id="24">
   <Solid_18 id="25">
    <dataset id="12" />
   </Solid_18>
  </Part_479>
  <Part_484 id="26">
   <Solid_23 id="27">
    <dataset id="13" />
   </Solid_23>
  </Part_484>
  <Part_485 id="28">
   <Solid_24 id="29">
    <dataset id="14" />
   </Solid_24>
  </Part_485>
  <Part_488 id="30">
   <Solid_27 id="31">
    <dataset id="15" />
   </Solid_27>
  </Part_488>
  <Part_490 id="32">
   <Solid_29 id="33">
    <dataset id="16" />
   </Solid_29>
  </Part_490>
  <Part_517 id="34">
   <Solid_56 id="35">
    <dataset id="17" />
   </Solid_56>
  </Part_517>
  <Part_518 id="36">
   <Solid_57 id="37">
    <dataset id="18" />
   </Solid_57>
  </Part_518>
  <Part_519 id="38">
   <Solid_58 id="39">
    <dataset id="19" />
   </Solid_58>
  </Part_519>
  <Part_520 id="40">
   <Solid_59 id="41">
    <dataset id="20" />
   </Solid_59>
  </Part_520>
 </Assembly_1>
</Model_26>"""

das = vtk.vtkDataAssembly()
das.InitializeFromXML(data_assembly_xml)

print(das.SelectNodes(['/Model_26/Assembly_1']))

print(das.SelectNodes(['/Model_26/Assembly_1/']))

This produces the following output,

(1,)
()
Edited Nov 26, 2021 by Douglas Brennan
Assignee
Assign to
Time tracking