bpy.ops.mesh.extrude_faces_move

using Blender 2.5x 29431
i’m pretty new to python but have coded in C, C++, JAVA and maxScript in the past…
now it’s time I do some procedural modelling, it’s summer and I have time to kill (and art to make! )

from : http://www.blender.org/documentation/250PythonDoc/bpy.ops.mesh.html

bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude=None, TRANSFORM_OT_shrink_fatten=None)
Undocumented (contribute)
Parameters:	
MESH_OT_extrude (MESH_OT_extrude, (optional)) – Extrude, Extrude selected vertices, edges or faces
TRANSFORM_OT_shrink_fatten (TRANSFORM_OT_shrink_fatten, (optional)) – Shrink/Fatten, Shrink/fatten selected vertices along normals

To get me started :
What i would like to do is extrude a face 0.1 blender unit along the face normal, from the console. The report function of the console says

bpy.ops.mesh.extrude_region_move(MESH_OT_extrude='<POINTER>', TRANSFORM_OT_translate='<POINTER>')

If i paste that into the python console and run the line, it produces several lines of error-code.

I’ll appreciate any directions/help ( i have looked at the existing 2.5 repo for python mesh scripts…but was not able to find anything related to extruding )

OK so …

bpy.ops.mesh.extrude()
bpy.ops.transform.translate(value=(0, 0, 0.724422), constraint_axis=(False, False, True), constraint_orientation=‘GLOBAL’, mirror=False, proportional=‘DISABLED’, proportional_editing_falloff=‘SHARP’, proportional_size=0.683013, snap=False, snap_target=‘CLOSEST’, snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

extrudes and moves in the z direction by the specified amount…OK i’ll figure it out from here :slight_smile: so i need to understand how to query or make a variable/data structure like ‘<POINTER>’ that contains a bunch of information like the line above here…and start implementing a script…

The extrude operators are macros. For the sub operators, you have to provide a dictionary with the properties you want to pass to them (you can look up the individual operators by name, in this case, MESH_OT_extrude and TRANSFORM_OT_shrink_fatten).

For what you want to do (extrude individual faces outside by 0.1), this is what you want to call:


bpy.ops.mesh.extrude_faces_move(TRANSFORM_OT_shrink_fatten={"value":-0.1})

All other properties will be the default, since we aren’t passing them around (you might want to pass the extrude mode to MESH_OT_extrude, if you’re not sure what the selection holds).

Martin

ok that like was a lot of help. thank you theeth. i’ll plow away in silence until i understand more :slight_smile:

Hi,
I’m learning python for blender 2.5, and testing it on some procedural modeling scripts I’ve already done for 3dsmax.
I have the same kind of problem with this command on edges: (extrude , Shift+E)

bpy.ops.mesh.extrude_edges_move(MESH_OT_extrude=None, TRANSFORM_OT_translate=None)

when I use it in viewport, the report tells

bpy.ops.mesh.extrude_edges_move(MESH_OT_extrude=‘<POINTER>’, TRANSFORM_OT_translate=‘<POINTER>’)

Can anyone tell me what kind of variables/syntax, Blender is waiting for(in place of <POINTER>), I’m trying all kind of calls, for two days and I don’t find any solution…
All I want to do is extrude edges in “z” of 5 units… in example.

Thanks in advance,


t-maes

do something like

bpy.ops.transform.translate(value=(0, 0, 5.0))

you will have to enter viewport (orbit around) / or call a redraw for the translate to be visible.
but i havent found a redraw function either. (while it seems to exist for 2.49 )

it would be nice to know a bit more :slight_smile: i’m sure i’m doing it backwards :slight_smile:

ok, thank you,

extrude by 0 and then translate, that would be a solution, I didn’t thought about it.
But it would still be nicer in only one line…
I tell you if I find something…

thanks again

__
t-maes


bpy.ops.mesh.extrude_edges_move(MESH_OT_extrude=None, TRANSFORM_OT_translate={"value":(0,0,5), "constraint_orientation":"GLOBAL"}) 

MESH_OT_extrude=None is optional. Omitting it or setting it to none means use the default operator properties.

for TRANSFORM_OT_translate, value is the motion vector in space and constraint_orientation is the orientation in which the translation takes place (“GLOBAL”, “LOCAL”, “VIEW”, …). Other properties are available, of course, but this is basically what you need in this case.

For macros, the simplest ways to know what each sub operators (MESH_OT_extrude and TRANSFORM_OT_translate) are expecting is to either run these operators individual and check the logged operator in the report console or look in the operator documentation.

Martin

thank you 1000 times,
I’m trying these right now.


t-maes

Ok it works fine!
But I’m not sure to understand you well when you say:

In my first message, the first quote is the online documentation, and the second is the report,

  • the doc. is not yet complete ( quite understandable, at this stage, I will contribute with the precious help you gave me)
    here is the complete operator help:

bpy.ops.mesh.extrude_edges_move(MESH_OT_extrude=None, TRANSFORM_OT_translate=None)Undocumented (contribute)
Parameters:

  • MESH_OT_extrude (MESH_OT_extrude, (optional)) – Extrude, Extrude selected vertices, edges or faces
  • TRANSFORM_OT_translate (TRANSFORM_OT_translate, (optional)) – Translate, Translate selected items
  • the report only gave me <POINTER> for the operators; even if I enter keyboard values. Deduction is hard. Is there a way not to have <POINTER> in the reports?

Or have I misunderstood?
Regards,


t-maes

this <POINTER> was the reason I posted here in the first place, in 3dsmax pretty much everything is reported in the console (all that would be necessary to repeat the operation from command line) and also the documentation in 3dsmax is full of examples. I look forward to see Blender3d 2.5 documentation (from sphinx?) with examples for the operators/functions…

i do realize it’s a moving target… and this is not criticism.

What I was saying is that you should look at the documentation of the two operators in the macro.

TRANSFORM_OT_translate = bpy.ops.transform.translate
MESH_OT_extrude = bpy.ops.mesh.extrude

Reports for macros will have to be fixed to print values for suboperators. For the moment, there’s not much that can be done.

Martin

ok, that was the exact answer I was looking for…

thank you, I have a lot to learn with that.


t-maes