Removing the Seam Line in Fully Revolved Shapes
Closed this issue · 5 comments
How can I remove or even hide the seam line in the fully revolved shapes?
This seam is also noticeable in a simple sphere.
I want to render the scene in shaded mode and visualize boundary edges but excluding the seam lines.
Here is a minimal example to reproduce the issue:
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeRevol
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeWire, BRepBuilderAPI_MakeEdge
from OCC.Core.gp import gp_Pnt, gp_Ax1, gp_OZ, gp_Circ, gp_Ax2, gp_Dir
from OCC.Core.GC import GC_MakeArcOfCircle
from OCC.Display.SimpleGui import init_display
def create_revolved_solid():
# Define a half-circle arc as the profile
radius = 50.0
circle = gp_Circ(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), radius)
arc = GC_MakeArcOfCircle(circle, gp_Pnt(0, radius, 0), gp_Pnt(0, -radius, 0), True).Value()
# Create edges from the arc
arc_edge = BRepBuilderAPI_MakeEdge(arc).Edge()
# Close the profile by adding a vertical line to the Z-axis
line_edge = BRepBuilderAPI_MakeEdge(gp_Pnt(0, radius, 0), gp_Pnt(0, -radius, 0)).Edge()
# Create a closed wire
wire_maker = BRepBuilderAPI_MakeWire()
wire_maker.Add(arc_edge)
wire_maker.Add(line_edge)
wire = wire_maker.Wire()
# Define the axis of revolution (Z-axis)
revolution_axis = gp_Ax1(gp_Pnt(0, 2*radius, 0), gp_Dir(1, 0, 0))
# Perform the revolution
revolved_solid = BRepPrimAPI_MakeRevol(wire, revolution_axis).Shape()
return revolved_solid
if __name__ == "__main__":
shape = create_revolved_solid()
display, start_display, _, _ = init_display()
display.DisplayShape(shape, update=True)
display.FitAll()
start_display()
A nurbs surface is an R3 embedding of a two dimensional surface (U,V) the point is case: the seam is an integral part of a cad model. Specifically in the case of a torus think of how a surface is folded into a cylinder, that cylinder is bend into a circle, until the 2 edges meet.
@jf---
Is there any way to hide the seam? I checked in commercial software like SolidWorks, the seam line exists but it is not shown by default.
I looked for the solution in Open CASCADE reference and found a property called SetUnFreeBoundaryDraw(false) which enables or disables drawing of shared boundaries for shading presentations. I tried it but the seam was still shown.
If you want to identify seam edges, I have a utility method here:
https://github.com/organic-xml-parser/ez-occ/blob/master/src/ezocc/alg/geometry_exploration/seam_identifier.py
I use a different visualizer from the default one. But perhaps you can use that method to exclude those edges from rendering.
The displaying of seem edges could be managed via Prs3d_Drawer::FaceBoundaryUpperContinuity() property.
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeRevol
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeWire, BRepBuilderAPI_MakeEdge
from OCC.Core.gp import gp_Pnt, gp_Ax1, gp_OZ, gp_Circ, gp_Ax2, gp_Dir
from OCC.Core.GC import GC_MakeArcOfCircle
from OCC.Core.GeomAbs import *
from OCC.Display.SimpleGui import init_display
def create_revolved_solid():
# Define a half-circle arc as the profile
radius = 50.0
circle = gp_Circ(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), radius)
arc = GC_MakeArcOfCircle(circle, gp_Pnt(0, radius, 0), gp_Pnt(0, -radius, 0), True).Value()
# Create edges from the arc
arc_edge = BRepBuilderAPI_MakeEdge(arc).Edge()
# Close the profile by adding a vertical line to the Z-axis
line_edge = BRepBuilderAPI_MakeEdge(gp_Pnt(0, radius, 0), gp_Pnt(0, -radius, 0)).Edge()
# Create a closed wire
wire_maker = BRepBuilderAPI_MakeWire()
wire_maker.Add(arc_edge)
wire_maker.Add(line_edge)
wire = wire_maker.Wire()
# Define the axis of revolution (Z-axis)
revolution_axis = gp_Ax1(gp_Pnt(0, 2*radius, 0), gp_Dir(1, 0, 0))
# Perform the revolution
revolved_solid = BRepPrimAPI_MakeRevol(wire, revolution_axis).Shape()
return revolved_solid
if __name__ == "__main__":
shape = create_revolved_solid()
display, start_display, _, _ = init_display()
# adjust default display properties (Prs3d_Drawer in AIS_InteractiveContext)
display.Context.DefaultDrawer().SetFaceBoundaryDraw(True)
display.Context.DefaultDrawer().SetFaceBoundaryUpperContinuity(GeomAbs_G2)
display.DisplayShape(shape, update=True)
display.FitAll()
start_display()seam edges are not displayed, by default