Page Menu
Home
Search
Configure Global Search
Log In
Files
F26309
circle_array.py
Public
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
antonis karvelas (antoni4040)
Nov 13 2013, 5:31 PM
Size
3 KB
Subscribers
None
circle_array.py
View Options
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
bl_info
=
{
"name"
:
"Circle Array"
,
"author"
:
"Antonis Karvelas"
,
"version"
:
(
1
,
0
),
"blender"
:
(
2
,
6
,
6
),
"location"
:
"View3D > Object > Circle_Array"
,
"description"
:
"Uses an existing array and creates an empty,rotates it properly and makes a Circle Array "
,
"warning"
:
"You must have an object and an array, or two objects, with only the first having an array"
,
"wiki_url"
:
""
,
"tracker_url"
:
""
,
"category"
:
"Mesh"
}
import
bpy
from
math
import
radians
class
Circle_Array
(
bpy
.
types
.
Operator
):
bl_label
=
"Circle Array"
bl_idname
=
"objects.circle_array_operator"
def
execute
(
self
,
context
):
list
=
bpy
.
context
.
selected_objects
if
len
(
list
)
==
2
:
active
=
list
[
0
]
active
.
modifiers
[
0
]
.
use_object_offset
=
True
active
.
modifiers
[
0
]
.
use_relative_offset
=
False
active
.
select
=
False
bpy
.
context
.
scene
.
objects
.
active
=
list
[
0
]
bpy
.
ops
.
view3d
.
snap_cursor_to_selected
()
bpy
.
ops
.
object
.
add
(
type
=
'EMPTY'
)
empty_name
=
bpy
.
context
.
active_object
empty_name
.
name
=
"EMPTY"
bpy
.
context
.
scene
.
objects
.
active
=
active
active
.
modifiers
[
0
]
.
offset_object
=
empty_name
num
=
active
.
modifiers
[
"Array"
]
.
count
print
(
num
)
rotate_num
=
360
/
num
print
(
rotate_num
)
empty_name
.
rotation_euler
=
(
0
,
0
,
radians
(
rotate_num
))
empty_name
.
select
=
False
active
.
select
=
True
bpy
.
ops
.
object
.
transform_apply
(
location
=
True
,
rotation
=
False
,
scale
=
True
)
return
{
'FINISHED'
}
else
:
active
=
context
.
active_object
active
.
modifiers
[
0
]
.
use_object_offset
=
True
active
.
modifiers
[
0
]
.
use_relative_offset
=
False
bpy
.
ops
.
view3d
.
snap_cursor_to_selected
()
bpy
.
ops
.
object
.
add
(
type
=
'EMPTY'
)
empty_name
=
bpy
.
context
.
active_object
empty_name
.
name
=
"EMPTY"
bpy
.
context
.
scene
.
objects
.
active
=
active
active
.
modifiers
[
0
]
.
offset_object
=
empty_name
num
=
active
.
modifiers
[
"Array"
]
.
count
print
(
num
)
rotate_num
=
360
/
num
print
(
rotate_num
)
empty_name
.
rotation_euler
=
(
0
,
0
,
radians
(
rotate_num
))
return
{
'FINISHED'
}
def
circle_array_menu
(
self
,
context
):
self
.
layout
.
operator
(
Circle_Array
.
bl_idname
,
text
=
"Circle_Array"
)
def
register
():
bpy
.
utils
.
register_class
(
Circle_Array
)
bpy
.
types
.
VIEW3D_MT_object
.
append
(
circle_array_menu
)
if
__name__
==
"__main__"
:
register
()
File Metadata
Details
Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5b/69/9ca9a0545ebdb7ae17644444a4f8
Event Timeline
Log In to Comment