Question: (Complete the Python script so that it creates a series of spheres resembling an insect antenna.) import bpy from bpy import context from math import

(Complete the Python script so that it creates a series of spheres resembling an insect antenna.)

import bpy from bpy import context from math import * # math functions

# assign ballobject variable to an icosphere object ballobject = bpy.ops.mesh.primitive_uv_sphere_add

# assign cursor variable to the cursor location in the scene cursor = context.scene.cursor_location

# The sphere "radius" variable, set to 1.0 *** ADD PYTHON CODE HERE ***

# The "scale" variable, initialized to 75% *** ADD PYTHON CODE HERE ***

# The minimum size "minSize" variable, initialized to 0.1 # *** ADD PYTHON CODE HERE ***

# The rotation angle variable "rotAngle", inialized to 20.0 degrees *** ADD PYTHON CODE HERE ***

# Initial variables "xLoc", "yLoc", "zLoc" for locations on X, Y, Z axes, # initialized to the cursor location # (i.e., cursor.x, cursor.y, cursor.z, respectively) # *** ADD PYTHON CODE HERE ***

# Initial size on X, Y, Z axes as variable "size" # initialized to diameter (2 x radius) # *** ADD PYTHON CODE HERE ***

# as long as the current size is greater than the minimum size ... while size > minSize: # set icosphere creation at X, Y, Z location ballobject(location=(xLoc, yLoc, zLoc)) # re-calculate X coordinate by adding size + scale x size # *** ADD PYTHON CODE HERE *** # re-calculate Z coordinate by adding scale x cosine of rotation angle # note: math cosine function expects angle in radians, not degrees # also note: math radians function converts degrees to radians # for example: radAngle = radians(rotAngle) # *** ADD PYTHON CODE HERE *** # resize the icosphere object bpy.ops.transform.resize(value=(size, size, size), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror = False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False) # re-calculate the radius based on the scaling factor (scale x radius) # *** ADD PYTHON CODE HERE *** # re-calculate the current size based on the radius (2 x radius) # *** ADD PYTHON CODE HERE *** # end loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!