Hello,
I create an interface with PyQt5 Inside Blender. i embed into this interface some buttons to run my script.
My project is import a file .stl with a button from my hard drive and it works well.
In the console, i have this error:
AttributeError: ‘bool’ object has no attribute ‘scene’
this is my function:
def mark1Command(self, context):
bpy.ops.object.empty_add(type=‘PLAIN_AXES’, radius=1, view_align=False, location=(context.scene.cursor_location.x,context.scene.cursor_location.y,context.scene.cursor_location.z), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
for obj in bpy.context.selected_objects:
obj.name = “Repere1”
return {‘FINISHED’}
If the error is in this function, probably you are calling it with a wrong “context” argument. You are a sending a “bool”. But it needs to be a bpy.context object.
before i code with PyQt, i used GUI of Blender and it works very well.
I want to convert GUI blender to PyQt5. this is my code:
class Repere1(bpy.types.Operator):
bl_idname=“object.repere1”
bl_label = " Creation Repere 1 "
def execute(self,context):
bpy.ops.object.empty_add(type=‘PLAIN_AXES’, radius=1, view_align=False, location=(context.scene.cursor_location.x,context. scene.cursor_location.y,context.scene.cursor_locat ion.z), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
for obj in bpy.context.selected_objects:
obj.name = “Repere1”
return {‘FINISHED’}
bpy.utils.register_class(Repere1)