0

I want to use edge slide operation using python. But I got error "RuntimeError: Operator bpy.ops.transform.edge_slide.poll() expected a view3d region & editmesh".

I searched and found several solutions for loop cuts but didn't find specifically for edge loops. I modified the loop cut script for edge loop but didn't work. can anyone help?

links are: Loop Cut and Slide using Python not working

How to use loopcut_slide operation without any UI?

Marty Fouts
  • 33,070
  • 10
  • 35
  • 79
dip deb
  • 35
  • 1
  • 6

1 Answers1

1

Here's the answer which solved my problem. I need to find out area in view 3d and other related info pack those things into override variable and put that variable at the first input of edge_slide function.

import bpy
def view3d_find( return_area = False ):
for area in bpy.context.window.screen.areas:
    if area.type == 'VIEW_3D':
        v3d = area.spaces[0]

        for region in area.regions:
            if region.type == 'WINDOW':
                if return_area: return region, v3d, area

region, v3d, area = view3d_find(True) #we need to put those values into a single variable in the following override = { 'scene': bpy.context.scene,'region' : region,'area': area,'space': v3d} #must be in edit mode bpy.ops.transform.edge_slide(override,value=0.3, mirror=True, correct_uv=True)

dip deb
  • 35
  • 1
  • 6