[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2582] branches/geodesic_domes/gui_pkhg .py: Strut implemented ; -) works nice with me ...

Peter K.H. Gragert pkhgragert at gmail.com
Thu Nov 3 13:28:16 CET 2011


Revision: 2582
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2582
Author:   pkhg
Date:     2011-11-03 12:28:16 +0000 (Thu, 03 Nov 2011)
Log Message:
-----------
Strut implemented ;-) works nice with me ...
Pay attention, if the mesh is too big, my PC had to be stopped by brute force!
Therefor a max (parameter!) with message is built in.

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

Modified: branches/geodesic_domes/gui_pkhg.py
===================================================================
--- branches/geodesic_domes/gui_pkhg.py	2011-11-03 12:26:53 UTC (rev 2581)
+++ branches/geodesic_domes/gui_pkhg.py	2011-11-03 12:28:16 UTC (rev 2582)
@@ -8,8 +8,31 @@
 import math
 from math import pi #,cos, sin, sqrt
 from bpy.props import EnumProperty, IntProperty, FloatProperty, StringProperty, BoolProperty
+
+#globals
 created_vefm_mesh_values = None
+## for Strut
+bpy.types.Scene.make_a_strut = BoolProperty(name = "Make a strut?", description = "make a strut out of an selected mesh", default = False)
+bpy.types.Scene.max_number_parts = IntProperty(name = "Max nr parts",min=0,max = 1000, description = "Maximum number of v,e,f", default = 100)
+bpy.types.Scene.struttype = BoolProperty(name="Type", description =  "False: nothing done", default = True)
+bpy.types.Scene.width = FloatProperty(name = "width", min = 0.001,max = 2, description="TODO", default = 0.5)
+bpy.types.Scene.height = FloatProperty(name = "height", min = 0.001,max = 2, description="TODO", default = 0.5)
+bpy.types.Scene.length = FloatProperty(name = "length", min = 0.001,max = 2, description="TODO", default = 0.5)
+bpy.types.Scene.widthtog = BoolProperty(name = "widthtog", description="TODO", default = False)
+bpy.types.Scene.heighttog = BoolProperty(name = "heighttog", description="TODO", default = False)
+bpy.types.Scene.lengthtog = BoolProperty(name = "lengthtog", description="TODO", default = False)
+#bpy.types.Scene.meshname = StringProperty(name = "meshname", description = "TODO", default = "Strut_")
+bpy.types.Scene.stretchflag = BoolProperty(name="stretchflag", description = "TODO", default = True)
 
+bpy.types.Scene.length = FloatProperty(name = "length", min = 0.001,max = 2, description="TODO", default = 0.5)
+
+bpy.types.Scene.strut_length = FloatProperty(name = "strut_lift", min = 0.001,max = 2, description="TODO", default = 0.5)
+
+bpy.types.Scene.break_quads = BoolProperty(name = "break quads", description = "break quads into tris", default = True)
+
+
+
+##
 bpy.types.Scene.superformula_um = FloatProperty(name = 'um', min = 0, soft_min=0.1, soft_max=5,max = 10, default =  3)
 bpy.types.Scene.superformula_un1 = FloatProperty(name = 'un1', min = 0, soft_min=0.1, soft_max=5,max = 20, default =  1)
 bpy.types.Scene.superformula_un2 = FloatProperty(name = 'un2', min = 0, soft_min=0.1, soft_max=5,max = 10, default =  1)
@@ -111,54 +134,76 @@
     bl_space_type = "VIEW_3D"
 
     def draw(self,context):
+        sce = context.scene
         layout = self.layout
         col = layout.column()
-        col.label("sform parameters")
-        sce = context.scene
-        row = layout.row()
-        row.prop(sce,"superformula_uact")
-        row.prop(sce,"superformula_vact")
-        if sce.superformula_uact:
+        col.prop(sce,"make_a_strut")        
+        if sce.make_a_strut:
             col = layout.column()
-            col.label("choose U parameters")
+            col.prop(sce,"max_number_parts")
             row = layout.row()
-            row.prop(sce,'superformula_um')
-            row.prop(sce,'superformula_un1')
+            row.prop(sce,"width")
+            row.prop(sce,"height")
             row = layout.row()
-            row.prop(sce,'superformula_un2')
-            row.prop(sce,'superformula_un3')
+            row.prop(sce,"length")
+            row.prop(sce,"widthtog")
             row = layout.row()
-            row.prop(sce,'superformula_ua')
-            row.prop(sce,'superformula_ub')
+            row.prop(sce,"heighttog")
+            row.prop(sce,"lengthtog")
             row = layout.row()
-            row.prop(sce,'superformula_uturn')
-            row.prop(sce,'superformula_utwist')
-        if sce.superformula_vact:
+            row.prop(sce,"stretchflag")
+            row.prop(sce,"strut_length")
             col = layout.column()
-            col.label("choose V parameters")
+            col.label("Make Strut it with selected parametes")
+            col.operator(AddStrut.bl_idname,"Try a Strut")
+        else:
+            col.label(" ")
+            col.label("sform parameters")
             row = layout.row()
-            row.prop(sce,'superformula_vm')
-            row.prop(sce,'superformula_vn1')
-            row = layout.row()
-            row.prop(sce,'superformula_vn2')
-            row.prop(sce,'superformula_vn3')
-            row = layout.row()
-            row.prop(sce,'superformula_va')
-            row.prop(sce,'superformula_vb')
-            row = layout.row()
-            row.prop(sce,'superformula_vturn')
-            row.prop(sce,'superformula_vtwist')
-            #if sce.superformula_uact:
-            #row = layout.row()
-
-        col = layout.column(align=True)
-        col = layout.column()
-        col.label("Types")
-        col.prop(context.scene,"choose_type")
-        #chosen = int(context.scene.choose_type)
-        tmp =  get_chosen_type(context)
-        if tmp == "Geodesic":
-            row = layout.row()
+            row.prop(sce,"superformula_uact")
+            row.prop(sce,"superformula_vact")
+            
+            if sce.superformula_uact:
+                col = layout.column()
+                col.label("choose U parameters")
+                row = layout.row()
+                row.prop(sce,'superformula_um')
+                row.prop(sce,'superformula_un1')
+                row = layout.row()
+                row.prop(sce,'superformula_un2')
+                row.prop(sce,'superformula_un3')
+                row = layout.row()
+                row.prop(sce,'superformula_ua')
+                row.prop(sce,'superformula_ub')
+                row = layout.row()
+                row.prop(sce,'superformula_uturn')
+                row.prop(sce,'superformula_utwist')
+            if sce.superformula_vact:
+                col = layout.column()
+                col.label("choose V parameters")
+                row = layout.row()
+                row.prop(sce,'superformula_vm')
+                row.prop(sce,'superformula_vn1')
+                row = layout.row()
+                row.prop(sce,'superformula_vn2')
+                row.prop(sce,'superformula_vn3')
+                row = layout.row()
+                row.prop(sce,'superformula_va')
+                row.prop(sce,'superformula_vb')
+                row = layout.row()
+                row.prop(sce,'superformula_vturn')
+                row.prop(sce,'superformula_vtwist')
+                #if sce.superformula_uact:
+                #row = layout.row()
+    
+            col = layout.column(align=True)
+            col = layout.column()
+            col.label("Types")
+            col.prop(context.scene,"choose_type")
+            #chosen = int(context.scene.choose_type)
+            tmp =  get_chosen_type(context)
+            if tmp == "Geodesic":
+                row = layout.row()
 #            if context.scene.class_one:
 #                row.label("Class 1 AKTIV")
 #            elif context.scene.class_two:
@@ -170,34 +215,34 @@
 #            row.prop(context.scene,"class_two")
 #            col.label(text="PKHG: Select one")
 
-            col.label(text="object to generate")
-            col.prop(context.scene, "base_type")
-            col.prop(context.scene, "orientation")
-            row.operator(AddGeodesic.bl_idname,"create")
-        elif tmp == 'Torus':
-            row = layout.row()
-            row.operator(AddTorus.bl_idname,"Torus")
-        elif tmp == 'Sphere':
-            row = layout.row()
-            row.operator(AddSphere.bl_idname,"Sphere")
-        elif tmp == 'Parabola':
-            row = layout.row()
-            row.operator(AddParabola.bl_idname,"Parabola")
-        elif tmp == 'Cylinder':
-            row = layout.row()
-            row.operator(AddCylinder.bl_idname,"Cylinder")
-        elif tmp == 'Grid':
-            row = layout.row()
-            row.operator(AddGrid.bl_idname,"Grid")
-        elif tmp == 'Apply sform': #sform apply
-            row = layout.row()
-            row.operator(ApplySform.bl_idname,"Apply superform")
-        elif tmp == 'Your mesh':
-            col.label("\n**INFO*** YOUR MESH not yet implemented")
-        else:
-            col.label(text="Select one")
-            col.label(text="object to generate")
-            col.label(text="pkhg.")
+                col.label(text="object to generate")
+                col.prop(context.scene, "base_type")
+                col.prop(context.scene, "orientation")
+                row.operator(AddGeodesic.bl_idname,"create")
+            elif tmp == 'Torus':
+                row = layout.row()
+                row.operator(AddTorus.bl_idname,"Torus")
+            elif tmp == 'Sphere':
+                row = layout.row()
+                row.operator(AddSphere.bl_idname,"Sphere")
+            elif tmp == 'Parabola':
+                row = layout.row()
+                row.operator(AddParabola.bl_idname,"Parabola")
+            elif tmp == 'Cylinder':
+                row = layout.row()
+                row.operator(AddCylinder.bl_idname,"Cylinder")
+            elif tmp == 'Grid':
+                row = layout.row()
+                row.operator(AddGrid.bl_idname,"Grid")
+            elif tmp == 'Apply sform': #sform apply
+                row = layout.row()
+                row.operator(ApplySform.bl_idname,"Apply superform")
+            elif tmp == 'Your mesh':
+                col.label("\n**INFO*** YOUR MESH not yet implemented")
+            else:
+                col.label(text="Select one")
+                col.label(text="object to generate")
+                col.label(text="pkhg.")
 
 def get_geodesic_special():
     get_scene = bpy.context.scene
@@ -840,3 +885,46 @@
                       uturn*pi,vturn*pi,\
                       utwist,vtwist]
 
+class AddStrut(bpy.types.Operator):
+    bl_idname = "mesh.make_strut"
+    bl_label = "Generate Strut"
+    bl_options = {'REGISTER','UNDO'}
+
+    
+    @classmethod
+    def poll(cls,context):
+        return context.active_object
+
+    def execute(self,context):
+ 
+        struttype = bpy.context.scene.struttype
+        width = bpy.context.scene.width
+        height = bpy.context.scene.height
+        length = bpy.context.scene.length
+        widthtog = bpy.context.scene.widthtog
+        heighttog = bpy.context.scene.heighttog
+        lengthtog = bpy.context.scene.lengthtog
+

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list