object copy

in blender it’s easy to copy then relocate an object somewhere else

but is there an equivalent function in python to copy an object?

i know how to relocate an object but may be there is one command to copy and move it to another location?

Thanks

If you want to make an easy function to do it, do something like:


import Object
import bpy

scn = bpy.data.scenes.active

def copyAndMove(scn, linked, loc):
     Object.Duplicate(linked)
     ob = scn.objects.active
     ob.setLocation(*loc)

Then make sure you have active the object you want to duplicate, and call this function with your current scene as the scn argument, 1 or 0 as linked (see the API docs for more info on functionality), and a length-3 list as the loc argument.

i’m began a little script with the addmesh function or module

when i treid to select it did not see it and no error was given

is there another nmodule to load up ?

i know how to select and relocate but it’s no wroking in this new script

here is the begining of code


 
 
#!BPY
"""
Name: 'Arch / Paraboloid'
Blender: 2.48a
Group: 'AddMesh'
"""
import BPyAddMesh
import Blender
from math import sqrt, sin, cos, pi
 
def add_paraboloid(segments,rings,radius,height):
v=[]
f=[]
#Creating the verticies
for i in range(1,rings+1):
 
 
 
z=height*(float(i)/rings)**2
# z=0 # make the 3D flat pancake no paraboloid
r=radius/rings*i
 
for j in range(0,segments):
angle=float(j)/segments*2*pi
 
 

and later i tried this code and nothing happend

ob = Blender.Object.Get(‘Paraboloid’)
print ob # the object
print ob.name # object name
print ‘location’, ob.loc # object location

by getting this object it should be selectd i guess

but id id not inlcude any scene but there was no error given?

Thanks