1
$\begingroup$

I don't know whether I'm doing any mistake, but this is how my UVs are when I do Smart UV Project inside Blender editor manually.

enter image description here

But as far I switched to scripting:

import bpy

obj = bpy.context.active_object
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.smart_project(angle_limit=66, island_margin=0.06)

enter image description here

The result in scripting is very tiny and spacing is not accurate. Kindly guide me if I am doing any mistake in my script.

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

That is because your angle is incorrect. You have to pass your angle as radians, not degrees.

import bpy
import math as m

obj = bpy.context.active_object
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.smart_project(angle_limit=m.radians(66), island_margin=0.06)
$\endgroup$
2
  • 1
    $\begingroup$ Ohh, I had this doubt before but on internet so many examples people were using 66 as degrees. By the way thanks for quick response $\endgroup$
    – USMANHEART
    Commented Jul 15, 2023 at 13:33
  • $\begingroup$ you're welcome! $\endgroup$
    – Harry McKenzie
    Commented Jul 15, 2023 at 14:21

You must log in to answer this question.

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