View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0033697 | Community | OCCT:Modeling Algorithms | public | 2024-04-27 12:27 | 2024-09-11 17:45 |
Reporter | sheblykin | Assigned To | |||
Priority | normal | Severity | major | ||
Status | new | Resolution | open | ||
Platform | Windows | OS | VC++ 2019 | ||
Product Version | 7.8.0 | ||||
Summary | 0033697: Modeling Algorithms - Base Torus Surfaces are not trimmed by wires | ||||
Description | I have written a plugin for autocad in c# that does geometry export via iges through opencascad wrapper. In library version 7.4.0 Torus Surface are created without errors, starting from version 7.5.0 Torus Surface are no longer cut by Wires. No such error was encountered with other surfaces. Below is the code that builds the surface using data from autocad Brep view. | ||||
Steps To Reproduce | call AddTorusSurface in 7.4.0 version and in 7.5.0 or higher and compare result Please see result in the attached files Standard_Boolean AddTorusSurface(gp_Pnt^ sp, gp_Vec^ normal, double MajorRadius, double MinorRadius) { ::gp_Dir dir(*(normal->ObjRef())); ::gp_Ax3 ax3(*(sp->ObjRef()), dir); //::gp_Torus torus(ax3, MajorRadius, MinorRadius); Handle(Geom_ToroidalSurface) torus = new Geom_ToroidalSurface(ax3, MajorRadius, MinorRadius); return m_Impl->AddShape(MakeFace(torus)); } Handle(TopTools_HSequenceOfShape) ConnectEdgesToWires(bool isVoid) { double tolerance = 0.001; bool shared = false; Handle(TopTools_HSequenceOfShape) Wires = new TopTools_HSequenceOfShape(); Handle(TopTools_HSequenceOfShape) Edges = new TopTools_HSequenceOfShape(); if (isVoid) { for (::TopoDS_Edge edge : *listOfVoidEdge) { Edges->Append(edge); } listOfVoidEdge->Clear(); ShapeAnalysis_FreeBounds::ConnectEdgesToWires(Edges, tolerance, shared, Wires); } else { for (::TopoDS_Edge edge : *listOfEdge) { Edges->Append(edge); } listOfEdge->Clear(); ShapeAnalysis_FreeBounds::ConnectEdgesToWires(Edges, tolerance, shared, Wires); } return Wires; } ::TopoDS_Face ShapeFixFace(BRepBuilderAPI_MakeFace face) { ShapeFix_Face aFaceFixer; aFaceFixer.FixWireMode() = 1; aFaceFixer.FixOrientationMode() = 1; aFaceFixer.FixSplitFaceMode() = 1; Handle(ShapeFix_Wire) aWireFixer = aFaceFixer.FixWireTool(); aWireFixer->FixConnectedMode() = 1; aWireFixer->ClosedWireMode() = Standard_True; Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape(); aFaceFixer.SetContext(aContext); aFaceFixer.Init(face); aFaceFixer.Perform(); return TopoDS::Face(aFaceFixer.Result()); } ::TopoDS_Shape MakeFace(const Handle(Geom_Surface) S) { Handle(TopTools_HSequenceOfShape) Wires = ConnectEdgesToWires(false); BRepBuilderAPI_MakeFace region; if (Wires->Length() > 0) { BRepBuilderAPI_MakeFace F = BRepBuilderAPI_MakeFace(S, TopoDS::Wire(Wires->Value(1))); if (Wires->Length() > 1) { region = BRepBuilderAPI_MakeFace(F.Face(), TopoDS::Wire(Wires->Value(Wires->Length()))); } else { region = F; } } else { region.Init(S, true, 1e-5); } Handle(TopTools_HSequenceOfShape) WiresVoid = ConnectEdgesToWires(true); for (int i = 1; i <= WiresVoid->Length(); i++) { region.Add(TopoDS::Wire(WiresVoid->Value(i))); } ::TopoDS_Shape shape = ShapeFixFace(region); GProp_GProps prop; BRepGProp::SurfaceProperties(shape, prop); if (prop.Mass() < 0) { BRepBuilderAPI_MakeFace R; BRepBuilderAPI_MakeFace F(S, TopoDS::Wire(Wires->Value(1))); if (Wires->Length() > 1) { R = BRepBuilderAPI_MakeFace(ShapeFixFace(BRepBuilderAPI_MakeFace(F.Face(), TopoDS::Wire(Wires->Value(Wires->Length()))))); } else { R = BRepBuilderAPI_MakeFace(ShapeFixFace(F)); } for (int i = 1; i <= WiresVoid->Length(); i++) { R.Add(TopoDS::Wire(WiresVoid->Value(i))); } if (WiresVoid->Length() > 0) { shape = ShapeFixFace(R); } } WiresVoid->Clear(); Wires->Clear(); return shape; } | ||||
Tags | No tags attached. | ||||
Test case number | |||||
|
good.png (68,670 bytes) error.png (85,937 bytes) error.iges (74,277 bytes) good.iges (65,928 bytes) |
|
We checked the issue in 7.5.0, 7.6.0, 7.7.0, 7.8.0 (current latest vesion) and the issue was reproduced on all of them. (It works fine in 7.4.0) Looks like something was changed globaly for torus in 7.5.0 version as we can see in the source code and after that it was broken. |
|
I checked again in 7.5.0 and 7.6.0 the test case works fine, but in 7.7.0 and 7.8.2 it does not work |
|
I found a code fragment in ShapeFix_Face.cxx which spoils ToroidalSurface construction, if you remove these fragments everything is created normally. And this is in the latest version. This code and related sections Handle(Geom_ToroidalSurface) aTorSurf = Handle(Geom_ToroidalSurface)::DownCast(mySurf->Surface()); Standard_Boolean anIsDegeneratedTor = ( aTorSurf.IsNull() ? Standard_False : aTorSurf->MajorRadius() < aTorSurf->MinorRadius() ); Authored by ona and smoskvin committed on Sep 21, 2022 Translated with DeepL.com (free version) Drawin-Torus.iges (235,224 bytes) |
|
Dear @sheblykin, your torus is self-intersected? Indeed self-intersection is not a degeneration. Thank you for your research. But self-intersection is more complicated thing for OCCT nowadays. Needs to analyze the reason more deep. This issue have enough information to reproduce and work with, but for now have no planned for closest release. Will be assigned back to developer as soon as will be planned into release. |
|
Yes torus surfaces are self-intersecting, they are wrongly marked as degenerated. anIsDegeneratedTor |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-04-27 12:27 | sheblykin | New Issue | |
2024-04-27 12:27 | sheblykin | Assigned To | => oan |
2024-04-27 12:27 | sheblykin | File Added: good.png | |
2024-04-27 12:27 | sheblykin | File Added: error.png | |
2024-04-27 12:27 | sheblykin | File Added: error.iges | |
2024-04-27 12:27 | sheblykin | File Added: good.iges | |
2024-04-27 14:02 | dpasukhi | Summary | Base Torus Surfaces are not trimmed by wires => Modeling Algorithms - Base Torus Surfaces are not trimmed by wires |
2024-04-27 14:02 | dpasukhi | Steps to Reproduce Updated | |
2024-04-27 14:02 | dpasukhi | Additional Information Updated | |
2024-04-27 14:55 | sheblykin | Note Added: 0115768 | |
2024-04-30 09:40 | sheblykin | Note Added: 0115770 | |
2024-05-16 13:23 | oan | Assigned To | oan => |
2024-07-04 09:43 | sheblykin | Assigned To | => sheblykin |
2024-07-04 09:54 | sheblykin | Note Added: 0116114 | |
2024-07-04 09:54 | sheblykin | File Added: Drawin-Torus.iges | |
2024-07-04 09:56 | sheblykin | Assigned To | sheblykin => oan |
2024-07-04 11:21 | dpasukhi | Note Added: 0116115 | |
2024-07-04 11:21 | dpasukhi | Assigned To | oan => |
2024-09-11 17:45 | sheblykin | Note Added: 0116631 |