text:
Disable Material Duplication
Anyone who has used Blender for a while has probably tried to duplicate a scene via Full Copy. They would have then found that in the duplicated scene, all of the materials were duplicated as well, receiving that infuriating .001 ending. Normally, one might be able to change all the materials back to the originals and then reload the file (as suggested here) to get rid of the duplicate materials. I can do this, but I have A LOT of material slots in my project, and the work is incredibly boring.
So basically, my question is...
Is there a button, script, feature, or anything else that would disable the duplication of materials when I duplicate my scene.
Note that if the answer is a script, I will need to be walked through how to use it as my Python skills are about a -52. :)

Did my answer help you, or are you looking for something else? If it was helpful, please mark it as answered, thanks.

@ToddMcIntosh I'm sorry for being a terrible person, but I actually haven't tried it out yet. Is it ok if I mark it as accepted once I try it, or do you want the rep now?

No, try it first, and let me know if you need help getting it to work.

You can run this script to replace all duplicated materials in your file. Just paste it into the Text editor and click the Run Script button.
It searches all objects, and then compares the first part of the material name (the part before the .001 suffix) with any materials named the same, and if a match is found replaces the object material with the matched material.
The idea would be to do a Full Scene copy and then run this script to remove all material duplicates.
import bpy
mats = bpy.data.materials

for obj in bpy.data.objects:
    for slt in obj.material_slots:
        part = slt.name.rpartition('.')
        if part[2].isnumeric() and part[0] in mats:
            slt.material = mats.get(part[0])

Before running the script, make sure your materials are named properly. Any material that ends with .001, .002 or 003, will be replaced by its "original version".
Credit for script goes to user liero on  this BlenderArtist.org page
Ctrl + Shift + O finishes the job by reloading the file.

Worked like a charm. I do feel bad for making you wait so long, so I'm giving you a +50 bounty. Please accept my thanks. P.S. Just edited it with a little tip that I found handy.

The following Add-on creates an empty scene, duplicates all objects and links them to the new one without duplicating the materials of the objects:

Click to enlarge
Once it's enabled, hit Spacebar in 3D View and run 'Duplicate Scene'. Notice that it's a copy of the scene objects only, render and world settings are default.

custom-scene-duplicator.py
bl_info = {
    "name": "Duplicate Scene",
    "description": "",
    "author": "poor",
    "version": (0, 0, 1),
    "blender": (2, 70, 0),
    "location": "3D View > Spacebar > Duplicate Scene",
    "category": "3D View"
}

import bpy

def dupeObj(ob, scn):
    ob_copy = ob.copy()
    ob_data = ob.data.copy()
    ob_copy.data = ob_data
    scn.objects.link(ob_copy)
    scn.objects.active = ob_copy

class CustomDuplicateSceneOperator(bpy.types.Operator):
    """Duplicate all objects in the scene without material duplication"""
    bl_idname = "view3d.duplicate_scene"
    bl_label = "Duplicate Scene"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):

        # current scene
        orig_scene = context.scene.name
        bpy.ops.scene.new(type='NEW')

        # get the new scene
        new_scene = bpy.context.scene
        for ob in bpy.data.scenes[orig_scene].objects:
            dupeObj(ob, new_scene)

        self.report({'INFO'}, "Scene duplicated to {}".format(new_scene.name))
        return {'FINISHED'}

def register():
    bpy.utils.register_class(CustomDuplicateSceneOperator)

def unregister():
    bpy.utils.unregister_class(CustomDuplicateSceneOperator)

if __name__ == "__main__":
    register()

Install the Add-on via File > User Preferences > Add-ons > Install from File.

Ok, just downloaded and installed it. I copied the script into Aquamacs, a version of Emacs for Macs and saved it as a .py. Upon installing it and attempting to duplicate my scene, it worked okay. First, it switched to BI, so I turned it back to Cycles. Second, I lost a one-bone rig (Strech To Constraint), the rigged mesh, and the object that the bone was parented to. One separate thing that I think could be improved upon is I think the option should be added to the current Add Scene dropdown. I think you've got something really good here, it just needs some work to be perfect.

@ShadyPuck Yep, needs more testing. I'll try to improve it as soon as I can.

Ok, let me know when it's done? Thanks!

Wouldn't this be as simple as just using the New Scene > Link Objects New Scene > Link Object Data?
You can then select all objects and press U Make Single User > Object or Make Single User > Object and Data and you will have virtually duplicated your scene with all new objects with independent object data, but maintaining the same materials.

Only caveat is that if you have object instances inside the same scene their relationships will also be lost when making a single user.
You could work around this by selecting all objects with the same object data using Shift + L Select Linked > Object Data, making sure one of them is the active object, then making single user of the active object, then  linking all of them back to the new one with Ctrl + L Link > Object Data

A very simple tip to clean a scene from all its materials and orphan chunks, is to export in wavefront format (.obj). As a result, you will get two files. Obj file contains your objects with very few differences from blender except you loose modifiers. For example, if a subsurf modifier is active while you export, the object will be saved with subsurf applied. Arrays, wireframe or lattice are definitely applied to .obj objects.
The other file (.mtl) contains all materials (with their dependant textures). Erase or remame it and re_import .obj in a blank blender environment. All undesired chunks are cleaned from the new blend file.
It may be usefull when migrating a scene to Cycles Render or if your blend is full of orphan chunks (memory leaks) that didn't be erased when their parent reference been suppressed.
Hope it helps

This sounds like a horrible way to clean a blend file. Sure you get rid of unused materials, but it is terribly destructive to your models. I would never recommend using this method.

As it worked for me, I posted the answer. I had to remove modifiers before and recreate them manually in target file. Redo UV maps with same bitmaps. Topology is not destroyed while other methods transfer data-chunks regardless of how they're used. Once chunk is in the blend file, it looks impossible to remove (no garbage collection).

I'm not professional in blender (i m developper) and I had errors from the beginning of my models (duplicate textured faces, grab shaders from popup instead of Ctrl-L) . My only option was to redo all from scratch. Obj export is definitly better !

You do not have to get defensive. (For the record I did not down vote your post) If that is the way you used, then ok. I was warning others to not do that because there are better ways.

Python script given is a huge help while object export is a python script too ! .obj is in text format you can browse with an editor and see what happens in blender database. It helps !

I took a look to export script and it does about the same as the script given above ! the only difference is that you get your data in text format. And using the python user script don't let you select objects you want to copy ...  In fact, I was redirected from another question which was asked somehow differently ...   The website says "This question was already answered ...", It would better be "Related question ".


text:
Water Not Being Emitted and the Domain Stays a Cube when Baked in Water Simulator
I don't know why this is happening, but my water simulator is not working. Here is my setup:

The selected object as well as the other big object are both obstacles. There is a rectangle at the top as the inflow and another at the bottom as the outflow. The whole thing is surrounded with a cube that is the domain (it is hidden now). Basically, it is a slab then a drop then a slab. A side view looks like this:
000000000
x       0
ooooooo 0
      o 0
      o 00000000
      o        y
      oooooooooo

o - Object 1, obstacle
0 - Object 2, obstacle
x - Object 3, inflow
y - Object 4, outflow
And a cube as the domain surrounding all of that. I have the default settings on all except for no slip and some velocity on the inflow and water on the domain for viscosity. When I bake the domain just stays a cube. What would cause this?
The blender file:

Could you upload your .blend file to here?

@ShadyPuck done.

Share the file just to make sure, but you can try to set the volume initialization on all the objects to both, and make the domain object larger.

One of those seemed to have done it

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Why are my keyframes not visible in the timeline?
I'm practicing on camera movements based on a tutorial by polyjord and I noticed that my keyframes are missing in the timeline at some point:

Q: How do I get my keyframes back?

Maybe this can help ? https://blender.stackexchange.com/questions/178287/hidden-keyframes-in-timeline

EDIT: I guess the comment by @Gorgious is what you're experiencing. If not, try this solution:
If you've enabled the option Only Show Errors in the View menu of the Timeline window, than your keyframes will not show up unless there is an error.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Geometry Nodes - Point Cloud from custom XYZ coordinates?
I'd like to create a point cloud using the Geometry Node Editor based on my own custom data.

The data is stored in a .txt file, plain [x,y,z] coordinates and looks like this:
v1 : 1, 2, 1;
v2: 1.5, 2, 0;
v3: 0, 2.5, 2;
v4: 1.2, 2, 0;
etc.

I also tried a python script to import the vertices, which is working fine but I don't find a way to use it for Geometry Nodes.
Q: Is there any way to create a point cloud based on the given data to make use of Geometry Nodes features in order to further manipulate the point cloud?

Related: https://blender.stackexchange.com/questions/76535/create-model-from-xyz-data-points

If the data has been imported as vertex per coordinate, it's technically a point cloud already. Just wondering what's your question...? Do you'd like to visualize the point cloud?

Yes, I want to visualize point cloud. I have few coordinates [x, y, z]. My expectation is that I will create Point Cloud like it is in Blender 2.93 (Cube with random points) and every point will belong to my coordinates [x, y, z].
Then I will continue in Geometry Node Editor where I want to set to every point in cloud different object.
The problem is that I dont know how to create Point Cloud from my vertices instead of random points.

See: Is it possible to render vertices in Blender?. Again, a set of vertices is a point cloud, goal achieved. Suggest add your comment to the question.

Thanks. I have problem when I create Point Cloud (Experimental in Blender >2.92) that  the points in cloud are distributed randomly. I want to have them in positions which I set)

Don't know this feature but if they are distributed randomly, it's obviously not the right feature to use. I'd suggest import them using python, see my first comment. Otherwise please edit your question, share your data and explain in detail what your goal is, thanks.

oki, I will describe it better with my data

I want to create Point Cloud like this:
https://imgur.com/a/OMGf1bb.jpg
The points inside have some coordinates [x, y ,z].
I have my own coordinates:
v1 : 1, 2, 1;
v2: 1.5, 2, 0;
v3: 0, 2.5, 2;
v4: 1.2, 2, 0;
etc.
I want to set points in cloud to my coordinates via Python script.
I need it like this, because then I am using Geometry Editor.

Ok, I think I am finally getting close:
bpy.ops.object.pointcloud_add(align='WORLD', location=(0,0,0), scale=(1,1,1))
obj = context.active_object
for i in range (0, 35):
obj.data.points[i].co = (0,0,0)
v = obj.data.points[30].co
print(v)

I have edited the question for you. If something is wrong, please correct it. Also please  add what you call the "Geometry Editor". Do you mean geometry nodes by that?

Thanks. I mean Geometry Node Editor

I have edited the question for you again. Instead of comments, please use the [edit] link at the bottom of your
question (https://i.sstatic.net/lXFuK.png) to add information to
your post.

I've been working on this problem lately as well, If you have the points as vertices you can use something like this node setup to get a renderable point cloud
In case you find it useful I've put together an addon blender_plots which automatically generates such node trees from numpy arrays and also supports adding a different color to each point

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How to get a vector type from a FloatVectorProperty?
How do I get the mathutils.Vector from the FloatVectorProperty in a python script? Sometimes it works other times I get a type mismatch:
import bpy
import mathutils

prop_vector = bpy.props.FloatVectorProperty(default=(1,2,3))
print(prop_vector)

util_vector = mathutils.Vector([1,2,3])
print(util_vector)

prop_vector + util_vector

This gives me this output:

Q: How do I get a vector type from that property?

Set the subtype of a FloatVectorProperty to eg. Direction in order to get a vector: https://docs.blender.org/api/current/bpy.props.html#bpy.props.FloatVectorProperty

I've tried several subtypes and my prop_vector is still a two component tuble. I think I read somewhere that I could write list(prop_vector) or something, but this didn't work for me either.

I think @batFINGER did a good job explaining it... added the test for my comment to his post. Another good reason why providing your code is necessary ;)

Incorrect usage.

Property Definitions (bpy.props)
This module defines properties to extend Blender’s internal data. The
result of these functions is used to assign properties to classes
registered with Blender and can’t be used directly.

In python can set up a property on some class Foo with
Foo.prop = property(getter, setter)

the property definitions module is doing much the same for blender classes, with added goodies for UI etc.
>>> bpy.types.Scene.prop_vector = bpy.props.FloatVectorProperty(default=(1,2,3))
>>> C.scene.prop_vector[:]
(1.0, 2.0, 3.0)

Notice it is a tuple the size of the vector property (default 3).  To make it of vector type
v = Vector(C.scene.prop_vector)

Also consider to set the subtype of the FloatVectorProperty to eg. Direction to get <class 'Vector'> out of the box.  DIRECTION will typecast it to a vector but assign it no units.  For a translation use 'TRANSLATION` to put the lengths in chosen scene units (eg millimeters, inches).  See also the unit property
Generic XYZ vector
>>> bpy.types.Scene.foo = bpy.props.FloatVectorProperty(subtype='XYZ')
>>> C.scene.foo
Vector((0.0, 0.0, 0.0))

Following demo is based on operator_simple.py template:
import bpy
import mathutils

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    def execute(self, context):
        # Print type to console
        print (type(context.scene.my_vector))
        # Vector addition demo
        print(context.scene.my_vector + mathutils.Vector((1, 2, 3)))
        return {'FINISHED'}

def register():
    bpy.utils.register_class(SimpleOperator)
    bpy.types.Scene.my_vector = bpy.props.FloatVectorProperty(
            default=(1, 1, 1),
            subtype='DIRECTION')

def unregister():
    bpy.utils.unregister_class(SimpleOperator)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.simple_operator()

Aah. I think I get it now. I completely misunderstood what properties are. Thanks a lot! So if I want a sort of global variable I can add a FloatVectorProperty to bpy.types.scene, which I can then access acces via  bpy.data.scenes['Scene'].Vector (although this is actually an array)

Or in an operator I can use context.scene.my_vector. This really helped me a lot!

or workspace.  Use window_manager for session globals.

Ok Thanks! I'll keep that in mind


text:
The intersection part of a plane
I have a cube sliced by a plane:

I would like to get the part of the plane inside the cube. So I figured a boolean modifier would the trick. Whether I apply it to the cube or plane or chose union, intersect or difference I always end up with some 3D object - some part of the cube. I would like to have only the plane part of the boolean.

Not spot-on, but maybe this helps?

Yeah it close. I did look at the knife tool too. But this solution seem to require the both object belong to the same mesh. I'm not sure how to do this.

I'm not sure why it's not working for you. I took a cube, gave it the Boolean modifier set to Intersect and selected the plane as the other object. The result is the part of the plane that's inside the cube. Of course you have to make the original plane invisible, otherwise it will obstruct the view on the resulting boolean object.

Following @Gordon Brinkmann's comment, in Blender 2.9x, using the 'Fast' Boolean option, (the modifier assigned to the plane,) it seems to work OK, here:

...across the angles.

But 'Exact' seems to fail; it includes the volume in the cube behind the plane's normal.

Thank you! Just what I wanted... Seems like a bug.

nice animation by the way ;-)

Yeah, that's my setup only that I assigned the modifier to the cube - but on intersect it doesn't matter which object. Should not only work with Fast but Exact, too. I didn't give it as an answer because that's just the normal way to use the Boolean modifier...


text:
How to hook a vertex of a curve to a certain object?
I'm trying to hook a curve vertex to an object and this method works perfectly:
bpy.ops.object.hook_add_selob(use_bone=False)

The problem is when I try to do this from python. I have to select the object, which can be done. But the operation seem to imply that the vertex is the active object or something? Is there a way around this in python or can I setup the hook directly via class-access bypassing the operation entirely?

I can see that it made a modifier on the curve. But I can't see how this modifier works only for the vertex. If I add a modifier manually and set the object as target, nothing happens.

If you know the objects by name (names are unique), you can get them by global data access:
curve = bpy.data.objects["BezierCurve"]
hook = bpy.data.objects["Empty"]

Or even better per scene in context if you'd like to turn this into an operator later on:
curve = bpy.context.scene.objects.get("BezierCurve")
hook = bpy.context.scene.objects.get("Empty")

To add a modifier to an object, with its name and type:
modifier = curve.modifiers.new("Hook", 'HOOK')

Then the modifier has its own specific attributes and methods
For hook, as described here:
The target object:
modifier.object = hook

And the hooked vertices. a bezier curve handle has 3 points, so you can set indices with:
handle_index = 0
index_from = 3 * handle_index
index_to = index_from + 3
modifier.vertex_indices_set( range(index_from, index_to) )

All together:
import bpy

curve = bpy.data.objects["BezierCurve"]
hook = bpy.data.objects["Empty"]

modifier = curve.modifiers.new("Hook", 'HOOK')
modifier.object = hook

handle_index = 0
index_from = 3 * handle_index
index_to = index_from + 3
modifier.vertex_indices_set( range(index_from, index_to) )

Spot on! Thank you!


text:
Create a surface within bounding curves?
EDIT: My example was misleading. I don't want to use polys/faces. Please see the example of how this is done in Maya:

My first example didn't make it clear that I want to influence the way the "bridge" is formed by the other bounding curves. Is there not a way to do this? Curves can be used to define a bevel (which creates a surface) but it seems there is not a way to model like this. Please let me know if you know of a way to model like this using surfaces or something other than polygon faces. Thanks!
Original:
I am trying to make a car using curves. How do I create an interpolated surface between them? (How to I patch them together?)
Here's a simple example. I have these two curves:

Here's a mockup of what I mean:

I've done this in Maya, and here's the user-guide page on how to do exactly this. (click here) There has to be a way to do this in Blender. I just have to believe! ;)
Thanks for your help!
-Ben

A curve and a surface are actually two different object types. You can't add a surface to a curve only object. As mentioned in other answers you can convert your curve to a mesh and add faces to it. If you want to do your modelling with a surface object, you will need to add a new surface object and start again.

You can create some shapes using surfaces. However, if the curve exhists already I think you can use it only as a reference.

Related: http://blender.stackexchange.com/questions/1503/how-to-make-uv-loft-like-3ds-max-in-blender-using-curves

Add a Curve (Shift+A-->Curve-->Bezier) and model the first profile being in Edit Mode. When finished, select it (A), duplicate (Shift+D) and place as far from the first one as you want. Model the duplicated second profile as you like.

Go to Object Mode, change the curve's resolution (Preview U and Render U) to 3, then select it and press Alt+C-->Convert to Mesh.

Go to User Preferences (Ctrl+Alt+U) and enable the F2 add-on.

Select two vertices as pictured below and press F continuously to fill the gaps.

Add a Subsurf Modifier to the mesh to make it look smoother. Enable a Smooth Shading in the Edit panel of a Tool Shelf (T).

As pdlarry suggested, Brige Edge Loops operation works better and faster than F2 add-on. And you have some extra options when you use it: http://www.gfycat.com/WetEmbarrassedIlladopsis

I edited my original post to clarify my question. I am wanting to know how to model without polys/faces, just using curves. Much like you can create two curves and use one as the bevel object of the other (creating a "surface") I wonder if there is a way to make other surfaces out of curves that I can control and model with aside from just bevels. I've noticed the "NURBS" surface option, but I can't control NURBS the same way.

@Ben Mora, please see this related answer: http://blender.stackexchange.com/questions/1503/how-to-make-uv-loft-like-3ds-max-in-blender-using-curves It may be what you're looking for.

Thanks for this!! This got me out of my banner creating jam!

If the two curves have the same number of vertices, you could, in Edit Mode, select both curves and then Mesh->Edges->Bridge Edge Loops.

True. Convert curves to meshes first, as Gonzou suggested.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Rotate the result of a mirror modifier
I am making a tire. The treads on the left and right side of the tire need to be offset from each other, ie, rotated about 10 degrees.
Is there a way to rotate the result of a mirror modifier? I tried using an array modifier with the array object being an "empty" that is scaled -100%, but the result is an inverted side.
Here is the half I have:

Here's the mirror result:

And here's how I want the mirrored portion to be rotated:

The way I produced this result was by applying my modifiers, but I need to be able to rotate the mirrored half without applying, if possible.
EDIT: I thought I was onto something when I realized that you can mirror using a  "mirror object", and the mirrored half will rotate when you rotate the mirror object, HOWEVER, it will only rotate in the other two axis: If I mirror over the X axis, I can only rotate the resulting half on the Z and Y axis. Seems like that should be an update to the feature.
EDIT 12-22-15: My workaround:
What I hoped to accomplish was to model an entire tire by simply only making the mesh for 1 tread on 1 half of the tire and using modifiers for the rest. That doesn't seem doable. For now at least, I modeled 2 treads, 1 on both sides of the tire, and will array that.

I'm curious to know what your purpose is. I needed tires of particular sizes (the one pictured is a 385 95R25, and I also need another slightly larger tire for models of heavy construction equipment. I decided this was a good project to use to improve my knowledge of modifiers, in particular, the array modifier). Is this the case with you, too, Ben? Otherwise, I'm wondering what is wrong with the blend in the third image edited into your post?

There's nothing wrong with the one I produced in the third image as far as the end-result goes, but I am preferring to use modifiers without "applying" them, which is what I had to do to get that result. I am asking primarily because I know there are always better or more creative ways to do things, and I think if I can use modifiers to make a truly uniform and symmetrical tire, it would be the most efficient and least destructive method, but would also be useful information for future use on who knows what else. I will edit the original post to show my work-around.

I just had the same problem. I found a really good solution here: https://blender.stackexchange.com/questions/51068/how-can-you-change-the-rotation-of-a-mirror-modifier/51108 it's basically just about using the array modifier instead of the mirror and an empty to control the rotation (in any axis)

Ben, no the mirror modifier only produces symmetry across a plane; there is no way to rotate. One approach I used to model a tire was to model a strip across the entire width of the tire, and use an array modifier around an empty to arrange the instances of the array around the center point. The bit of the tread I modeled is outlined in white.
.
I should note that I only modeled the raised parts of the tread, and not the side wall or base; these were a separate object.
This technique worked, but the results were unsatisfactory because I was modeling a real tire, and it turned out that the different strips around the tread did not have the same size; the left three parts of the thread occupied a smaller part of the radius (1/48th of the radius, as I recall) than the right two parts (1/40th of the radius), so what I wound up doing is modeling the tread pattern as two different bits, the three left in on bit, the two right in the other, and applying the two different segments around the body (the sidewalls, and base of the tread), as in the illustration, where I've rotated the tire body, and highlighted the two segment arrayed object for illustrative purposes.

I'm trying to use the mirror modifier to keep both sides symmetrical (and editable). I am already modeling 1 strip of the tire and making an array all the way around for half of the tire, at which point I am mirroring the whole array for the other half.

Well, the mirror modifier will keep both sides symmetrical across the plane, but only one side will be editable. If you want to edit both sides of the tire, you can do so after applying the mirror modifier.

I figured out that you actually can rotate the result of a mirror modifier by using and rotating a "Mirror Object" , however you can not rotate in the same axis that you mirrored across. For instance, I have modeled half of a tire...

...and mirrored it across the X axis using an "empty" as the "Mirror Object":

At this point you may rotate the Mirror Object on either the Z axis...

...or the Y axis...

...but not the X axis, since that is the axis used for the mirror modifier. The same holds true if I was to mirror across the Z axis, I would be able to rotate in the X or Y axis, but not the Z axis. I thought I could be tricky and mirror over the Z or Y axis and use a combination of the other two eligible axis to create the rotation of the mirrored half that I desire, but alas, it is not possible to arrive at the desired rotation like this:

*Note, the above is my workaround where I had to apply the mirror modifier before rotating it manually.


text:
Array instance offset variance
I have a 3D stack of tiles that is actually 1 tile with an array modifier creating the instances offset to form a pile.

Is there a way to make each instance have it's own random variance in the X and Y axis and in Z rotation so that it is a realistically more chaotic imperfect stack, without me having to "apply" the modifier and manually nudge each tile around?
This would be great so that I could adjust the "Count" and each new tile would automatically be randomly slightly different placement than the one below it.
Here is the desired look:

I don't know how to do that and keep it in an array modifier, but here's a workaround: Drop the array and duplicate the tile in the Z direction. Select the tiles you want to randomize, then go to Object > Transform > Randomize Transform. The controls will appear in the toolshelf T.
Also:
There was some activity toward improving the existing array modifier in this way a few years ago, but it never got to the trunk.
Here's the story on Blender Nation: http://www.blendernation.com/2012/01/05/advanced-array-modifier/
And here is a build for it on GraphicAll: http://graphicall.org/537
You could model with that, apply the modifier, then continue working in your preferred version.


text:
Having a hard time understanding "Rotate & Scale" "Apply an objects transformation to it's data"
I'm new to Blender and purchased a course on Udemy--"Complete Blender Creator: Learn 3D modelling for Beginners". I'm having a hard time wrapping my head around "Rotate & Scale" "Apply an objects transformation to it's data". I know how to do it, but the instructor doesn't go into much detail. What is it's purpose? Would someone mind explaining it to me like I'm five?
Thanks

You might consider adding some more detail to your question.  Remember, a lot of people reading/answering your question will not have seen that course (or any Udemy course), and definitely won't consider paying and spending the time watching it just to answer your question.

Some info about Delta Transforms here - http://www.oneminutevideotutorials.com/2014/12/29/blender-understanding-delta-transforms/

You said "Apply an objects transformation to it's date" did you happen to mean data and not date?

To get your head round CtrlA applying transforms, I think it helps to separate the ideas of an 'object' and its 'mesh' (vertices). You can think of the object as a vehicle for its mesh.
Here's an object (the yellow axes,) sitting on the World Origin. Its mesh is a cube.

The numbers show the coordinates of the mesh vertices.
(To visualize an object, as here, you can switch on 'Axis' in its Object Properties tab, Viewport Display panel.)
Now here's the same object, translated a bit, rotated a bit, and scaled in Y, in Object Mode.

All the vertex coordinates are the same as they were before! Their locations are measured along the object axes; in the Object Space. It's the object which has been transformed. The axes have been moved,rotated and scaled. See how the Y axis has been stretched. Measured along those axes, the vertices are exactly where they were before.
Changing the locations of the vertices with respect to the object is what you do in Edit Mode. In Object Mode, you transform the whole object, and the object carries the mesh along with it.
Here are the locations of the vertices in World Space, (along the eternally fixed World axes) That is: the object-space locations of the vertices, with the further transform of the object added in:

CtrlA applying (all) the transforms of the object is baking the transforms of the object into its mesh, and returning the object to the World Origin:

You can apply the transforms individually, too.. applying rotation will align the object to the world, leaving its location where it was.. applying scale will return the object axes to length 1, and compensate in the coordinates of its vertices.. applying translation will return the object to the World origin, leaving its mesh behind.

great explanation!!

@Chris Thanks! It's hard to know, when you're a bit too familiar. People who can clearly remember their own confusion give better explanations. ( Also, IMO, the reason artists make some of their most exciting work when they're thrashing about a bit, and haven't quite learned how to use their tools. The great artists have learned how to forget.. :D )

YOU MADE MY DAY!!!!!!

I think "date" is a typo for "data".
In object mode, select an object.  A fast way of getting to the menu is control+A.
A wheel of options are opened such as "apply all", "apply scale", etc.
Before many operations in Blender, it is important to do this.  You should get used to doing this all the time.  It affects the smooth operation of modifiers and textures.
I don't understand the exact reasons for this, although it has do with many of the operations depending on the objects having a scale of 1 as the basis for various bits of code.  As you know, 3D programs depend on real world scale to make calculations.  So, when you start with the wrong scale it makes the math more complicated.
This can happen easily during modelling as you readjust the dimensions of the object to be correct.
The solutions to this is that, once you are satisfied with the dimensions of the object you can apply scale.

If you click "N" key, a bar will appear on the right side of blender. If you go to "Item" (with an object selected), you can see the location, rotation and scale values. When you apply scale, he changes the "Scale" values to 1 without changing the objects size. When you apply rotation, he changes the "Rotation" values to 0, without actually rotating the object.
Is this what you wanted to know?

Applying a transform alters the local data coordinates  Eg default cube has a corner at (1, 1, 1) locally, which if object scaled by (4, 4, 4)  that corner coordinate is global location  (4, 4, 4).  If I apply scale to the object scale is (1, 1, 1) and the local coordinate of the corner is (4, 4, 4)   ie the scale has been applied to the cube making it now a 4 times larger mesh than default cube at unit scale.  The global location of the corners remain unchanged. Feel the "answer" given above simply adds to confusion...


text:
How do I convert the module to script?
Change my python type from Module to Script?
In Blender #game engine

See https://blender.stackexchange.com/questions/21403/running-a-script-via-module-vs-script-mode-in-the-bge  and https://blender.stackexchange.com/questions/10769/what-is-the-difference-between-module-and-script-execution-methods-in-the-game-e IMO would use module.  Can you elaborate on why you wish to change?  It will involve editing the script, in which case post the script

Add these two lines at the end of the script:
cont = logic.getCurrentController()
main(cont)

The module mode calls specifically the function main through the entry point on the controller, while in the script mode you have to explicitly call the main function on the script. As the main function needs the controller reference, you get the controller and pass to it.
That's how you use a module as a script, however I would seriously recommend you to stick with the module mode: the script mode is A LOT slower than the module mode (as it is parsed at runtime) and the module mode provides much better options on code editing and organization.

Thank you very much!


text:
Radius of influence?
I'm on blender Currently in edit mode and am trying to create low poly maps. I did all the steps but I can't create a radius of influence3 that circle around your cursor which allows your chunks or fragments of my plane to grow together does somebody know how to create one?

To make the circle around your cursor bigger or smaller you use the mouse scroll wheel. Scroll up to make the circle smaller, and down to make it bigger. If for some reason the circle was much larger than the area in the viewport, or so small it isn't visible, you may not have realized it was there. It is possible to need to scroll for a while to make the circle come in range, if previously it had been used on a large area and now you want to use it on a small one.

thank you, this helped me out.

To activate/deactivate proportional edit in edit mode, use O.
Alternatively, use this toggle in the top bar of the 3D viewport

thank you, this helped me out.


text:
How to clip a grid of height points within a polygon base shape?
I'm very new to blender, but have some scripting background.
I have some height measurements for a surface. (z values for x,y coordinates)
I was able to use Python's scipy.interpolate.griddata to convert this into a grid of Z values. ( for lazy ones here the generated grid data https://pastebin.com/4xtuJgac )
With Create model from XYZ data points I as able to import this grid into blender.
However now I'd like to clip off everything, that is not within the x, y range of a specified polygon.
The scripts below show what I've done so far.
The first part I execute to generate my grid data with a small built in data set in a standard python executable.
from scipy.interpolate import griddata
import numpy as np

values = [ # sample data for Stack Exchange
    (2.32702550990507, 82.75699786003679, 27.789999999999992),
    (11.332438979996368, 14.02555966982618, 12.860000000000014),
    (0.7804978101048619, 75.70470666978508, 26.610000000000014),
    (2.2677287301048636, 75.15228118980303, 28.039999999999992),
    (18.682603270048276, 16.836770640220493, 12.919999999999987),
    (12.09464186988771, 17.609230670146644, 13.289999999999992),
    (5.603262080112472, 47.57122483011335, 21.53),
    (26.761874669929966, 16.459352959878743, 12.400000000000006),
    (9.299435199936852, 13.942597850225866, 12.580000000000013),
    (10.332293499959633, 14.73426689999178, 12.740000000000009),
    (5.753992310026661, 40.484739230014384, 18.909999999999997),
    (4.8296503101009876, 44.45012723002583, 20.22),
    (2.676168560050428, 76.70651125023142, 27.72),
    (12.363012589979917, 0.5158127900213003, 10.300000000000011),
    (6.900217070011422, 48.241429650224745, 22.24000000000001),
    ]

px = np.array([v[0] for v in values])
py = np.array([v[1] for v in values])
pz = np.array([v[2] for v in values])
x = np.linspace(int(min(px)), int(max(px))+1, 64)
y = np.linspace(int(min(py)), int(max(py))+1, 64)
X, Y = np.meshgrid(x,y)

gdata = griddata((px, py), pz, (X, Y), method="nearest")

with open("gridpoints.csv", "w") as fout:
    for ix, row in enumerate(gdata):
        for iy, val in enumerate(row):
            fout.write("%f, %f, %f\n" % (ix, iy, val))

Here the blender code to import this grid data. ( https://pastebin.com/4xtuJgac if you don't want to create them with above script)
import os
import csv
import bpy
from operator import itemgetter

MYDIR = os.path.realpath(os.path.dirname(__file__))
csvfile = open(os.path.join(MYDIR, "gridpoints.csv"))
inFile = csv.reader(csvfile, delimiter=',', quotechar='"')

# Read and sort the vertices coordinates (sort by x and y)
vertices = sorted( [(float(r[0]), float(r[1]), float(r[2])) for r in inFile], key = itemgetter(0,1) )

# ********* Assuming we have a rectangular grid *************
xSize = next(i for i in range(len(vertices)) if vertices[i][0] != vertices[i+1][0]) + 1  # Find the first change in X
ySize = len(vertices) // xSize

polygons = [(i, i - 1, i - 1 + xSize, i + xSize) for i in range( 1, len(vertices) - xSize ) if i % xSize != 0]

# Generate the polygons (four vertices linked)
name = "grid_unclipped"
mesh = bpy.data.meshes.new(name)  # Create the mesh (inner data)
obj = bpy.data.objects.new(name, mesh)  # Create an object

obj.data.from_pydata(vertices, [], polygons)  # Associate vertices and polygons

# obj.scale = (1, 5, 0.2) #Scale it (if needed)
for p in obj.data.polygons:  # Set smooth shading (if needed)
    p.use_smooth = True

bpy.context.scene.objects.link(obj)  # Link the object to the scene
# or for 2.8
# bpy.context.scene.collection.objects.link(obj)

and here the x,y coordinates of the polygon section, that I'd like to use for cropping.
section = [
    ( 9.5500, 14.3610),
    (38.1858, 17.4571),
    (35.2338, 44.5318),
    ( 5.7485, 41.6682),
    ]

# This is where I don't know how to proceed

Addendum 2019012012:
. Meanwhile I created the polygon within blender with following code.
    name2 = "bounding_poly"
    mesh2 = bpy.data.meshes.new(name2)  # Create the mesh (inner data)
    obj2 = bpy.data.objects.new(name2, mesh2)  # Create an object

    vertices = list((x, y, 0) for (x, y) in section)
    edges = []
    for idx in range(len(vertices) - 1):
        edges.append((idx, idx+1))
    edges.append((len(vertices) - 1, 0))
    polygons = [tuple(idx for idx in range(len(vertices)))]

    obj2.data.from_pydata(vertices, edges, polygons)  # Associate vertices and polygons

    bpy.context.scene.collection.objects.link(obj2)  # Link the object to the

Afterwards I enter edit mode and extrude the polygon to create some kind of prism (almost cube shaped)
But now I still don't know how I could do the clipping.

If nobody has an idea, I might try to just delete all polygons whose x,y are outside of the bounding polygon. This is of course less elegant than a clean crop, but could give a first approximation.

...it's quite possible.. just a couple of questions for a programmer that might come along.. Are the cropping polygon points ordered? Is it always a rectangle? If not, do you want the crop to follow the polygon's edges, or the edges of its bounding box?

Thanks @Robin Betts . Ideally  the solution would work with n ordered points (n>= 3) and even the sense (clock wise or counter clock wise if seen from the z axes) can be be predetermined. The cropping should follow the polygon edges.
At the moment I'd even be happy enough with a solution, that works only with four points and that could even be approximated with a rectangle.

One approach might be to make repeated use of the bmesh  bisect plane operator, once for each edge of the poly. I can't get to it right now, maybe someone else will...

another thing (but have to see how to do this as script) mgiht be to create a mesh (one flat surface of the polygon), then protrude it high and low enough in z direction and intersect my grid with this polygon prism. Have to see if that is viable.

still looking for an answer.

Boolean intersection modifier

another thing (but have to see how to do this as script) mgiht be to
  create a mesh (one flat surface of the polygon), then protrude it high
  and low enough in z direction and intersect my grid with this polygon
  prism

Yes that would be my take on it. Create a prism then use the boolean intersect modifier.  Example picture shows result after running on simple z displaced grid dem.
The prism is an extruded ngon.
Adding and applying modifier in the python console, grid object has context.
>>> o = C.object
>>> bm = o.modifiers.new("BM", 'BOOLEAN')
>>> bm.object = C.scene.objects.get("Circle") # the prism
>>> bm.operation = 'INTERSECT'

>>> bpy.ops.object.modifier_apply(
modifier_apply()
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="")
Apply modifier and remove from the stack
>>> bpy.ops.object.modifier_apply(modifier=bm.name)
Info: Applied modifier was not first, result may not be as expected
{'FINISHED'}

Note first modifer re warning is a displacement modifier to make DEM and can be ignored.
Script to product the section.  Set the z and the solidify thickness based on max / min range of z from input grid data. simply hardcoded as 40 per example
import bpy
context = bpy.context
section = [
    ( 9.5500, 14.3610),
    (38.1858, 17.4571),
    (35.2338, 44.5318),
    ( 5.7485, 41.6682),
    ]

verts = [(x, y, 40) for x, y in section]
faces = [list(range(len(section)))]

me = bpy.data.meshes.new("Section")
me.from_pydata(verts, [], faces)

ob = bpy.data.objects.new("Section", me)
ob.display_type = 'WIRE'
context.collection.objects.link(ob)
sol = ob.modifiers.new("Sol", 'SOLIDIFY')
sol.thickness = 40

And can confirm this works as described on input data

@RobinBetts bisect plane  would be easy to implement as long as the poly is convex.

thanks a lot. Well this is what I tried, but something must be wrong either with my polygon or my grid.
Also (probably not related to the issue, but who knows) how do you have the surface non transparent, but the polygon in wireframe? For me either both are with surfaces or both are displayed as wireframes.
Will continue investigating when back from work

Properties > Object Properties > Viewport Display

...@batFINGER ..I was thinking some kind of point-in-polygon test first.. external algorithm, or maybe by using Blender's own BVH, and ray-casting down an orthogonal view? ..then bisecting .. then tagging new geometry if on edges of the clipping polygon. All a bit scrappy, though.


text:
I accidentally dragged the timeline, and now it covers the entire screen. how do i put it back?
Im new to blender, I accidentally dragged what i think is the animation timeline at the bottom of the screen upwards, and now It covers the entire screen. I dont know how to put it back, I tried dragging down from the top but it doesnt work. Please help.

Rather than add solved to title, mark an answer from those below, or add your own, as accepted.

You can put your mouse over the area border and press right mouse button, then select Split Area, and just move the split line to the proper place, and click. This should split the area to two identical areas. Next step is to change the upper area to 3d View (for example). Move your mouse there, and press Shift+F5.
To clarify, look at those pictures I prepared for you.
First, target your area border. This is easily found on horizonal or vertical area borders, where there are no other elements.

Next, press right mouse button. It should open the menu like this pictured below.

If you manage to open the menu, you are good to go. Just select appropriate option, which should split the area for you. Note, that you can change your mind and split the other way - either horizontal or vertical, just by pressing middle mouse button, when in "splitting mode". You will get the splitting line which looks like this:

If you want to split the area, press the left mouse button. The split will be done and you will get the same areas on both sides. This is the end of part 1.

Now, in order to enable any other area type in the upper part of the screen, move your mouse to it's center. It's important to not point anything substantial, no buttons, no panels, just the plain central area. Then you can press Shift+F6 to switch to 3D View. Or you can press any other combination: Shift+F1 (file browser), Shift+F3 (node editor), Shift+F9 (outliner), etc. Just name a few.
Note that in every area on the screen, you can find an "ICON" to change the view type. It is usually located in the left upper or bottom corner. Look carefully. I enclose few screenshorts of such icons for you to give some hints.

hey this is what i was looking for, thanks

thank you, please mark this as solved

I don't know how

Hit the green checkmark in column to left of answer.

You can just change the Editor Type.
Or, if you want more editors side by side, drag the tiny corner to split the area.
Change the editor type or split the area.

I think you should be able to go to the top and with your mouse just drag it back down again. If that doesn't work there's always the option of loading the last save.

"I tried dragging down from the top but it doesnt work."


text:
How to set quaternion rotations for bones in Blender Python
I'm working on an import script and I am getting stuck on doing armatures properly.
So far I have been creating edit bones and I have it mostly looking correct, but while the directions that the bones are pointing in are correct, their roll rotations are wrong. And that is quite important.
Is there any examples of how to do this properly? Should I use pose mode instead? Would using pose mode screw up vertex weights when I get to that part?
Could someone show me a code snippet of how to properly set positions and rotations for bones for an import script?

So, in the end I ended up creating the bones using new() then I converted by absolute rotation to matrix and transformed the bone by that. Then after that I added the absolute position to both the head and the tail of each bone and that got me the correct result.
    for i, node in enumerate(jms.nodes):
        scene_node = edit_bones.new(name=NODE_NAME_PREFIX+node.name)

        # Assign parent if index is valid.
        scene_node.parent = scene_nodes.get(node.parent_index, None)

        # If a node has multiple children we cannot connect its tail end
        # to the children.

        pos = absolute_transforms[i]['translation']
        rot = absolute_transforms[i]['rotation']

        # Bones when created start at 0 0 0 for their tail and head.
        # We extend the tail so it sticks out a bit and signifies the direction.

        scene_node.tail = (scene_node.bbone_x, 0.0, 0.0)

        # We then rotate the bone by the absolute rotation that it should have.

        scene_node.transform(rot.to_matrix(), scale=False)

        # Then we add the absolute location to both the head and the tail.

        scene_node.head += Vector(
            (pos[0] * scale, pos[1] * scale, pos[2] * scale))
        scene_node.tail += Vector(
            (pos[0] * scale, pos[1] * scale, pos[2] * scale))


text:
bpy.ops.sculpt.brush_stroke Incorrect context when called using the bpy module in headless mode
I have been trying to sculpt a mesh using the Python API (v2.83), running via the bpy module in headless mode. So far, I can render the mesh as is, but as soon as I try to use bpy.ops.sculpt.brush_stroke() I get the RunTimeError:

RuntimeError: Operator bpy.ops.sculpt.brush_stroke.poll() failed, context is incorrect

The following are the contents of my bpy.context:

Note that I have set the mode to "SCULPT", and would like to sculpt the "Body" object. Inspecting the contents of bpy.context.area, it is None. Should it be "3D_VIEW", and how to change it since bpy.context.area is read only?
Thank you in advance.

See: poll() failed, context incorrect?

There is no UI in headless mode. This is why area, space_data, region are none. If the operator needs a UI element to poll, then AFAIK there is no way around it.

bpy.context holds some information about the current windows and open views which is needed by bpy.ops.sculpt.brush_stroke and not available in headless mode. Take a look at this example here to see how to use brush_stroke() without headless mode. If you use Blender on a machine which doesn't have a graphical user interface, you could use a virtual frame buffer (see here).


text:
Object with curves sliding when animating
i am trying to animated a object with a lot of separate parts including objects that is linked up with curves.
at first the animation looks good, but when the object moves the object linked to the curve is sliding.
i have tried to apply the curve modifier to the object, but when I do the object just straights out.
here is a video describing the problem:
https://youtu.be/UW15utlcF4w
i want the object to stay solid when animating, I have tried joining the objects but with no luck.
is there a way to apply the curve to the object? that should solve the problem.
thanks in advance

Hello and welcome. While files, images, and external videos or links may be helpful additions they should not be the only way to obtain information about your issue. Don't make understanding your question rely on downloading a file, watching a video or visiting an external site. Use the builtin tools to upload images or gifs, along with thoroughly explaining the problem in written form so it can be indexed and searched for thus helping future visitors with similar issues.

Maybe parent both the object and the curve to the main shoe object? Or apply the Curve modifier? You can share your file here: https://blend-exchange.com/

I tried applying and parenting, but none of them worked. can´t upload more than 30 MB to the link you sendt. This we-transfer link should work instead: https://we.tl/t-v0exMFPnwM

i figured it out. I just had to apply all the modifiers from top to bottom and apply the curve modifier as the last modifier.


text:
Is there any way to input a definite integral into blender?
For a calculus hw assingment I am trying to have a sin wave rotate over an axis, is there any way to do this or input a definite integral into blender? Like the image.

Sure is! Your best bet would be to use geometry nodes. With them you can easily define mathematical expressions and map them onto a curve. Sine function is actually already part of math node so less work for you.

You can then revolve it around the X axis (or whatever axis you want). This can be done either nondestructively using the screw modifier, or destructively using revolve tool (but you have to apply the geometry nodes first). You can also do it using the geometry nodes alone but that is more complicated and it has already been answered here: revolve/screw using GN


text:
Use armature to pose nested meshes without inner mesh showing through
I created a blue hollow box mesh object with another red box-shaped mesh object inside it. I added simple surface subdivision modifiers to both. Then, I added an armature and CTRL-P to parent the armature to both of the objects selecting "armature deform with automatic weights."

Scene:

Then, I went into Weight Paint mode and painted weights for each bone in the armature for each of the meshes.

However, often when I pose the armature, the red inner box shows through the blue hollow box. This is true even if I apply the subdivision modifier with lots of subdivisions.

I would like both objects to deform together no matter how small on the z-axis they are (how thin they are) so that the red inner box never shows through the blue hollow box.
Is there a way that I can achieve this in Blender?

You could try a Mesh Deform cage. That's an invisible object (=disabled for render). In the screenshot, it's the wireframe cube. It is a child of the armature and is deformed by it. The cube objects inside have a Mesh Deform modifier on them and the cage will deform them with help of this modifier. Bind them with the button when the armature is in the rest position.


text:
emitting particles from the ends of hair curves
I'm trying to create a "poof" of particles on impact from the end of a cosmetic brush.
I've faked it but I want to be able to use weight mapping on the curves to generate the particles, then release them when the brush hits another object in the scene.
2nd question: I can not seem to paint the root of the curves. any reason for that?
Thanks!
photo for example (not a render) (that might be obvious)

Hello and welcome. Please don't ask more than one question per post. Use the [edit] link below your post, to break this into multiple posts so that each focuses on a single issue. Make as many separate questions as necessary.

As a very simple approach you can try adding another object (e.g. a plane or something simple like that), make it a child of the object you want that particles to be emitted from, adjust "emitter plane" location and you'll get your particles emitted from wherever you want.
Obviously emitter object would need to be hidden in this case.


text:
How to create array of alternating colour patterns (blue and white) with the first and last being a third colour (red)
I am trying to replicate a swimming pool lane divider (see picture). I have created a sequence of the two main colours (blue and white) using a checker texture node but I don't know how to make it so that the first portion and last portion of the divider is coloured in red.[

What is first and last portion of the divider?

Hi Martynas, thanks for your answer! The first and last portion of the divider are red, so the sequence is: RED- WHITE-BLUE-WHITE-BLUE-(...)WHITE-BLUE-RED.

You could use a Color Ramp node to define the colors and Math node in Modulo mode to repeat the pattern:

Note that Generated texture coordinates depend on world distances so the numbers depend on your object size and will be different for your situation.
Also, this is only one way to do this, there are probably hundreds of other ways that are just as good.


text:
Export collection and set FBX file name as collection name?
How difficult is it to make a selection by collection and set the FBX file name as the collection name?
import bpy
bpy.ops.object.apply_all_modifiers()
bpy.ops.object.join()

scn = bpy.context.scene
sel = bpy.context.selected_objects
meshes = [o for o in sel if o.type == 'MESH']

for obj in meshes:
bpy.context.view_layer.objects.active = obj
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.quads_convert_to_tris(quad_method='BEAUTY', ngon_method='BEAUTY')

# bpy.ops.mesh.flip_normals() # just flip normals
# bpy.ops.mesh.normals_make_consistent(inside=True) # or recalculate inside
bpy.ops.mesh.normals_make_consistent(inside=False) # or recalculate outside

bpy.ops.object.mode_set()
bpy.ops.export_scene.fbx(filepath="../geometry_result/name.fbx", path_mode='RELATIVE', use_selection=True, object_types={'MESH'})
# bpy.ops.ed.undo()

Export all objects of a certain collection
Pretty much straight forward. Just pass use_active_collection=True argument when calling export_scene.fbx() operator and assemble your filepath using Collection.name:
import bpy

C = bpy.context

bpy.ops.export_scene.fbx(
    filepath=bpy.path.abspath("//{}.fbx".format(C.collection.name)),
    use_active_collection=True
    )

Note that all modifiers will be applied by default, no need to do anything.

Export selected objects of a certain collection
If you'd like to modify the mesh objects beforehand, you would have to select them anyway so just make sure the objects you want to export are selected and pass use_selection=True to the bpy.ops.export_scene.fbx() operator.
Demo on how export all objects of the collection in context having Cube in their name:
import bpy

C = bpy.context

# Deselect all objects
bpy.ops.object.select_all(action="DESELECT")

# Get the desired objects of the active collection
mesh_objects = [o for o in C.collection.objects if "Cube" in o.name]
for obj in mesh_objects:
    obj.select_set(True)

# Export the selection
bpy.ops.export_scene.fbx(
    filepath=bpy.path.abspath("//{}.fbx".format(C.collection.name)),
    use_selection=True
    )

Note that you can also pass a set of object types to the operator in order to export certain types of objects: object_types={'EMPTY', 'CAMERA', 'LIGHT', 'MESH', 'OTHER'}

Modify and export all mesh objects of a certain collection
As of 2.8x we can enter Edit Mode for all selected objects simultaneously, which avoids looping over all the objects as well as switching to Edit Mode and Object Mode each iteration. Also I'd suggest do not modify the original meshes, duplicate the objects you want to modify, edit and delete them.
Demo on how to duplicate all mesh objects of the active collection, switch into Edit Mode, convert the geometry into triangles, export the modified geometry to FBX and lastly remove all temporary objects from the scene:
import bpy

C = bpy.context

# Get all mesh objects of the active collection
mesh_objects = [o for o in C.collection.objects if o.type == 'MESH']

# If mesh objects list is not empty
if mesh_objects and C.mode == 'OBJECT':

    # Duplicate all mesh objects and get their references
    bpy.ops.object.duplicate({'selected_objects' : mesh_objects})
    mesh_dupes = C.selected_objects

    # Set one object of the dupes to the active object
    C.view_layer.objects.active = mesh_dupes[0]
    # Switch into Edit Mode
    bpy.ops.object.mode_set(mode='EDIT')
    # Select all vertices
    bpy.ops.mesh.select_all(action='SELECT')
    # Convert to tris
    bpy.ops.mesh.quads_convert_to_tris(quad_method='BEAUTY', ngon_method='BEAUTY')
    # Switch back to Object Mode
    bpy.ops.object.mode_set(mode='OBJECT')

    # Export the modified objects to FBX
    bpy.ops.export_scene.fbx(
        filepath=bpy.path.abspath("//{}.fbx".format(C.collection.name)),
        use_selection=True)

    # Delete all duplicates
    bpy.ops.object.delete({"selected_objects" : mesh_dupes})

Make sure the desired collection is active in the Outliner and run the script.

If you'd like to turn this script into an operator, have a look into:

How to create a custom UI?
Exporting multiple meshes individually at once
Export File Dialog in Blender 2.80
Batch exporting scene collections or selected objects using glTF-Blender-IO
...

Many thanks! Now everything works well, my last task is the team Undo, return the geometry to its original state and I will have a dream addon

I was in a hurry to rejoice, at the output I get a document in which all the geometry from the collection is located, but only the selected one is needed + I have a number of combination and triangulation commands, they began to be partially ignored.
Perhaps I would be satisfied with such an export
bpy.ops.export_scene.fbx('INVOKE_DEFAULT')
Only a very lacking team UNDO

@KasAndrr The provided code exports all objects of the collection in context. Make sure the collection you'd like to export is active, I guess your Scene Collection is the active one so the operator will export all objects. Recommend take your time, edit your question, explain in detail what else and post your code.

@KasAndrr: Please consider to accept the answer. How this site works: https://blender.stackexchange.com/tour


text:
Is it possible to distribute points based on height?
Is it possible to distribute points in the geometry nodes based on height like it is with colors in the material nodes?

I have this terrain and want points distributed on the blue color. I don't think its possible to have the color as a weight so I thought to just replicate the same node process in the geo nodes

but that doesn't seem to work either since the density only works if I use an attribute. any suggestions?
this worked:

If you wanna post images, you should just paste them in here. And please post images we can read. And not that low quality that we can’t read anything.

I didn't know links weren't allowed. But i don't get your issue with the resolution? If you click on the image you can read it just fine. Rhe issue is with this website showing the images in small windows. It is the exact same resolution as i see it in blender. i could have zoomed in on the landscape but the datails of it aren't that important. but on the nodes i dont know how i could have increased the res while still showing everything.

Now quality is great. Thank you

Question: why do you think that is is impossible to use the color as weight?

"Now quality is great. Thank you" i changed nothing lol
but i think i figured something out, i thought it was impossible because i couldn't find anything after like 15 min of searching

did you try it with "color ramp attribute"?  Attribute -> attribute color ramp ?  and yes, that's why it's called "density attribute"

So i am happy i could help. A "thank you" would have been great. But every person reacts on another way when people helped them. Some "sell" it like they solved it on their own. But maybe then the helping person might not want to help you anymore if you have another question. And commenting with "lol" isn't very respectful either. The quality was totally bad before. Only because you can't see that doesn't mean other people see something different.

Please don't write solved as part of the title. If you found a
solution for your problem please write it on the
answers section and mark it as accepted there. Read:
what does it mean when an answer is accepted?

You can use the object space Z coordinate of geometry as an attribute to influence other attributes, if you split it out of the given position attribute. Here, it's called pz.

In this case the .5->1 range is soft-mapped to 0->1, and the 1->1.5 range is soft-mapped to 1->0. The results are put into h_pz and l_pz. When the minimum of those is taken, it's a smooth 0->1->0 distribution, centered on Z=1.That's put into the d attribute.
That can be multiplied by some factor, and, in turn, used to control the density of a point distribution.


text:
Cycles - Can't Change Bake Target
I'm having an issue with baking a normal map. Steps to repeat (this is likely a bug, so may not be repeatable.)

I made a new material and assigned it to the model being baked.
I added Principled Shader.
I connect to Material Output. Principle Shader has NO inputs.
I place an Image Texture node, linked to a Normal Map I wish to update: "Player_Skin_N"
I select the Image Texture "Player_Skin_N", ensuring it is highlighted with a white box.
I bake the image.
RESULT: "Player_Skin_AO" receives the bake result instead. I have unlinked the data block, closed Blender, deleted and remade the only material using this texture, created an Assigned a new material. Nothing works. No matter what I try to bake, it goes to the same bake target "Player_Skin_AO" and I seem to be unable to deselect it (it's not highlighted or actively selected in node editor, and at this point, it isn't in ANY material in the project, or even on any node graph at all. It's just in memory somewhere.

But the short version: I can't get Blender to bake to anything except that single target.
Other attempt to fix the issue:
I duplicated tab "UV Editing" and deleted the original, hoping it might work (does when Sculpts stop rendering in Sculpt tab ocassionally.)
I have not found a way to continue working within this project as I can only bake to that same target, and nothing else.

Solution
I was able to fix this by doing the following:
Open Blender, WHILE it is open, rename the source file in my File Explorer (externally), then attempt to Reload the image in Image Editor.
This caused the image to become "uninitialized."
After doing so, I made new iterations of the same image, and can now bake to other Image Textures.
I do not know what went wrong. This is how I got around it, though. In case anyone else runs into this.

hello, could you please pack the images and share your file (keep it as simple as possible): https://pasteall.org/blend/

I apologize @moonboots I already de-initialized the image by the time I saw your reply. If you were looking to debug this I already scrubbed the file from the project. The solution tot he problem is in the OP now (won't help with debug, but is at least a known workaround now.) The image was an external import, as I was making topological changes to the model and just needed to "update" the maps.

You can add your solution as answer to keep this site organized. After 2 days you even can accept your own answer.

I was having a similar problem on blender 3.2.
It baked to two textures simultaneously, the one I selected and some other texture randomly.
I finally realized it had to do with having two material slots.  The "bake to" texture was an image texture node of the first slot, but not the second.  It was baking to the first node I had put in the second.  So, I copied the "bake to" texture node to the second slot and ensured it was selected.
It worked.

I was able to solve this by uninitializing the image being forced as the render target.
I did so by setting the image to "Single Image" referencing the external file, then renaming the file from the File Explorer (outside of Blender), then attempting to reload the image.
After the image became uninitialized, I was able to bake normally again to other images.


text:
Boolean intersect with all shape keys of target object
I have two objects, one lying inside the other, such that the outer object is like some kind of shell surrounding the inner one. I have a boolean difference modifier set to the outer object, its target being the inner one, so that the resulting mesh is just the area between the inner and outer objects. Think of it at a watermelon, the inner object being the red core, and the outer object being the green rind encasing it.
The inner object has shape keys, which are to later serve for animation.
What I want to do now is apply the boolean modifier permanently to the outer object, but I want the resultant mesh to retain the animation resulting from movement of the inner object.
In essence I have 4 shape keys in my inner object, and I want to apply the boolean difference operation to the outer object 4 times, one for each shape key in the inner object, and have the resulting meshes stored in corresponding shape keys created in the outer object.
I hope I've been able to accurately convey what I'm trying to do.


text:
blender renders wrong portions of video strips
Here is the situation
I loaded several video files, edited the strips, did some cuttings, and made a sequence that I'd like to get rendered, added some audio files, did same kind of work on them.
But here is the thing, after I render this sequence, in the resulting file I get portions of video fragments that I cutted out while editing, And I don't see them in video view in blender.
What can be the reason for that?
blend file

You need to mute the original strips

could you upload a screenshot from your VSE?

@cegaton it's avi file

and btw all the audio strips were on 1 channel, then I made a meta strip from all (audio+video) strips, after pressed Alt+G, and the audio strips appeared on different channels. I don't know why

@cegaton, why should the frame rates match? I want to make a video a bit faster

Detected file format: AVI (Audio Video Interleaved) (libavformat)
[lavf] stream 0: video (mpeg4), -vid 0
VIDEO:  1920x1072  15.000 fps    0.0 kbps ( 0.0 kB/s)
VO: [xv] 1920x1072 => 1920x1072 Planar YV12

I made this file by converting with ffmpeg from ogv, which was made by recordmydesktop programm

@cegaton, actually the frame rate of the file matches that of the project, I did not set it faster, just wanted to do that. Sorry for confusion

@Denis I don't see any strips other than those I want to render, if I mute them, I don't have any video at all

could you upload the blendfile or is it to big?

Could you isolate one little piece of the file where the problem occour and send it with a portion of the file with video? Or make a video of you showing the issue? The structure of your file seems ok, so the input video should to be somehow involved. Does it has the same behaviour with other files too?

Sometimes Blender has issues decoding the input video (FFMPEG issue) and thus your edits and cuts might be cut to the wrong time. Using Proxy should help.

@MikePan, I enabled a proxy for this strip, rebuilt it, ran th rendering again,
No changes, strip rendered resulting in video different from what is in VSE

@Carlo it was a single file, I just montaged it a bit

@alirustam, you didn't pack the videos in the blendfile. To do this go to file --> external data --> pack all into.blend

@alirustam , once you build the proxy, does the preview look correct? If not, you need to recut the video using the proxy as guide. But ultimately, this is likely a bug with FFMPEG.

I noticed your blender is 4 version old.  Your screen cap says 2.71 and I have 2.75.  Try updating it first.

@cybernard, I tried it allready with newest version, didn't help

You cannot pack video into a .blend file. Sorry. It also looks like you are editing a screen cap, these videos are notoriously incompatible with current versions of Blender. Best suggestion is to transcode your source file into something less compressed first, then edit that.

Comments are not for extended discussion; this conversation has been moved to chat.

http://blender.stackexchange.com/a/41720/2843

Try using: http://blender.stackexchange.com/a/49219/2843 - does it help?

That's most likely a problem due to a broken Video file. The internally used ffmpeg libraries don't work too well with some video formats and are not able to always provide the frames without artifacts and in the right order one by one. I bet your Screencast software didn't do a good job in encoding your footage.
So try to repair your footage. And then instead of using RecordMyDesktop to capture your screen you should use Open Broadcaster Software recording to file, not LiveStream. It should provide you with non-problematic footage that you can use with Blender without problems.

authors: Алексей hunter


text:
Importing video to sequencer
I read somewhere a time ago that in order to do serious work on videos in the sequencer, the video file should be converted to a sequence of raw images. The procedure was briefly explained in that post, but unfortunately I can't find that post these days.
Could anybody please explain how to do that. Thanks in advance.
PS: since there were comments about specifics, my video is from Panasonic GH3 cam, .mov files h.264 format.

It ultimately depends on what format and / or where your images originate.
If they originate in a render, the best advice is to store your intermediates as EXR. Even half EXRs are tremendously more useful than many other options.
If your images originate in a camera, you'd be wise to take them to a reasonable high fidelity format such as EXR. This can be tricky depending on your needs and experience and the format of your camera.
If your images originate from a consumer grade camera and the encoded format is H264 or another codec, you can extract the raw frames using various tools such as FFMPEG or its ilk, to varying degrees of quality depending on the tool and options chosen. With proper care, even an H264 encoded file can be properly decoded to either display linear or scene linear EXRs depending on need.
Getting to a high fidelity still image format however, is only a portion of the puzzle. Coming up with a reasonable offline to online path is another challenge entirely, and critical to optimize the quality of your work if you choose to avoid the "good enough" path.

No, it doesn't really make a difference once it's in the VSE (except for quality differences which don't have so much to do with the format as with the settings for the format). It just makes it so that, when rendering, you don't lose the entire movie if something bad happens (say a power outage on the last frame...ugh). If you are rendering straight to a movie, and Blender crashes, you lose everything. If you are rendering to a series of images, and Blender crashes, you only lost the image it is working on at the time (i.e. you can fire it back up later and start where you left off). Then you can import an image sequence into the VSE.
If you already rendered to a movie, no worries -- there isn't anything "image sequence specific" per say in the VSE.
The key is the output file type setting in the render tab of the properties window:

Make sure it is set to an image format (jpeg, png, etc.) before you render.
Then in the VSE...

...click the "Add > Image" (Shift+A) instead of "Add > Movie". The file browser will open and you can navigate into the folder your image sequence is in, and then select all the images that were rendered.

Not exactly accurate. A) The file format stored from a render or film matters tremendously in the amount and quality of data preserved. B) The VSE typically performs all operations at 8 bit depth, and is nonlinear, which mangles all manipulations.

@troy_s Thanks for pointing that out. This is true, but on the other hand the quality can be changed for each file format: pngs can have 8-bit, 16-bit, etc., and mpegs have a billion quality settings. I have updated my answer to mention this.

Bit depth has little to do with the data a particular format can store. EXR, for example, is implicitly linearized, with the capacity for scene referred values. No other format permits this, no matter what bit depth. File formats are not created equally.

So did I get it right:

load video files in blender VSE
render to images
load image sequences
start editing
??

No, that would not be useful. You need to render to images (from the scene), load them into the VSE as an image seq., edit in the VSE, and finally, render out to a video (from the VSE).

Sorry did not quite get. What is meant by scene? I just import camera shot video. Not animation made in blender.

Oh! These rules don't hardly apply then. It is already using a video codec so the data loss has already occurred! Don't worry about image sequences at all: load it into the VSE, edit, then render to a video file.


text:
Tracking one strip, to another?
I've got one of my Video strips in the Video editor fully 3D-tracked by motion tracking. I wanted to add another video strip on top of it, following the track and being stabilized in the movie. How do I do this? I've been searching for 4 hours on how to do this...

I want to track the coin to the other movie. (I don't even know how to make it loop?)
I've tried fcurves, as the tracks are fcurves- I have no idea how to steal the fcurves from the track and paste it onto the transform effect strip.
Anyone know a solution? Currently, the coin is just static. I could 2d stabilize the shot, but then the coin would still be static- i want it to move according to the track.

yeah had to use the compositor. Still doesn't quite work, as the animated plane isn't being rendered above the video. i have no idea how to fix it.

As Cegaton9 commented: I can not do it in the VSE. Fixed it in the Compositor and Instead used Animall to animate the coin on top of a plane.


text:
How to UV unwrap complex models?
I have a soccer locker that I am trying to unwrap and texture, but can't do either properly, the texture appears blurred or pix-elated, I tried marking seam, but I don't know how it works so couldn't do it properly, can you help?
here's the blend file:

A simple way to unwrap your locker is to follow these three steps :

In edit mode, select all you vertices
Unwrap with the U key, then choose "smart UV project"
Validate using "OK" the "smart UV project" options

You will obtain an unwrapping optimized to fit the best the image texture (less loose of space) and keeping the surfaces proportion as possible.

You can also mark seams manually. For this kind of figures (as your locker), this is the principle of "the paper cube".

Mark the seems as shown below
Think about a cube as show in 2 (this is an illustration)
Unwrap using the first option called "unwrap"

For a cylinder, typically, use this kind of approach :

The way to choose the method (these one or others) will depend on the way you want to texture your model (texture painting, using images, baking...).


text:
Makeclothe->Makehuman tr
Our designer creates clothes for Makehuman, using Blender+Makeclothes.
A few weeks ago we updated to Makehuman 1.1.0, and also MakeClothes and find a problem: in many upper part (eg tee shirts) the export from MakeClothes is OK (no error) but while opening in MakeHuman, the border of the clothes (especilly necks) has very big triangle distortion.
If we import these clothes in the older version of MakeHumain, everythings' OK.
Have you heard about that and do you have any idea to solve?
Note: I've found a king of similar question:
MakeHuman is destorting my MakeClothes clothing (Blender)
But with no reply...

We've find explanation about this strange effect.
If we open the file in an old blender version (before 2.77), export it using "old makeclothes" into "old makehuman" (1.0); everything's OK.
If we update Makeclothe we have strange triangles at neck level and if we update makeclothes, we loose texture (file not found).
In order to solve that:
1) update everything (Blender, Makeclothes and MakeHuman)
2) open a new project in Blender
3) Append the clothes in Blender (so don't "Open" but "Append")
4) Export using Makeclothes
5) Open in MakeHuman 1.1.0
And everything's OK!


text:
Type: Screen bug. Did you now how to fix this error
When i installed blender i started to try to import one model but i depared whit this error.

Looks like a video card issue, are your drivers all up to date and is your card supported by Blender?

yes they are but this happen i think is conflict in some archivers but i will see this


text:
Why is the outside of my foreground black?
I am currently following Cg geek's vfx tutorial. When I render the foreground, everything is black except my robot. I moved the ground to the background archive and i don't know why its showing in the foreground.
I added motion tracking and I am combining the 2 layers in the compositing window.You may have to render the 2 layers for them to appear in the compositing window. I followed his steps, but i don't know why its black. If you could help me out, I would really appreciate it! Thanks!

Did you enabe film-> Transparent?

No i did not, when I did. It worked perfectly. Thank you so much!


text:
Export an animated 3D model to Power Point
As you might have seen, it is now possible to insert an animated 3d object, like a walking T-Rex, into PowerPoint.

See for example: https://support.office.com/en-us/article/insert-animated-3d-graphics-6f08009a-3da5-400d-a706-8e23f304cd72
Now, I am wondering, how can I create custom 3d models for powerpoint that would also have embedded animations like the T-rex has?
I have not found anything on the web so far. Most of the topics discuss how to create static 3d models for PP, but not how to create 3D models with embedded "scenes" or pre-set animations. Any help would be highly appreciated.

You can export from Blender using fbx format. Though for the animation to be played in Powerpoint this is for rigged 3D models only (models animated by an armature). Have a look here (end of step 1) https://answers.microsoft.com/en-us/msoffice/forum/all/new-play-animated-3d-models-in-word-and-powerpoint/f02513ff-ea35-4f85-b73d-93e4c9bef91b

@lemon Very Interesting. Have you tried it before? If so, would you mind sharing the steps of how to do it as an answer and maybe add some screen-shots or gifs of the final result? This would help me a lot. Thanks!

Just make the animation you want and export it as mentioned... above that this site is not about making tutorials from scratch...

But I can confirm that fbx and glb formats are ok.

@lemon I understand, no problem. Okay, so far I have tried fbx. Seems to be working, but the texture is missing.

@lemon If I do a very simple animation, i.e. I just displace something (keyframe: location) and then export as fbx, the animation is not found in PP. Do you have any idea of how to make it work ? Many Thanks.

As said before it can work only for animations that are done using armatures (read carefuly the link indicated in the first comment).

@lemon  Many thanks for your answer. I am quite new to Blender, so please excuse my question, but do you see a way to do the displacement animation using armatures. I was thinking of using invisible objects... What do you think ?

Henry, I'm sorry but learning this kind of things is not the purpose of BSE. Try to google "blender beginner armature" so you'll have some explanations like https://www.youtube.com/watch?v=Y0btZFIeGtY

@lemon I see, many thanks.

Take a look at here for a quick overview and at the 3D Content Guidelines for Microsoft powerpoint for details.  As the 3D engine in Powerpoint is now based off Babylon.js GLTF format is your best bet to get content to import correctly.


text:
Problem with bpy.ops.object.origin_set
I wrote a script that is attached to a button in the addon. Works perfectly, up to the code line, where is bpy.ops.object.origin_set (type = 'ORIGIN_CENTER_OF_VOLUME'). The previous command works without problems, but here the transfer of origin to the center don't work, the object switches to edit mode. The previous command that moves the cursor to the center works without a problem.
How to solve this problem ?
I would be very grateful for your help.
class ImportSTL(bpy.types.Operator):
    """Import STL"""
    bl_idname = "object.import_stl"
    bl_label = "Import STL"

    def execute(self, context):
        stl_path = bpy.path.abspath(bpy.context.scene.stl_path)
        bpy.ops.import_mesh.stl(filepath=stl_path)
        try:
            ob_new = bpy.context.selected_objects[0]
            for f in ob_new.data.polygons:
                f.use_smooth = True
            for b in ob_new.data.polygons:
                bpy.ops.object.editmode_toggle()
                bpy.ops.mesh.select_all(action='TOGGLE')
                bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
                bpy.ops.mesh.select_all(action='TOGGLE')
                bpy.ops.mesh.tris_convert_to_quads()
                bpy.ops.view3d.snap_cursor_to_selected()
                bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_VOLUME')

Greets

bpy.ops.object.origin_set is an object mode operator.  Instead of using TOGGLE would SELECT_ALL and set the mode to EDIT, then object.  (or use bmesh)  Why the loop over faces?

I think I followed your instructions. conversion to quads has stopped working, but after all, it stays in object mode. I don't know how to use Bmesh


text:
how can i select all objects by type using python
How can i select all objects by type using python scripting. I am trying to select all empties in my scene.
I tried using bpy.ops.object.select_by_type(type='EMPTY') but thats doesn't work.

Blender 2.7x
import bpy

objects = bpy.context.scene.objects

for obj in objects:
    obj.select = obj.type == "EMPTY"

Blender 2.8x
import bpy

objects = bpy.context.scene.objects

for obj in objects:
    obj.select_set(obj.type == "EMPTY")

See this answer for more info.

Nitpick: in the for loop you can just do obj.select = obj.type == "EMPTY"

item='EMPTY'
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type=item)

where item can take any of the following values according to this documentation:
[‘MESH’, ‘CURVE’, ‘SURFACE’, ‘META’, ‘FONT’, ‘HAIR’, ‘POINTCLOUD’, ‘VOLUME’, ‘GPENCIL’, ‘ARMATURE’, ‘LATTICE’, ‘EMPTY’, ‘LIGHT’, ‘LIGHT_PROBE’, ‘CAMERA’, ‘SPEAKER’]

It's recommended to avoid operators if you can. @doakey3's answer is preferred.

Thank you. Is there a reason why?

Operators are slower, create (possibly unnecessary) undo steps, are harder to integrate with other code, and are more sensitive to the content in which they are used.


text:
script mathematical mesh with xyz function surface, each coordinate parametric with u,v
Circa 2015, in the python script window we could enter:
bpy.ops.mesh.primitive_xyz_function_surface(x="...", y="....", z=….",\
range_u_max=1, range_v_max=1)  # with u,v each ranging from 0 to 1

This fundamental and no-nonsense capability seems removed from Blender 2.8
Do we still have this capability, and if so, under what API name?

Have you enabled the Add Mesh Extra Objects addon?  It may not have been bundled in this addon in 2015, yet IIRC would have still needed to be enabled to have operator available.  https://blender.stackexchange.com/questions/124836/mathematical-functions-for-mesh-in-blender-2-8-beta

Thanks much, yes I enabled the add extra mesh objects add on.  I get the default "sea shell" but cannot change to my own shape. What's missing from the following?
import bpy ; from math import * ; two_pi = 2 * pi ;
bpy.ops.mesh.primitive_xyz_function_surface(x_eq = "v", y_eq = "sin(two_piu)", z_eq = "cos(two_piu)")


text:
Scripting a propeller or gear ; the info window python code fails to match success of GUI duplicate and rotate applied to master gear or blade
Given the master propeller blade or gear already drawn at the desired radius from the rotation axis, the Blender GUI approach to duplicate the original and x-rotate the copy 15-deg is to type shift+D  rx15
But the corresponding Python script which appears in the info window does not yield a copied object.
Here is the latest code suggested by StackExchange, but still not working - thanks much:
import bpy
from math import pi

j = 1          # count 1-to-n blades
while j<= 3:
    bpy.ops.object.duplicate_move()
    obj = bpy.context.active_object
    bpy.ops.transform.rotate(value = j * 2 * pi / 4, orient_axis='X', orient_type='GLOBAL')
    j=j+1

Make sure your object has context before running the script.  No issue for me when running script.

Thanks - Please show the code statement(s) to select the object and set context, ideally updating the preliminary code block above


text:
How long should a 10mb .svg import file take to load in Blender?
I am trying to load a 9.6Mb .svg file into blender and it is still working on it after 45 min.
Hardware is a duel Xeon 32 core workstation, Titan X video, 128Gb Ram, 1Tb SSD

Best report this to the bug tracker. Likely there is some redundant calculations going on.

I did some tests with different files, and it all comes down to how many objects blender has to create. One 11mb file imported in about 15sec. While another 5mb svg took about 7mins. Congratulations on being so patient. From that we all learned that large files really will import.

It just finished after 90 min, it is a very complex file so I should have been more patient.
I also notice that although Blender will use most of my cores for other tasks, when doing this import it only used 1 core, any way to change this setting?

I think the file is too large for Blender it has 4.8 million verts, every task is very slow.

There is no option to enable more than one thread for this. Using multiple cpu's requires programming to specifically handle the task that way, time consuming tasks like rendering and simulations will get that effort, importing a file would not be expected to benefit so will only use one core.


text:
How do I change the default settings of export operators?
I made a panel with an Export Modified Model STL button. Right now I am using...
class Export_STL(bpy.types.Operator):
    bl_idname = "diamond.export_stl"
    bl_label = "Export Modified Model STL"

    def execute(self, context):
        bpy.ops.export_mesh.stl('INVOKE_DEFAULT')
        self.report({'INFO'}, f"This is {self.bl_idname}")
        return {'FINISHED'}

It works but I need the default settings to have "Batch Mode" to Object" and a check on the "Selection Only". How do I write this in the script?

Overwrite the menu function

Firstly, for the simplest approach, assigning default via UI is the goto option IIRC have seen others suggesting similar elsewhere
Here we will use the little used, but very handy Menu._dyn_ui_initialize() method to expose the list where methods are appended / prepended.
Running thru and printing the functions module and name reveals,
bl_ui.space_topbar draw
io_scene_fbx menu_func_export
io_anim_bvh menu_func_export
io_mesh_ply menu_func_export
io_scene_obj menu_func_export
io_mesh_stl menu_export
io_scene_gltf2 menu_func_export
io_scene_x3d menu_func_export

so let's simply find the old one and replace with draw from @Gorgeous' answer.
import bpy
from bpy.types import TOPBAR_MT_file_export

def draw(self, context):
    layout = self.layout
    op = layout.operator("export_mesh.stl", text="My Custom STL Exporter")
    op.use_selection = True
    op.batch_mode = 'OBJECT'

funcs = TOPBAR_MT_file_export._dyn_ui_initialize()

for i, f in enumerate(funcs):
    if f.__module__ == "io_mesh_stl":
        funcs[i] = draw
        break

Editing or Copying the source
Another option is to edit original addon source, or  copy the source to our own addons folder give the addon a new name. Disable the original and enable our edited copy.
IMO editing the original source, (and even making a copy)  is a slippery slope and should be avoided as it may need to be re-edited for each blender update.
Stealing annotations
Since the advent of 2.8 and the introduction of annotated properties, these can be easily "pinched" from the defining class.
Can very simply make a propertygroup or an operator or a preset (emulate 'PRESET' in operator options).
Here is the set of definitions illustrated in @Gorgeoous' answer
>>> from io_mesh_stl import ExportSTL
>>> for k, v in ExportSTL.__annotations__.items():
...     k, v
...
('filter_glob', (<built-in function StringProperty>, {'default': '*.stl', 'options': {'HIDDEN'}, 'attr': 'filter_glob'}))
('use_selection', (<built-in function BoolProperty>, {'name': 'Selection Only', 'description': 'Export selected objects only', 'default': False, 'attr': 'use_selection'}))
('global_scale', (<built-in function FloatProperty>, {'name': 'Scale', 'min': 0.01, 'max': 1000.0, 'default': 1.0, 'attr': 'global_scale'}))
('use_scene_unit', (<built-in function BoolProperty>, {'name': 'Scene Unit', 'description': "Apply current scene's unit (as defined by unit scale) to exported data", 'default': False, 'attr': 'use_scene_unit'}))
('ascii', (<built-in function BoolProperty>, {'name': 'Ascii', 'description': 'Save the file in ASCII file format', 'default': False, 'attr': 'ascii'}))
('use_mesh_modifiers', (<built-in function BoolProperty>, {'name': 'Apply Modifiers', 'description': 'Apply the modifiers before saving', 'default': True, 'attr': 'use_mesh_modifiers'}))
('batch_mode', (<built-in function EnumProperty>, {'name': 'Batch Mode', 'items': (('OFF', 'Off', 'All data in one file'), ('OBJECT', 'Object', 'Each object as a file')), 'attr': 'batch_mode'}))
('axis_forward', (<built-in function EnumProperty>, {'name': 'Forward', 'items': (('X', 'X Forward', ''), ('Y', 'Y Forward', ''), ('Z', 'Z Forward', ''), ('-X', '-X Forward', ''), ('-Y', '-Y Forward', ''), ('-Z', '-Z Forward', '')), 'default': 'Y', 'update': <function orientation_helper.<locals>.wrapper.<locals>._update_axis_forward at 0x7f26dc2fd9d0>, 'attr': 'axis_forward'}))
('axis_up', (<built-in function EnumProperty>, {'name': 'Up', 'items': (('X', 'X Up', ''), ('Y', 'Y Up', ''), ('Z', 'Z Up', ''), ('-X', '-X Up', ''), ('-Y', '-Y Up', ''), ('-Z', '-Z Up', '')), 'default': 'Z', 'update': <function orientation_helper.<locals>.wrapper.<locals>._update_axis_up at 0x7f26dc2fd

Preset Example
This doesn't change the default, but is a one time one menu choice to set multiple defaults quickly.

As an example am going to run over Preset System Error and make presets for the mesh export stl operator.
import bpy
from bpy.types import Operator, Menu
from bl_operators.presets import AddPresetBase
from io_mesh_stl import ExportSTL

class ExportSTLPresetMenu(Menu):
    bl_label = "STL Export"
    preset_subdir = ExportSTL.bl_idname
    preset_operator = "script.execute_preset"
    #draw = Menu.draw_preset
    def draw(self, context):
        self.draw_preset(context)

class ExportSTLPresetOperator(AddPresetBase, Operator):
    '''Save STL Export Settings'''
    bl_idname = "export_stl.preset"
    bl_label = "STL Export Settings"
    preset_menu = "ExportSTLPresetMenu"

    # variable used for all preset values
    preset_defines = [
        "op  = bpy.context.active_operator"

    ]

    # properties to store in the preset
    preset_values = [
        f"op.{k}"
        for k in ExportSTL.__annotations__.keys()

    ]

    # where to store the preset
    preset_subdir = ExportSTL.bl_idname
    @classmethod
    def poll(cls, context):
        return True

# Display into an existing panel
def panel_func(self, context):
    layout = self.layout

    row = layout.row(align=True)

    row.menu(ExportSTLPresetMenu.__name__, text=ExportSTLPresetMenu.bl_label)

    row.operator(ExportSTLPresetOperator.bl_idname, text="", icon='ZOOM_IN')
    row.operator(ExportSTLPresetOperator.bl_idname, text="", icon='ZOOM_OUT').remove_active = True

classes = (
    ExportSTLPresetMenu,
    ExportSTLPresetOperator,
)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.STL_PT_export_main.prepend(panel_func)

def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    bpy.types.STL_PT_export_main.remove(panel_func)

if __name__ == "__main__":
    register()

TODO Messed up menu class name naming convention, requires edit.
This creates a preset Batch_Sel.py in your presets/export_mesh.stl folder , TODO perhaps could be in presets/operators/export_mesh.stl )
import bpy
op  = bpy.context.active_operator

op.filter_glob = '*.stl'
op.use_selection = True
op.global_scale = 1.0
op.use_scene_unit = False
op.ascii = True
op.use_mesh_modifiers = True
op.batch_mode = 'OFF'
op.axis_forward = 'Y'
op.axis_up = 'Z'

Revealing an oops, get eyest ttestted moment in GIF that I set ASCII, instead of batch, but you get the drift
Make a new op from old.
Will run thru the very basic theory here, rather than add a MWE
Similarly to above can very quickly make a new operator from original using
from io_mesh_stl import ExportSTL

new_op_class = type(
        "MyNewSTLExporter",
        (ExportSTL, Operator),
        change_dictionary,
        )

where change dictionary property : value keys we wish to change from the original. Eg to just change the label
change_dictionary = {"bl_label", "My STL Export"}

You don't necessarily need to write a custom operator to re-use the existing one. You can call the operator in your layout and change its properties, see How to pass multiple operator properties via UI layout?
import bpy

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout
        op = layout.operator("export_mesh.stl", text="My Custom STL Exporter")
        op.use_selection = True
        op.batch_mode = 'OBJECT'

def register():
    bpy.utils.register_class(HelloWorldPanel)

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)

if __name__ == "__main__":
    register()

You can find the operator's parameters in your blender install path / 2.** / Scripts / addons / io_mesh_stl / __init__.py under the ExportSTL class.  :
use_selection: BoolProperty(
    name="Selection Only",
    description="Export selected objects only",
    default=False,
)
global_scale: FloatProperty(
    name="Scale",
    min=0.01, max=1000.0,
    default=1.0,
)
use_scene_unit: BoolProperty(
    name="Scene Unit",
    description="Apply current scene's unit (as defined by unit scale) to exported data",
    default=False,
)
ascii: BoolProperty(
    name="Ascii",
    description="Save the file in ASCII file format",
    default=False,
)
use_mesh_modifiers: BoolProperty(
    name="Apply Modifiers",
    description="Apply the modifiers before saving",
    default=True,
)
batch_mode: EnumProperty(
    name="Batch Mode",
    items=(
        ('OFF', "Off", "All data in one file"),
        ('OBJECT', "Object", "Each object as a file"),
    ),
)

Thank you for all your information. I see your example is for a properties button. I tried to adapt it to work with my View_3d button but it did not work. Could you help me make it work for this?