[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2546] branches/geodesic_domes/ geodesic_259.py: a number of preparation for ...

Peter K.H. Gragert pkhgragert at gmail.com
Sat Oct 29 11:40:40 CEST 2011


Revision: 2546
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2546
Author:   pkhg
Date:     2011-10-29 09:40:40 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
a number of preparation for  ... version 0.4

Modified Paths:
--------------
    branches/geodesic_domes/geodesic_259.py

Modified: branches/geodesic_domes/geodesic_259.py
===================================================================
--- branches/geodesic_domes/geodesic_259.py	2011-10-29 09:39:30 UTC (rev 2545)
+++ branches/geodesic_domes/geodesic_259.py	2011-10-29 09:40:40 UTC (rev 2546)
@@ -1,4 +1,4 @@
-#v 0.3
+#v 0.4
 ###TODO a reset necessary!
 import math
 import bpy
@@ -8,6 +8,7 @@
 from geodesic_domes import geodesic_classes_259 as geodesic_classes_259
 
 created_vefm_mesh_values = None
+last_generated_object = None
 
 superformparam = []
 def check_contains(cl,name , print_value = False):
@@ -22,12 +23,10 @@
             else:
                 print(name , " contains ==>",el)
     print("\ncheck_contains finished\n\n")
+
     
 def generate(context):
-    global superformparam
-#    from geodesic_domes import forms_259  as forms_259
-#    from geodesic_domes import vefm_259 as vefm_259
-#    from geodesic_domes import geodesic_classes_259 as geodesic_classes_259
+    global superformparam, last_generated_object
     um = context.scene.superformula_um
     un1 = context.scene.superformula_un1
     un2 = context.scene.superformula_un2
@@ -60,10 +59,13 @@
         radius = context.scene.geodesic_radius
         squareness = context.scene.geodesic_square
         squarez = context.scene.geodesic_square_z
-        parameters=[frequency, eccentricity, squish, radius, squareness,squarez,0,0,0,0,0,0,0,1,superformparam]
+        dual = context.scene.geodesic_dual
+        parameters=[frequency, eccentricity, squish, radius, squareness,squarez,0,0,0,0,dual,0,0,1,superformparam]
         if which_geodesic == 'Tetrahedron':
             if which_orientation == "PointUp":
                 new_geodesic = geodesic_classes_259.tetrahedron(parameters)
+                created_vefm_mesh_values = ['Tetrahedron',new_geodesic.PKHG_parameters]
+                print("\n**DBG***>>>>>> created_vefm_mesh_values",created_vefm_mesh_values)
             elif which_orientation == "EdgeUp":
                 new_geodesic = geodesic_classes_259.tetraedge(parameters)
             else:
@@ -84,14 +86,27 @@
                 new_geodesic = geodesic_classes_259.icoface(parameters)
         new_geodesic.config()
         new_geodesic.connectivity()
+        if dual:
+            if frequency == 1 and not(which_geodesic == 'Icosahedron'):
+                new_geodesic.dual()
+                for i,el in enumerate(new_geodesic.verts):
+                    el.index = i
+                for edg in new_geodesic.edges:
+                    edg.findvect()
+            else:
+                print("\n\n>>>>>>>>>>>>>>***Conversion not finished ERROR***  no dual at this moment \nand frequence must be 1")
+        last_generated_object = new_geodesic        
         vefm_259.vefm_add_object(new_geodesic)
+        bpy.context.active_object.location = (0,0,0)
     elif chosen_type == 'Grid':        
         grxres = context.scene.grid_xres #at this moment any res = 1 will generate only points!
         gryres = context.scene.grid_yres
         grxsz = context.scene.grid_xsize
         grysz = context.scene.grid_ysize
         grid=forms_259.grid(grxres,gryres,grxsz,grysz,1.0,1.0,0,0,0,0,1.0,1.0,superformparam)
+        last_generated_object = grid
         vefm_259.vefm_add_object(grid)
+        bpy.context.active_object.location = (0,0,0)
     elif chosen_type == 'Sphere':
         uresolution = context.scene.sphere_uresolution #number of lines N-S  (u coordinate)
         vresolution = context.scene.sphere_vresolution #number of lines O-W  (v cordinate)
@@ -108,7 +123,9 @@
         if upart == 0 or vpart == 0:
             print("\n***Info*** xgap and/or ygap should not be zeor, singular type")
         sphere=forms_259.sphere(uresolution,vresolution,uscale,vscale,upart,vpart,uphase,vphase,utwist,vtwist,xscale,yscale,superformparam)
+        last_generated_object = sphere
         vefm_259.vefm_add_object(sphere)
+        bpy.context.active_object.location = (0,0,0)
     elif chosen_type == 'Cylinder':
         uresolution = context.scene.cylinder_uresolution #number of lines N-S  (u coordinate)
         vresolution = context.scene.cylinder_vresolution #number of lines O-W  (v cordinate)
@@ -123,7 +140,9 @@
         xscale = context.scene.cylinder_xscale  #seams to be scaling from center in r direction
         yscale = context.scene.cylinder_yscale   #expand and shift get factor vscale
         cylinder = forms_259.cylinder(uresolution,vresolution,uscale,vscale,upart,vpart,uphase,vphase,utwist,vtwist,xscale,yscale,superformparam)
+        last_generated_object = cylinder
         vefm_259.vefm_add_object(cylinder)
+        bpy.context.active_object.location = (0,0,0)
     elif chosen_type == 'Parabola':
         uresolution = context.scene.parabola_uresolution #number of lines N-S  (u coordinate)
         vresolution = context.scene.parabola_vresolution #number of lines O-W  (v cordinate)
@@ -138,7 +157,9 @@
         xscale = context.scene.parabola_xscale  #seams to be scaling from center in r direction
         yscale = context.scene.parabola_yscale   #expand and shift get factor vscale
         parabola = forms_259.parabola(uresolution,vresolution,uscale,vscale,upart,vpart,uphase,vphase,utwist,vtwist,xscale,yscale,superformparam)
+        last_generated_object = parabola
         vefm_259.vefm_add_object(parabola)
+        bpy.context.active_object.location = (0,0,0)
     elif chosen_type == 'Torus':
         uresolution = context.scene.torus_uresolution #old ures
         vresolution = context.scene.torus_vresolution #old vres
@@ -153,7 +174,9 @@
         xscale = context.scene.torus_xscale  #old uellipse
         yscale = context.scene.torus_yscale   #old vellipse
         torus = forms_259.torus(uresolution,vresolution,uscale,vscale,upart,vpart,uphase,vphase,utwist,vtwist,xscale,yscale,superformparam)
+        last_generated_object = torus
         vefm_259.vefm_add_object(torus)
+        bpy.context.active_object.location = (0,0,0)
     return {'FINISHED'}
 
 def get_chosen_type(context):
@@ -185,8 +208,8 @@
         result = parabola_parameters()
     elif chosen_type == 'Torus':
         result = torus_parameters()
-    elif chosen_type == 'Ball':
-        result = ball_parameters()
+    elif chosen_type == 'Ball': 
+       result = ball_parameters()
     elif chosen_type == 'Your mesh':
         result = yourmesh_parameters()
     else:
@@ -260,9 +283,10 @@
     torus_vactive =  BoolProperty(name = 'sup v-active',default = False)
     
     def execute(self,context):
-        global superformparam, created_vefm_mesh_values
+        global superformparam, created_vefm_mesh_values, last_generated_object
         torus = forms_259.torus(self.torus_uresolution,self.torus_vresolution,self.torus_uscale,self.torus_vscale,self.torus_upart,self.torus_vpart,self.torus_uphase,self.torus_vphase,self.torus_utwist,self.torus_vtwist,self.torus_xscale,self.torus_yscale,superformparam)
-        created_vefm_mesh_values = ['Torus',torus.ures,torus.vres,torus.uscale,torus.vscale,torus.upart,torus.vpart,torus.uphase,torus.vphase,torus.utwist,torus.vtwist,torus.xscale,torus.yscale,superformparam]             
+        created_vefm_mesh_values = ['Torus',torus.ures,torus.vres,torus.uscale,torus.vscale,torus.upart,torus.vpart,torus.uphase,torus.vphase,torus.utwist,torus.vtwist,torus.xscale,torus.yscale,superformparam]
+        last_generated_object = torus
         add_object(torus)
         print("\n>>>>>>>>debug, created_vefm_mesh_values",created_vefm_mesh_values," generated")
         return {'FINISHED'}
@@ -288,9 +312,10 @@
     cylinder_yscale = FloatProperty(name = 'yscale', min = 0, soft_min = 0.1, soft_max = 4, max = 10, default =  1)  #scale in z direction not y ?! the heigth so to say
 
     def execute(self,context):
-        global superformparam, created_vefm_mesh_values
+        global superformparam, created_vefm_mesh_values, last_generated_object
         cylinder = forms_259.cylinder(self.cylinder_uresolution,self.cylinder_vresolution,self.cylinder_uscale,self.cylinder_vscale,self.cylinder_upart,self.cylinder_vpart,self.cylinder_uphase,self.cylinder_vphase,self.cylinder_utwist,self.cylinder_vtwist,self.cylinder_xscale,self.cylinder_yscale,superformparam)
-        created_vefm_mesh_values = ['Cylinder',cylinder.ures,cylinder.vres,cylinder.uscale,cylinder.vscale,cylinder.upart,cylinder.vpart,cylinder.uphase,cylinder.vphase,cylinder.utwist,cylinder.vtwist,cylinder.xscale,cylinder.yscale,superformparam]                     
+        created_vefm_mesh_values = ['Cylinder',cylinder.ures,cylinder.vres,cylinder.uscale,cylinder.vscale,cylinder.upart,cylinder.vpart,cylinder.uphase,cylinder.vphase,cylinder.utwist,cylinder.vtwist,cylinder.xscale,cylinder.yscale,superformparam]
+        last_generated_object = cylinder
         add_object(cylinder)
         return {'FINISHED'}
 
@@ -316,9 +341,10 @@
     parabola_yscale = FloatProperty(name = 'yscale', min = 0, soft_min = 0.1, soft_max = 4, max = 10, default =  1)  #scale in z direction not y ?! the heigth so to say
     
     def execute(self,context):
-        global superformparam, created_vefm_mesh_values
+        global superformparam, created_vefm_mesh_values, last_generated_object
         parabola = forms_259.parabola(self.parabola_uresolution,self.parabola_vresolution,self.parabola_uscale,self.parabola_vscale,self.parabola_upart,self.parabola_vpart,self.parabola_uphase,self.parabola_vphase,self.parabola_utwist,self.parabola_vtwist,self.parabola_xscale,self.parabola_yscale,superformparam)
-        created_vefm_mesh_values = ['Parabola',parabola.ures,parabola.vres,parabola.uscale,parabola.vscale,parabola.upart,parabola.vpart,parabola.uphase,parabola.vphase,parabola.utwist,parabola.vtwist,parabola.xscale,parabola.yscale,superformparam]                     
+        created_vefm_mesh_values = ['Parabola',parabola.ures,parabola.vres,parabola.uscale,parabola.vscale,parabola.upart,parabola.vpart,parabola.uphase,parabola.vphase,parabola.utwist,parabola.vtwist,parabola.xscale,parabola.yscale,superformparam]
+        last_generated_object = parabola
         add_object(parabola)
         return {'FINISHED'}
     
@@ -346,9 +372,10 @@
     sphere_yscale = FloatProperty(name = 'yscale', min = 0, soft_min = 0.1, soft_max = 4, max = 10, default =  1)  #scale in z direction not y ?! the heigth so to say
     

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list