I am following this tutorial to create my custom LEGO scenes & characters and render them out in blender but I am getting some errors.

Basically, I have downloaded this software (Studio by Bricklink) to make custom LEGO scenes. Now this software exports the 3D files in the format .ldr so I am using this add-on ImportLDraw. I have installed it blender. Now this add-on requires a library of LEGO pieces so I am using the one in the folder of Studio. Now when I try to import it in blender, I am getting this error.

enter image description here

How can I solve it? Thank you.


The function def loadFromFile(context, filename, isFullFilepath=True) assumes that there is a camera in your scene. It tries to retrieve it, but doesn't check if the returned value is None:

scene  = bpy.context.scene
camera = scene.camera

Later it assigns a location to the camera, which fails when there is no camera in the scene. This causes the exception in line 4337 that you're seeing.

camera.location = mathutils.Vector((6.5, -6.5, 4.75))

You can solve the problem by adding a camera to your scene and setting it as active camera. This issue has been fixed in the 2.80 version of the add-on.

  • $\begingroup$ It works. Thank you very much. $\endgroup$ – AshKB Nov 2 '19 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.