[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20155] trunk/blender/release/scripts: SVN maintenance.
gsr b3d
gsr.b3d at infernal-iceberg.com
Mon May 11 18:18:38 CEST 2009
Revision: 20155
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20155
Author: gsrb3d
Date: 2009-05-11 18:18:38 +0200 (Mon, 11 May 2009)
Log Message:
-----------
SVN maintenance.
Modified Paths:
--------------
trunk/blender/release/scripts/wizard_bolt_factory.py
Property Changed:
----------------
trunk/blender/release/scripts/image_2d_cutout.py
trunk/blender/release/scripts/object_active_to_other.py
trunk/blender/release/scripts/wizard_bolt_factory.py
trunk/blender/release/scripts/wizard_landscape_ant.py
Property changes on: trunk/blender/release/scripts/image_2d_cutout.py
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: trunk/blender/release/scripts/object_active_to_other.py
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/blender/release/scripts/wizard_bolt_factory.py
===================================================================
--- trunk/blender/release/scripts/wizard_bolt_factory.py 2009-05-11 15:34:46 UTC (rev 20154)
+++ trunk/blender/release/scripts/wizard_bolt_factory.py 2009-05-11 16:18:38 UTC (rev 20155)
@@ -1,3041 +1,3041 @@
-#!BPY
-
-"""
-Name: 'Bolt Factory'
-Blender: 249
-Group: 'Wizards'
-Tooltip: 'Create models of various types to screw fasteners.'
-"""
-
-__author__ = " Aaron Keith (Spudmn) "
-__version__ = "1.50 "
-__url__ = ["blender", "http://wiki.blender.org/index.php/Extensions:Py/Scripts/Manual/Misc/Bolt_Factory"]
-__email__= [""]
-__bpydoc__ = """\
-Bolt_Factory.py
-
-Bolt Factory is a Python script for Blender 3D.
-
-The script allows the user to create models of various types to screw fasteners.
-
-This version is very much a work in progress.
-
-This is my first attempt to program in Python. This version is unpolished and
-doesn't do much error checking. Therefore if the user sets strange
-variable the model created will be as equally strange.
-
-For best results set the material to smooth and apply a Edge Split modifier
-with default settings.
-
-To Do:
-Better error checking.
-Nuts to go with the bolts.
-Pre-sets for common bolts.
-Improved GUI.
-More Head and Bit types.
-Better documentation.
-Fix error with mesh when using crest and root percent other than 10.
-
-
-"""
-
-# --------------------------------------------------------------------------
-# Bolt_Factory.py
-# --------------------------------------------------------------------------
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Copyright (C) 2008: Aaron Keith
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# ***** END GPL LICENCE BLOCK *****
-# --------------------------------------------------------------------------
-
-
-
-
-import Blender
-from Blender import Draw, BGL,Mesh
-from Blender import *
-from math import *
-from Blender import Mathutils
-from Blender.Mathutils import *
-
-
-Global_NutRad = 0.0
-MAX_INPUT_NUMBER = 50
-
-No_Event,On_Preset_Click,On_Apply_Click,On_Create_Click,On_Hex_Click, On_Cap_Click,On_Dome_Click,On_Pan_Click,On_Bit_None_Click,On_Bit_Allen_Click,On_Bit_Philips_Click,On_Exit_Click,On_Model_Bolt_Click,On_Model_Nut_Click,On_Hex_Nut_Click,On_Lock_Nut_Click,On_Test_Click = range(17) # this is like a ENUM
-
-
-Head_Type={'HEX' : [Draw.Create(1),On_Hex_Click],
- 'CAP' : [Draw.Create(0),On_Cap_Click],
- 'DOME': [Draw.Create(0),On_Dome_Click],
- 'PAN' : [Draw.Create(0),On_Pan_Click]}
-
-
-Bit_Type={'NONE' : [Draw.Create(1),On_Bit_None_Click],
- 'ALLEN' : [Draw.Create(0),On_Bit_Allen_Click],
- 'PHILLIPS': [Draw.Create(0),On_Bit_Philips_Click]}
-
-Model_Type={'BOLT' : [Draw.Create(1),On_Model_Bolt_Click],
- 'NUT' : [Draw.Create(0),On_Model_Nut_Click]}
-
-Nut_Type={'HEX' : [Draw.Create(1),On_Hex_Nut_Click],
- 'LOCK' : [Draw.Create(0),On_Lock_Nut_Click]}
-
-
-
-Phillips_Bit_Depth = Draw.Create(1.0)
-Philips_Bit_Dia = Draw.Create(1.75)
-
-Allen_Bit_Depth = Draw.Create(1.0)
-Allen_Bit_Flat_Distance = Draw.Create(1.25)
-
-Hex_Head_Height = Draw.Create(1.0)
-Hex_Head_Flat_Distance = Draw.Create(2.25)
-
-Cap_Head_Dia = Draw.Create(2.25)
-Cap_Head_Height = Draw.Create(1.5)
-Cap_Head_Inside_Rad = 0.0
-
-Dome_Head_Dia = Draw.Create(3.75)
-
-Pan_Head_Dia = Draw.Create(5.375)
-
-Shank_Dia = Draw.Create(1.5)
-Shank_Length = Draw.Create(0.125)
-
-Thread_Length = Draw.Create(2.5)
-Major_Dia = Draw.Create(1.5)
-Minor_Dia = Draw.Create(1.25)
-Pitch = Draw.Create(0.125)
-Crest_Percent = Draw.Create(1.25)
-Root_Percent = Draw.Create(1.25)
-
-Hex_Nut_Height = Draw.Create(1.0)
-Hex_Nut_Flat_Distance = Draw.Create(2.25)
-
-Preset_Menu = Draw.Create(0.25)
-Preset_Length = Draw.Create(1.5)
-
-
-##########################################################################################
-##########################################################################################
-## Miscellaneous Utilities
-##########################################################################################
-##########################################################################################
-
-
-def Rot_Mesh(verts,matrix):
- ret = []
- for v in verts:
- vec = Vector(v) * matrix
- ret.append([vec.x,vec.y,vec.z])
- return ret
-
-def Copy_Faces(faces,offset):
- ret = []
- for f in faces:
- fsub = []
- for i in range(len(f)):
- fsub.append(f[i]+ offset)
- ret.append(fsub)
- return ret
-
-def Move_Verts_Up_Z(VERTS,DISTANCE):
- ret = []
- for v in VERTS:
- ret.append([v[0],v[1],v[2]+DISTANCE])
- return ret
-
-
-def SpinDup(VERTS,FACES,DEGREE,DIVISIONS,AXIS):
- verts=[]
- faces=[]
-
- if DIVISIONS == 0:
- DIVISIONS = 1
-
- step = DEGREE/DIVISIONS # set step so pieces * step = degrees in arc
-
- for i in range(int(DIVISIONS)):
- rotmat = Mathutils.RotationMatrix(step*i, 4, AXIS) # 4x4 rotation matrix, 30d about the x axis.
- Rot = Rot_Mesh(VERTS,rotmat)
- faces.extend(Copy_Faces(FACES,len(verts)))
- #print faces
- verts.extend(Rot)
- return verts,faces
-
-
-def Mirror_Verts(VERTS,AXIS):
- ret = []
- for v in VERTS:
- ret.append([0-v[0],v[1],v[2]])
- return ret
-
-
-def Mirror_Verts_Faces(VERTS,FACES,AXIS,FLIP_POINT =0):
- ret_vert = []
- ret_face = []
- offset = len(VERTS)
- if AXIS == 'y':
- for v in VERTS:
- Delta = v[0] - FLIP_POINT
- ret_vert.append([FLIP_POINT-Delta,v[1],v[2]])
- if AXIS == 'x':
- for v in VERTS:
- Delta = v[1] - FLIP_POINT
- ret_vert.append([v[0],FLIP_POINT-Delta,v[2]])
- if AXIS == 'z':
- for v in VERTS:
- Delta = v[2] - FLIP_POINT
- ret_vert.append([v[0],v[1],FLIP_POINT-Delta])
-
- for f in FACES:
- fsub = []
- for i in range(len(f)):
- fsub.append(f[i]+ offset)
- fsub.reverse() # filp the order to make norm point out
- ret_face.append(fsub)
-
- return ret_vert,ret_face
-
-def Lath(tool_V1,tool_V2,verts,faces):
-
- #verts = []
- #faces = []f
-
- #verts.append([7.0,6.0,0.0])
- #verts.append([7.0+10,6.0-10,0.0])
- #faces.append([3,4])
-
- vec1 = Vector(verts[-1])
- vec2 = Vector(verts[-2])
-
- VecOut1,VecR2 = LineIntersect(vec1, vec2,Vector(tool_V1), Vector(tool_V2))
-
- vec1 = Vector(verts[-2])
- vec2 = Vector(verts[-3])
-
- VecOut2,VecR2 = LineIntersect(vec1, vec2,Vector(tool_V1), Vector(tool_V2))
-
- if VecOut1 != None:
- if VecOut1 == VecOut2:
- #print "got it"
- faces.append([len(verts),len(verts)+1])
- verts.append([VecOut1.x,VecOut1.y,VecOut1.z])
- verts.append([VecOut2.x,VecOut2.y,VecOut2.z])
- #print verts[-1]
- #print verts[-2]
-
- return verts,faces
-
-
-def Build_Face_List_Quads(OFFSET,COLUM,ROW,FLIP = 0):
- Ret =[]
- RowStart = 0;
- for j in range(ROW):
- for i in range(COLUM):
- Res1 = RowStart + i;
- Res2 = RowStart + i + (COLUM +1)
- Res3 = RowStart + i + (COLUM +1) +1
- Res4 = RowStart+i+1
- if FLIP:
- Ret.append([OFFSET+Res1,OFFSET+Res2,OFFSET+Res3,OFFSET+Res4])
- else:
- Ret.append([OFFSET+Res4,OFFSET+Res3,OFFSET+Res2,OFFSET+Res1])
- RowStart += COLUM+1
- return Ret
-
-
-
-def Fill_Ring_Face(OFFSET,NUM,FACE_DOWN = 0):
- Ret =[]
- Face = [1,2,0]
- TempFace = [0,0,0]
- A = 0
- B = 1
- C = 2
- if NUM < 3:
- return None
- for i in range(NUM-2):
- if (i%2):
- TempFace[0] = Face[C];
- TempFace[1] = Face[C] + 1;
- TempFace[2] = Face[B];
- if FACE_DOWN:
- Ret.append([OFFSET+Face[2],OFFSET+Face[1],OFFSET+Face[0]])
- else:
- Ret.append([OFFSET+Face[0],OFFSET+Face[1],OFFSET+Face[2]])
- else:
- TempFace[0] =Face[C];
- if Face[C] == 0:
- TempFace[1] = NUM-1;
- else:
- TempFace[1] = Face[C] - 1;
- TempFace[2] = Face[B];
- if FACE_DOWN:
- Ret.append([OFFSET+Face[0],OFFSET+Face[1],OFFSET+Face[2]])
- else:
- Ret.append([OFFSET+Face[2],OFFSET+Face[1],OFFSET+Face[0]])
-
- Face[0] = TempFace[0]
- Face[1] = TempFace[1]
- Face[2] = TempFace[2]
- return Ret
-
-
-def Flat_To_Radius(FLAT):
- h = (float(FLAT)/2)/cos(radians(30))
- #print h
- return h
-
-
-
-##########################################################################################
-##########################################################################################
-## Error Checking
-##########################################################################################
-##########################################################################################
-
-
-def Error_Check():
-
- #global Phillips_Bit_Depth
- #global Philips_Bit_Dia
-
- #global Allen_Bit_Depth
- #global Allen_Bit_Flat_Distance
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list