Skip to content

Objects

3DBubble edited this page Oct 23, 2020 · 15 revisions

Objects

Selection and Object Management

create_object(name, col)

Created an empty object with the appropriate name. If col is provided, it will link the new object to that collection, otherwise it will link it to the active collection. Returns a reference to the newly created object.

copy_object(tocopy, col)

Copies the provided tocopy object and places the new copy in the col collection. If the destination collection is not provided then it will put the new copy in the selected collection.

Convenience functions:

  • duplicate_objects(tocopy, col)

get_active_object()

Returns a reference to the active object in the scene. This is the equivalent of calling bpy.context.active_object.

Convenience functions:

  • active_object()
  • get_selected_object()
  • selected_object()
  • ao()

get_selected_objects()

Returns a list of all selected objects, contained within bpy.context.selected_objects.

Convenience functions:

  • so()

get_all_objects()

Returns a list of all objects in the file, provided by bpy.data.objects.

Convenience functions:

  • get_list_of_objects

select_object(ref, make_active)

Takes the provided ref object and makes sure it is selected. If make_active is given True, then the object being selected will be made the actively selected object.

select_all_objects(col)

Selects all objects in the scene. If col collection is provided, then it will only select the objects contained inside of that collection.

deselect_object(ref)

Deselects the provided ref object.

deselect_all_objects()

Deselects every object that is currently selected.

delete_selected_objects()

Deletes all objects that are selected, the equivalent of calling bpy.ops.object.delete().

delete_object(ref)

Deletes the provided ref object.

delete_objects(objlist)

Takes a list of objects (objlist), deletes all of them.

instance_object(ref, newname, col)

Creates an instance of the ref object, gives it the name newname and moves it to the col collection (if provided).

get_object(ref)

Get the ref object (can also be string name) and return a reference to it. Works on single object. For multiple objects, use get_objects(). Will provide active object if reference not provided.

Convenience functions:

  • get_obj(ref)

get_objects(ref)

Get reference to the list of objects. Will return a list of objects even if single object reference is passed. ref can be None, object, string name, list of names or list of objects. Will provide list of all selected objects if reference is not provided.

Convenience functions:

  • get_objs(ref)

get_median_point_of_objects(objs)

Will return the vector location of median point from all the list of objects. objs should be first passed through get_objects() to reduce errors.

object_exists(ref)

Returns a true or false value depending on if the ref object exists.

rename_object(obj, newname)

Renames the obj object to newname.

get_parent(ref)

Returns the parent of the ref object.

get_children(ref)

Returns the children of the ref object.

set_parent(child, parent)

Sets parent to be the parent object of child.

clear_parent(ref, keep_location)

Clears the parent of the ref object. keep_location decides whether to maintain the global position of the object.

get_objects_with_modifiers()

Returns a list of all objects that have modifiers attached to them.

select_objects_with_modifiers()

Finds all objects with modifiers and sets their selection state to true.

invert_selection()

The equivalent of calling bpy.ops.object.select_all(action='INVERT').

get_bounding_box(ref)

Returns the bounding box of an object.

get_bounding_box_corners(ref)

Returns the global coordinates of the corners of the bounding box of an object.


Conversions

convert_to_mesh(ref)

Converts the given ref object to a mesh type.

convert_to_grease_pencil(ref)

Converts the given ref object to a grease pencil type.

convert_to_curve(ref)

Converts the given ref object to a curve type.


Select All Types

select_all_meshes()

The equivalent of calling bpy.ops.object.select_by_type(type='MESH').

select_all_curves()

The equivalent of calling bpy.ops.object.select_by_type(type='CURVE').

select_all_surfaces()

The equivalent of calling bpy.ops.object.select_by_type(type='SURFACE').

select_all_metas()

The equivalent of calling bpy.ops.object.select_by_type(type='META').

select_all_text()

The equivalent of calling bpy.ops.object.select_by_type(type='FONT').

select_all_hair()

The equivalent of calling bpy.ops.object.select_by_type(type='HAIR').

select_all_point_clouds()

The equivalent of calling bpy.ops.object.select_by_type(type='POINTCLOUD').

select_all_volumes()

The equivalent of calling bpy.ops.object.select_by_type(type='VOLUME').

select_all_armatures()

The equivalent of calling bpy.ops.object.select_by_type(type='ARMATURE).

select_all_lattices()

The equivalent of calling bpy.ops.object.select_by_type(type='LATTICE').

select_all_empties()

The equivalent of calling bpy.ops.object.select_by_type(type='EMPTY').

select_all_grease_pencils()

The equivalent of calling bpy.ops.object.select_by_type(type='GPENCIL').

select_all_cameras()

The equivalent of calling bpy.ops.object.select_by_type(type='CAMERA').

select_all_speakers()

The equivalent of calling bpy.ops.object.select_by_type(type='SPEAKER').

select_all_light_probes()

The equivalent of calling bpy.ops.object.select_by_type(type='LIGHT_PROBE').


Primitives - Meshes

create_plane()

Creates and returns a plane object.

create_cube()

Creates and returns a cube object.

create_circle()

Creates and returns a circle object.

create_cylinder()

Creates and returns a cylinder object.

create_uv_sphere()

Creates and returns a uv-sphere object.

Convenience functions:

  • create_sphere()

create_ico_sphere()

Creates and returns an ico-sphere object.

create_cone()

Creates and returns a cone object.

create_torus()

Creates and returns a torus object.

create_grid()

Creates and returns a grid object.

create_suzanne()

Creates and returns a suzanne object.

Convenience functions:

  • create_monkey()

Primitives - Curves

create_bezier_curve()

Creates and returns a bezier curve object.

Convenience functions:

  • create_bezier

create_circle_curve()

Creates and returns a circle curve object.

create_nurbs_curve()

Creates and returns a nurbs curve object.

create_nurbs_circle()

Creates and returns a nurbs curve circle object.

create_nurbs_path()

Creates and returns a nurbs curve path object.

Convenience functions:

  • create_path()

Primitives - Surface

create_nurbs_curve_surface()

Creates and returns a nurbs curve surface object.

Convenience functions:

  • create_curve_surface()

create_nurbs_circle_surface()

Creates and returns a nurbs circle surface object.

Convenience functions:

  • create_circle_surface()

create_nurbs_surface()

Creates and returns a nurbs surface object.

create_nurbs_cylinder_surface

Creates and returns a nurbs cylinder surface object.

Convenience functions:

  • create_cylinder_surface

create_nurbs_sphere_surface()

Creates and returns a nurbs sphere surface object.

Convenience functions:

  • create_sphere_surface

create_nurbs_torus_surface()

Creates and returns a nurbs torus surface object.

Convenience functions:

  • create_torus_surface()

Primitives - Metaball

create_metaball()

Creates and returns a metaball object.

create_metaball_capsule()

Creates and returns a metaball capsule object.

create_metaball_plane()

Creates and returns a metaball plane object.

create_metaball_ellipsoid()

Creates and returns a metaball ellipsoid object.

create_metaball_cube()

Creates and returns a metaball cube object.


Primitives - Text

create_text_object()

Creates and returns a text object.

Convenience functions:

  • create_text()

Shading

shade_object_smooth(ref)

Convenience functions:

  • shade_smooth(ref)

shade_object_flat(ref)

Convenience functions:

  • shade_flat(ref)

set_smooth_angle(ref, degrees)

Clone this wiki locally