I have installed import_off addon from this github repo. This addon provide import functionality of the ".off" file in blender using the GUI. But there is no way I can import ".off" file using python.

Please tell if there is any way I can import .off files using python, since I intend to work on many 3D models and using GUI is not possible on all of them.


You are under a misapprehension that you can not use the import OFF addon you posted.

Get the name of the operator by mousing over the import menu bpy.ops.import_mesh.off(...)

Typing the operator in the python console and using autocomplete CrtlSpace exposes the parameters (Same as those in the UI).

bpy.ops.import_mesh.off(filepath="", filter_glob="*.off", axis_forward='Y', axis_up='Z')
>>> bpy.ops.import_mesh.off(

Simply pass the filepath of an OFF file to the operator in your own code.

Eg: to import with default settings.

filepath = "some/path/to/file.off"

This can be done for pretty much all import / export addons.

  • $\begingroup$ What does "axis_forward='Y'" mean? $\endgroup$ Dec 1 '16 at 19:31
  • $\begingroup$ To define a 3d space used by an application, need which axis is up, for blender z, and which axis points towards you (y) in front ortho. A lot of other applications use y up. Without converting a blender model will be exported with the wrong alignment. $\endgroup$
    – batFINGER
    Dec 2 '16 at 2:30

Answer from @batFINGER worked for me, but I had to pass the parameters as named parameters.

Do it like this:

bpy.ops.import_mesh.off(filepath = filepath)

Not like this:

  • 2
    $\begingroup$ Thanks, fixed the oversight in my answer. In future suggest adding a comment or making an edit. $\endgroup$
    – batFINGER
    Jul 12 at 8:45

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.