Hello to every one who is reading this,

I know how to convert and decimate files in Blender. Now I would like to safe me some time and get a litle in to the scripting.

So I checked here for some Questions/Answers, @wiki.blender.ord for documentations and scripts. Like here https://docs.blender.org/api/blender_python_api_2_76_1/bpy.ops.import_mesh.html

Also ich have copyed and changed this little Script:

import bpy
import sys

argv = sys.argv
argv = argv[argv.index("--")+1:]

stl_in = argv[0]
fbx_out = argv[1]


As there is no import's for *.stp the exported fbx file by this script is garbage, if I convert a stl file with this.

Question 1: Is there a way to import *.stp File in to blender, with out converting the *.stp file in to *.stl or other by Blender acceptable type with external tools?

For the part of decimate of faces i found this script: https://gist.github.com/wooddar/0a5f409dc67cc045c421

I have tryed following:


bpy.context.object.modifiers["Decimate"].ratio = number_of_faces_in_stl_obj/max_faces

Here I have two problems, the first it didn't worked at all. The second on is how can i get the number_of_faces_in_stl_obj so I can calculate the ratio.

Question 2: After I've imported an object with 'bpy.ops.import_mesh.stl(filepath=stl_in)' do I get with 'bpy.context.object' to some thing like number_of_surfaces/polygons?

In andvence thank you for you help.

EDIT: Added my Questions

  • $\begingroup$ i think there's a typo in here: you request to convert step data to fbx, but in fact in your script you're converting stl data to fbx. Step data mainly contains NURBs surface patches, stl contains polygons. Please edit the question to clarify what you're after. $\endgroup$
    – aliasguru
    Mar 23, 2017 at 11:32
  • $\begingroup$ i want to convert stp files in to fbx. The only option i've found on the net is to use freecad and convert with it the *.stp file in to *.stl file. $\endgroup$
    – akr
    Mar 23, 2017 at 13:58

1 Answer 1


Is there a way to import *.stp File in to blender, with out converting the *.stp file in to *.stl or other by Blender acceptable type with external tools?

Unfortunately no. The current import tools available in Blender do not allow (to my knowledge) to read and / or interpret NURBS input data. Some way or another, this always has to be processed by an external application first, and then be brought into Blender in a second step.

There are a few tools out there which can assist in this, you already mentioned FreeCAD which does a good job on less complicated input files. Many times however you're stuck with proprietary commercial software. A solution that works well is Autodesk Showcase. It reads many industry standard formats, allows for dynamic tessellation of parts / files, gives you a nice visual representation, and exports well to .fbx, which is the preferred format (for me) to bring stuff into Blender. Main advantage: With this pipeline, custom split normals are generated and imported correctly.

Recently an Add-on appeared on Gumroad which does a pretty decent job in importing and tessellating .step data: STEPper. I use it successfully since a while, and while the tessellation sometimes looks different than what you'd expect in terms of triangle layout, it still gets the job done nicely. Also, after import, you can re-tessellate in case you are not satisfied with the outcome, which is a plus.

After I've imported an object with bpy.ops.import_mesh.stl(filepath=stl_in) do I get with bpy.context.object to some thing like number_of_surfaces/polygons?

Of course. You can use len(bpy.context.object.data.polygons) to get the polycount of the active object. len(bpy.context.object.data.vertices) and len(bpy.context.object.data.edges) are the vertex and edge counterparts. In essence, bpy.context.object.data.polygons and the like are Python lists, where you can access each individual face / edge / vertex.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .