Im sure others have asked this but I havent found anything perhaps I am using the wrong keywords, anyway... Lets say I have sculpted a custom mesh (for example a 3d smiley face). How can I then access that mesh via python code. I can make a button to create a cube like so: row.operator(&quot;mesh.primitive_cube_add&quot;, icon='CUBE')  Now I want to make my own custom smiley face every time I press the button. I assume I have to save my mesh in a certain format or something, then extend the mesh class, and then load my mesh into it somehow? so I want to create this row.operator(&quot;mesh.my_smily_face_add&quot;, icon='CUBE')  Any help would be much appreciated!!!
21232
I want to add things like basic tables/chairs/houses I have made over the past year to my ShiftA menu. Is it possible to do this?
42328
I can't see this as an option so is there a way to select faces or islands and have them show up as selected faces on the object in 3D view.  In programs such as maya it is possible to work from either view and makes selection and mapping a little more user friendly.  I suspect it isn't possible in Blender but welcome your feed back.  Edited as flag as already answered, although the question was not asked in the other post in a way that showed in my search.  I was looking for face and island selection to show in both views. The other asked about unselected vertices this obviously did not appear in the results.
89573
In sketchup the extruding is similar to blender, but when I pull down it is different. I have a cube in sketchup and added 2 edges, and with the center face I pull down and it cuts to make the u shape. Sketchup  I tried something similar in Blender, but it did not work. After adding loop cut when pull down it created extra faces that I have delete and it adds more work to do. Is there any method or how can i make a simple way cut or extrude downwards? With the boolean can cut in sketchup, it's a simple way just to extrude downward and get what I want. Any suggestion or help which and make my work faster with this simple methods? Blender
68045
I am doing  Blenderguru tutorial to work on my modelling skills. At about 28:30 min in the tutorial it is demonstrated how to assign a material to a selected part of the mesh (another material is already assigned to the object). Now I have read  post and I think I have selected the right area (with face select) and assigned the new material but it does not work. Why ?
112149
How could I select one vertex from my mesh if I know ID of that vertex? I enabled bpy.app.debug = True and I can see all IDs but cant find a specific one.
67782
As part of an existing add-on, I'm trying to create an object and add it to the scene using Python. I followed a Blender Cookbook tutorial found here: . I use the following code to do so:  emptyMesh = bpy.data.meshes.new('emptyMesh') theObj = bpy.data.objects.new("object_name", emptyMesh) bpy.context.scene.objects.link(theObj)   But I get the following error when I try to link theObj to the scene objects:  AttributeError: 'bpy_prop_collection' object has no attribute 'link'   This works just fine in Blender 2.76-2.79, but doesn't work in the 2.80 test build I downloaded. Was there a change to the Python API? Or is this maybe a bug in the test build?
80551
Question The title says it all. I want to be able to make this in Blender's UI, and sample it at specific points :  Problem There is very insufficient documentation on this, and I can't find any examples for how to create a . I have worked with templates before, and , but it requires a curve mapping prop. Extra Info I found a few threads about this, and one gives me the impression that this cannot be done at all, but it is also very old.   This similar question has been asked here before, but it didn't even get a comment:  Is this even possible to access in python (as in only accessible in C)?
25602
How can I make a Interface which is similar to the Material-Interface within Blender via Python?    It should look like these. Could you guide me to the right direction? I don't think it's in bpy.ops, right?  Thank you very much!
69425
I would like to know if there is any way to use the "Add 3d Function Surface" addon via the python interface.  I have an equation that describes a surface in the three-dimensional space that I can use to make a mesh object as described in . What I would like to know is if there is any way to do such a thing via the python interface.   As an example, I would like to be able to do something like:  def mysurface(u, v):    return numpy.array([u*v, u-v, math.pow(u, 2)])  add_mesh_from_surface_equation(func = mysurface, urange = [0, 10], vrange = [0, 10], ustep = 0.01, vstep = 0.01)   Is it possible to do something like this?
119354
I'm making a script to import custom objects, it is still at early stage but so far vertices, faces and uv are created correctly. I want to do weight painting through Blender's Python API but I don't know how to do it properly.  Below an extract of the code that create the objects, how I could add vertex group and relative weights? I know how to extract vertex indices and weights from the input model but don't know how to use them,   (Blender version is 2.72)      for i in range(0,self. subsetCount):         subset = self.subset[i]         coords = subset.getV3(0)         faces = subset.getIndices()         me = bpy.data.meshes.new(subset.name+"_Mesh")          ob = bpy.data.objects.new(str(i).zfill(2)+'_'+subset.name, me)         ob.location = (0, 0, 0)         bpy.context.scene.objects.link(ob)          me.from_pydata(coords, [], faces)         me.update(calc_edges=True)          mat = bpy.data.materials.new(subset.name)         mat.diffuse_color = (random.uniform(0.0, 1.0), \                              random.uniform(0.0, 1.0), \                              random.uniform(0.0, 1.0))         me.materials.append(mat)          for f in me.polygons:             f.material_index = 0             f.use_smooth = 1          # vert_uvs = subset.getV2(0x28)         # if len(vert_uvs) &gt; 0:         #     me.uv_textures.new("UV0")         #     uvlist = [uv for pair in [vert_uvs[l.vertex_index] for l in me.loops] for uv in pair]         #     me.uv_layers[-1].data.foreach_set("uv", uvlist)   edit  found this to add the group:          vxgroup = ob.vertex_groups.new("group")   still don't know how to set weights for vertices (best would be at once)  edit  I was hoping to use something like a foreach_set but can't figure out how to use it, instead solved this way:          for grp in ob.vertex_groups:             grp.add(range(0,len(me.vertices)), 1.0, 'REPLACE')   is just an example and set all vertices weight in all groups of the object ob (if you try it in console select another mesh then back to see the weights applied).
53504
I have a large mesh with > 1.5 million faces. I would like to uniformly add a texture to the object without UV mapping (as blender freezes every time). The texture is quite simple and can be applied evenly throughout the object.
596
I am trying to access the triangle count of an object with Python. All other python code displays itself when I hover my mouse over the corresponding button in the interface. When I go to the info bar and hover my mouse over the triangle count, nothing appears. When looking in the documentation around data, there doesn't appear to be any clear function to call to get this info.
100459
So I want to change how the mesh looks (through edit mode) so the geometry of the shape changes throughout the animation. So I have a laser but I want my selected faces to be scaling up and down. How can I do this?  Thanks in advance
27303
As the title says, how can I make this shape without resorting to a Boolean operation?    This is obviously a very simple example, but I find myself needing to do something like this relatively often when modelling.  Despite using Blender for a couple of years, and considering myself an intermediate to possibly advanced user, I still know of no easy way to make this kind of indentation in an object.  Obviously, if you are looking to make an indentation in the middle of the surface, you can simply select a face and extrude down. As you will know, this does not work at the edge of the surface.  I can create this shape using loop cuts, deleting the faces and then using snap to edge to extrude the edges down to the same level (and then filling in the faces), but it feels cumbersome and a lot of work for what feels like it should be very simple.
17548
So I wish to create and object and set it's shading to 'smooth' using python. It seems simple enough but after trying every method I could find on the internet none of them worked for me. Here's a short example script where the object needs to have smooth shading:  import bpy from mathutils import Vector  verts = [(0,0,0),(0,5,0),(0.25,5,0),(0.25,0,0),(0,0,5),(0,5,5),(0.25,5,5),(0.25,0,5)] faces = [(0,1,2,3), (4,5,6,7), (0,4,5,1), (1,5,6,2), (2,6,7,3), (3,7,4,0)]  grat1mesh = bpy.data.meshes.new("grat1") grat1obj = bpy.data.objects.new("grat1", grat1mesh) grat1obj.location = (5, -5, 0) bpy.context.scene.objects.link(grat1obj) grat1mesh.from_pydata(verts,[],faces) grat1mesh.update(calc_edges=True)  grat2obj = grat1obj.copy() grat2obj.data = grat1mesh.copy() bpy.context.scene.objects.link(grat2obj) grat2obj.location += Vector((-0.125, 1.25, 1.25)) grat2obj.scale = (2, 0.5, 0.5)  bm = grat1obj.modifiers.new("Chop", 'BOOLEAN') bm.object = grat2obj bm.operation = 'DIFFERENCE' bpy.context.scene.objects.active = grat1obj bpy.ops.object.modifier_apply(modifier=bm.name) bpy.context.scene.objects.unlink(grat2obj)   I found this online and tried to place it at the end of the script:  smoothings = [] smoothings.append(face.use_smooth) me_ob.faces.foreach_set("use_smooth", smoothings)   However this just returned an error on the second line, perhaps as it was from an older website. Obviously using a simple bpy.ops.object.shade_smooth() didn't work and I'm kind of stumped as of what to do here!
26059
I was following a tutorial to create a helmet. A the step for the mesh under the cube he insets a face to create an indent, but only insets the side of the mesh, not the open border. How did he do it?
86980
I've only just started studying the Blender Python API. I'm writing a script (see below) to automate something I've done by hand : joining two adjacent cubes and cleaning up the resulting mesh.   After joining and removing doubles, I expect to have 12 vertices instead of 16 in the resulting object. In the Info header, this seems to be the case, but when I print to the windows terminal I still see 16. Also I do see the output from remove_double(), here's a screenshot :    So what's wrong here ? What is the right way to access an object's mesh, and count its vertices ?  Joao  import bpy  # Create two adjacent cubes and join them bpy.ops.mesh.primitive_cube_add(location=(1,0,0)) ob = bpy.context.object bpy.ops.mesh.primitive_cube_add(location=(3,0,0)) ob.select = True bpy.ops.object.join()  # Expect 16 vertices, 24 edges, 12 faces result = bpy.context.object print(str(len(result.data.vertices)))  # Go to edit mode, remove double vertices bpy.ops.object.mode_set(mode = 'EDIT') bpy.ops.mesh.remove_doubles()  # Expect 12 vertices, 20 edges, 11 faces result = bpy.context.object print(str(len(result.data.vertices)))