0
$\begingroup$

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?

$\endgroup$
1
  • $\begingroup$ Hello, Thanks for your concern. I found the solution by doing some research by myself. $\endgroup$ Commented Dec 6, 2021 at 9:35

1 Answer 1

1
$\begingroup$

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)
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.