Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bladex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
'ProfileInterface', 'NacaProfile', 'CustomProfile',
'ReversePropeller', 'Blade', 'Shaft', 'CylinderShaft',
'Propeller', 'Deformation', 'ParamFile', 'RBF',
'reconstruct_f', 'scipy_bspline'
'reconstruct_f', 'scipy_bspline', 'InterpolatedFace'
]

from .meta import *
from .profile import ProfileInterface
from .profile import NacaProfile
from .profile import CustomProfile
from .blade import Blade
from .shaft import Shaft
from .shaft.shaft import Shaft
from .propeller import Propeller
from .deform import Deformation
from .params import ParamFile
from .ndinterpolator import RBF, reconstruct_f, scipy_bspline
from .reversepropeller import ReversePropeller
from .cylinder_shaft import CylinderShaft
from .shaft.cylinder_shaft import CylinderShaft
from .intepolatedface import InterpolatedFace
610 changes: 109 additions & 501 deletions bladex/blade.py

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions bladex/genericsolid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
Module for the blade bottom-up parametrized construction.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

class GenericSolid:

def __init__(self, *args, **kwds):
pass
55 changes: 55 additions & 0 deletions bladex/intepolatedface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""
Module for the blade bottom-up parametrized construction.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from OCC.Core.BRepOffsetAPI import BRepOffsetAPI_ThruSections
from OCC.Core.gp import gp_Pnt
from OCC.Core.TColgp import TColgp_HArray1OfPnt
from OCC.Core.GeomAPI import GeomAPI_Interpolate
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeVertex,\
BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire,\
BRepBuilderAPI_Sewing, BRepBuilderAPI_MakeSolid

class InterpolatedFace:

def __init__(self, pts, max_deg=3, tolerance=1e-10):

print(pts.shape)
if pts.ndim not in [2, 3]:
raise ValueError("pts must be a 2D or 3D array.")

if pts.ndim == 2:
pts = pts[None, :, :]

if pts.shape[1] != 3:
raise ValueError("Each point must have 3 coordinates for X, Y, Z.")

self.max_deg = max_deg
self.tolerance = tolerance

generator = BRepOffsetAPI_ThruSections(False, False, tolerance)
generator.SetMaxDegree(max_deg)

for id_section, section in enumerate(pts):
vertices = TColgp_HArray1OfPnt(1, section.shape[1])
for id_pt, pt in enumerate(section.T, start=1):
vertices.SetValue(id_pt, gp_Pnt(*pt))

# Initializes an algorithm for constructing a constrained
# BSpline curve passing through the points of the blade last
# section
bspline = GeomAPI_Interpolate(vertices, False, tolerance)
bspline.Perform()

edge = BRepBuilderAPI_MakeEdge(bspline.Curve()).Edge()

if id_section == 0:
root_edge = edge

# Add BSpline wire to the generator constructor
generator.AddWire(BRepBuilderAPI_MakeWire(edge).Wire())

generator.Build()
self.face = generator.GeneratedFace(root_edge)
20 changes: 0 additions & 20 deletions bladex/meta.py

This file was deleted.

Loading
Loading