how to convert physical coordinate to world coordinate

Hi everyone!
Now I have a .stl file ,I need to get the vertex under the world coordinate.

Greetings, zhou, welcome to the group.

In general, the more information you can give us about what you are doing, and how you are doing it, the better the answers you’re likely to get. For instance, a code snippet may help readers to get you going towards a solution more quickly.

I’m assuming that you are reading your STL file in with vtkSTLReader, and that you have the output data object (an instance of vtkPolyData). One possible way to get the node ID of the closest node to a given location in “world” coordinates would be to use vtkStaticPointLocator. Here is a sketch of what that might look like in Python:

import vtk

r = vtk.vtkSTLReader()
r.SetFileName("nameofyourfile.stl")
r.Update()
pd = r.GetOutput()

h = vtk.vtkStaticPointLocator()
h.SetDataSet(pd)
h.BuildLocator()

# Find the node id of the node closest to the point (1, 2, 3) in "real" space.
node_idx = h.FindClosestPoint(1, 2, 3)