Skip to content

Commit

Permalink
Merge pull request #12 from FOSSEE/dev
Browse files Browse the repository at this point in the history
release 0.1.0
  • Loading branch information
ThaHobbyist authored Jan 27, 2025
2 parents 2d65886 + 8893803 commit 9622f11
Show file tree
Hide file tree
Showing 14 changed files with 974 additions and 85 deletions.
63 changes: 41 additions & 22 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
VNT_OT_edge_data_control,
VNT_OT_boundary_data_control,
)
from venturial.models.blockmesh.edge_operators import *
# from venturial.models.blockmesh.edge_operators import *
from venturial.models.tutorials_menu_operators import *

# from venturial.models.geometry_designer_operators import *
Expand Down Expand Up @@ -74,7 +74,9 @@

from venturial.lib.update_methods import *
from venturial.lib.preferences_properties import VNT_user_preferences_collection
from venturial.lib.global_properties import VNT_global_properties_collection
from venturial.lib.global_properties import VNT_global_properties_collection, VNT_global_properties_collection_edge_verts, CUSTOM_LocProps

from venturial.models.edges_panel_operators import *

classes = (
VNT_user_preferences_collection,
Expand Down Expand Up @@ -118,11 +120,17 @@
VNT_MT_about_venturial,
VNT_MT_about_fossee,
VNT_MT_help_menu,
CUSTOM_LocProps,
VNT_global_properties_collection_edge_verts,
VNT_global_properties_collection,
VNT_UL_mesh_file_manager,
VNT_UL_mesh_file_coroner,
CUSTOM_UL_verts,
CUSTOM_UL_blocks,
CUSTOM_UL_faces,
CUSTOM_UL_edges_Main,
CUSTOM_UL_edges_Sub,
CUSTOM_UL_face_merge,
VNT_OT_faceactions,
VNT_OT_set_face_name,
VNT_OT_set_type_face,
Expand Down Expand Up @@ -150,14 +158,21 @@
VNT_OT_vertex_data_control,
VNT_OT_edge_data_control,
VNT_OT_boundary_data_control,
VNT_OT_generate_edge,
VNT_OT_edit_edge,
VNT_OT_destroy_edge,
VNT_OT_merge_faces,
VNT_OT_merge_faces_delete,
# VNT_OT_generate_edge,
# VNT_OT_edit_edge,
# VNT_OT_destroy_edge,
VNT_OT_more_tutorials_viewer,
VNT_OT_tutorial_viewer,
VNT_PT_filter_tutorials,
VNT_PT_filter_recents,
VNT_OT_active_project_indicator,
OBJECT_OT_add_single_vertex,
VNT_OT_new_edge,
VNT_OT_new_vert,
VNT_OT_remove_edge,
VNT_OT_remove_vert,
)


Expand Down Expand Up @@ -333,26 +348,37 @@ def register():
bpy.types.Scene.simblk = CollectionProperty(type=VNT_global_properties_collection)
bpy.types.Scene.simblk_index = IntProperty()

bpy.types.Scene.bcustom = CollectionProperty(type=VNT_global_properties_collection)
bpy.types.Scene.bcustom = CollectionProperty(type=VNT_global_properties_collection) # for blocks
bpy.types.Scene.bcustom_index = IntProperty()

bpy.types.Scene.vcustom = CollectionProperty(type=VNT_global_properties_collection)
bpy.types.Scene.vcustom = CollectionProperty(type=VNT_global_properties_collection) # for vertices
bpy.types.Scene.vcustom_index = IntProperty()

bpy.types.Scene.fcustom = CollectionProperty(type=VNT_global_properties_collection)
bpy.types.Scene.fcustom = CollectionProperty(type=VNT_global_properties_collection) # for faces
bpy.types.Scene.fcustom_index = IntProperty()

bpy.types.Scene.faceList_master = EnumProperty("Face List", items=list_current_faces)
bpy.types.Scene.faceList_slave = EnumProperty("Face List", items=list_current_faces)

bpy.types.Scene.fmcustom = CollectionProperty(type=VNT_global_properties_collection) # for face merging
bpy.types.Scene.fmcustom_index = IntProperty()

bpy.types.Scene.ecustom = CollectionProperty(type=VNT_global_properties_collection_edge_verts) # for edges
bpy.types.Scene.ecustom_index = IntProperty()

bpy.types.Scene.vert_index = IntProperty(name="Vertex Index", default=0)

bpy.types.Scene.edge_control_methods = EnumProperty(
items=[("IP", "Interpolation Points", ""), ("AA", "Axis angle", "")],
default="IP",
)

bpy.types.Scene.curve_type = EnumProperty(
items=[
("ARC", "Arc", "", "SPHERECURVE", 0),
("POLYLINE", "Polyline", "", "LINCURVE", 1),
("SPLINE", "Spline", "", "SMOOTHCURVE", 2),
("BSPLINE", "Bspline", "", "ROOTCURVE", 3),
("ARC", "Arc", "Arc type of edge"),
("PLY", "Polyline", "Polyline type of edge"),
("SPL", "Spline", "Spline type of edge"),
("BSPL", "BSpline", "BSpline type of edge"),
],
default="ARC",
)
Expand Down Expand Up @@ -405,16 +431,6 @@ def register():
default=1,
)

bpy.types.Scene.edgelist = EnumProperty(
description="Type of Edge (pre-defined)",
items=[
("arc", "arc", "", "SPHERECURVE", 0),
("polyLine", "polyLine", "", "LINCURVE", 1),
("spline", "spline", "", "SMOOTHCURVE", 2),
("BSpline", "BSpline", "", "ROOTCURVE", 3),
],
)

bpy.types.Scene.face_sel_mode = BoolProperty(default=False, update=update_face_mode)

bpy.types.Scene.statistics = BoolProperty(default=False)
Expand Down Expand Up @@ -554,6 +570,9 @@ def unregister():
del bpy.types.Scene.vcustom_index
del bpy.types.Scene.fcustom
del bpy.types.Scene.fcustom_index
del bpy.types.Scene.ecustom
del bpy.types.Scene.ecustom_index
del bpy.types.Scene.vert_index
del bpy.types.Scene.cnt
del bpy.types.Scene.mode
del bpy.types.Scene.bdclist
Expand Down
76 changes: 75 additions & 1 deletion lib/global_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,51 @@
PointerProperty,
CollectionProperty,
EnumProperty)
import bpy

from bpy.types import PropertyGroup

from venturial.models.blockmesh.boundary_control_operators import list_current_faces

class CUSTOM_LocProps(bpy.types.PropertyGroup):
vert_loc: FloatVectorProperty(name='verts')

def color_change(self,context):
return

def size_change(self,context):
return

class VNT_global_properties_collection_edge_verts(bpy.types.PropertyGroup):
vert_collection: CollectionProperty(
name = "Vert Collection",
type = CUSTOM_LocProps)
vertex_col: CollectionProperty(
name = "Vert Collection for changing and storing intermediate values",
type = CUSTOM_LocProps)
vc: CollectionProperty(
name = "Storing intermediate values",
type = CUSTOM_LocProps)
color : FloatVectorProperty(
name = "Color Picker",
subtype = "COLOR",
size = 4,
min = 0.0,
max = 1.0,
default = (1.0,1.0,1.0,1.0),
update = color_change)
size : IntProperty(name="size",default=1,min=1,max=5,update=size_change)
edge_type: EnumProperty(
name="Edge Types",
description="Types of edges supported by OpenFOAM",
items=[
("ARC", "Arc", "Arc type of edge"),
("PLY", "Polyline", "Polyline type of edge"),
("SPL", "Spline", "Spline type of edge"),
("BSPL", "BSpline", "BSpline type of edge"),
],
)

class VNT_global_properties_collection(PropertyGroup):

vertindex : StringProperty()
Expand All @@ -29,7 +71,9 @@ class VNT_global_properties_collection(PropertyGroup):
min = 0.0,
max = 1.0,
default = (1.0,1.0,1.0,1.0))


master_face : EnumProperty("Master Face", items=list_current_faces)
slave_face : EnumProperty("Slave Face", items=list_current_faces)

b_name: StringProperty()
setcellx: IntProperty()
Expand Down Expand Up @@ -75,3 +119,33 @@ class VNT_global_properties_collection(PropertyGroup):
faceindex : StringProperty()
blkindex: StringProperty()

vert_collection: CollectionProperty(
name = "Vert Collection",
type = CUSTOM_LocProps)
vertex_col: CollectionProperty(
name = "Vert Collection for changing and storing intermediate values",
type = CUSTOM_LocProps)
vc: CollectionProperty(
name = "Storing intermediate values",
type = CUSTOM_LocProps)
color : FloatVectorProperty(
name = "Color Picker",
subtype = "COLOR",
size = 4,
min = 0.0,
max = 1.0,
default = (1.0,1.0,1.0,1.0),
update = color_change)
size : IntProperty(name="size",default=1,min=1,max=5,update=size_change)

edge_type: EnumProperty(
name="Edge Types",
description="Types of edges supported by OpenFOAM",
items=[
("ARC", "Arc", "Arc type of edge"),
("PLY", "Polyline", "Polyline type of edge"),
("SPL", "Spline", "Spline type of edge"),
("BSPL", "BSpline", "BSpline type of edge"),
],
)
edge_verts: CollectionProperty(type=VNT_global_properties_collection_edge_verts)
9 changes: 9 additions & 0 deletions lib/update_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ def update_face_mode(self, context):
me.update()

else:
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE', action='TOGGLE')
obj = context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)

for f in bm.faces:
f.select = True
bm.select_flush_mode()
me.update()
bpy.ops.object.mode_set(mode = 'OBJECT')


Expand Down
64 changes: 64 additions & 0 deletions models/blockmesh/boundary_control_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,3 +410,67 @@ def execute(self, context):
else:
self.report({'INFO'}, "Nothing to remove")
return{'FINISHED'}

# Operators for mergepatchpairs
class VNT_OT_merge_faces(Operator):
bl_idname = "vnt.merge_faces"
bl_label = "Merge Faces"
bl_description = "Merge selected Faces"
bl_options = {'REGISTER', 'UNDO'}

def draw(self, context):
layout = self.layout
cs = context.scene

r1 = layout.row(align=True)
r1.label(text="Master Face:")
r1.prop(cs, "faceList_master")

r2 = layout.row(align=True)
r2.label(text="Slave:")
r2.prop(cs, "faceList_slave")

def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self, width=300)

def execute(self, context):
cs = context.scene

if cs.faceList_master == cs.faceList_slave:
self.report({'ERROR'}, "Master and Slave faces cannot be same")
return {'CANCELLED'}
else:
item = cs.fmcustom.add()
item.master_face = cs.faceList_master
item.slave_face = cs.faceList_slave

return {'FINISHED'}

class VNT_OT_merge_faces_delete(Operator):
bl_idname = "vnt.merge_faces_delete"
bl_label = "Separate Faces"
bl_description = "Separate selected Face pairs"
bl_options = {'REGISTER', 'UNDO'}

@classmethod
def poll(cls, context):
return bool(context.scene.fmcustom)

def invoke(self, context, event):
return context.window_manager.invoke_confirm(self, event)

def execute(self, context):
if bool(context.scene.fcustom):
context.scene.fmcustom.clear()
self.report({'INFO'}, "All items removed")
else:
self.report({'INFO'}, "Nothing to remove")
return{'FINISHED'}



def list_current_faces(self, context):
items = []
for i, f in enumerate(context.scene.fcustom):
items.append((str(f.face_des), f.face_des, f"{f.face_des}, {f.name}"))
return items
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def generate_arc(self, context, obj):

def generate_polyline(self, context, obj):
print("generate polyline")

def generate_spline(self, context, obj):
print("generate spline")

Expand Down
File renamed without changes.
Loading

0 comments on commit 9622f11

Please sign in to comment.