Skip to content

Commit

Permalink
correction sphere additional plane
Browse files Browse the repository at this point in the history
  • Loading branch information
psauvan committed Nov 25, 2024
1 parent 5e6ed20 commit 9319ff9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ cython_debug/
# testing folder
tests_outputs/

# work folder
work/

# debug output folders
fuzzySurfaces
Suspicious_solids/
Expand Down
16 changes: 14 additions & 2 deletions src/geouned/GEOUNED/conversion/cell_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,28 @@ def gen_plane_sphere(face, solid):
if f.Surface.Center == face.Surface.Center and f.Surface.Radius == face.Surface.Radius:
# print 'Warning: coincident sphere faces are the same'
for f2 in same_faces:
if f.distToShape(f2)[0] < 1e-6:
if f.__face__.distToShape(f2.__face__)[0] < 1e-6:
same_faces.append(f)
break

# print same_faces
normal = FreeCAD.Vector(0, 0, 0)
for f in same_faces:
normal += f.Area * (f.CenterOfMass - face.Surface.Center)
normal.normalize()
tmp_plane = Part.Plane(face.Surface.Center, normal).toShape()

return Part.Plane(face.Surface.Center, normal).toShape()
dmin = 2 * face.Surface.Radius
for f in same_faces:
dist = tmp_plane.distToShape(f.__face__)[0]
dmin = min(dmin, dist)

if dmin > 1e-6:
center = face.Surface.Center + 0.95 * dmin * normal
plane = Part.Plane(center, normal).toShape()
else:
plane = None
return plane


def gen_plane_cylinder(face, solid, tolerances):
Expand Down

0 comments on commit 9319ff9

Please sign in to comment.