2
$\begingroup$

I want to get the coordinates of a vertex in the correct units, millimeters in this case for the current model, to do some calculations in external to blender module.

When changing the units of a scene in blender 2.82 all fields in the UI show the correct size, for example 100mm and 1mm in object and edit modes. So a vertex will show the location of 1000mm in the default cube for example. But when accessing the same coordinate through Python code as follows: bpy.data.objects['Cube'].data.vertices[x].co the data that we will get for the same vertex will be 1.0, meaning it remains in meters.

Any ideas as to how to get the coordinates/sizes in the correct units in Blender Python API?

$\endgroup$
1
  • $\begingroup$ I am looking into the same issue as well. Can't get my head around this one... $\endgroup$
    – FTM
    Jan 26, 2021 at 21:50

1 Answer 1

0
$\begingroup$

I think the question is mathematically inaccurate. Your coordinates are defined by magnitude and direction. To add a scale factor like mm or m you need to multiply these unit vector values with constants.

$\endgroup$
1
  • $\begingroup$ I would argue that this is partially correct, because blender UI will show you the location in units defined in the scene for example when the scene defined in mm the for the default cube the location of the vertices for x will be +/- 1000mm, this is what displayed by blender. On the other hand what will be provided by blender api will be 1 hence in meters. So lets say you want to combine two models one in meters and the other one in mm, and you want to do this using code. When importing the mm model into th m model it will not be converted to m, so they will be same scale. $\endgroup$
    – Shay Gusin
    May 20, 2020 at 7:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .