Fri, 11/01/2024 - 08:11
An exception occurs and I don't understand why.
All values are entered, but an exception error occurs when the 581st for loop is executed. Please help.
for (int i = 1; i <= triangles.Length(); i++)
{
try
{
Poly_Triangle triangle = triangles.Value(i);
int n1 = 0, n2 = 0, n3 = 0;
triangle.Get(n1, n2, n3);
if (reversed)
{
int tmp = n1;
n1 = n2;
n2 = tmp;
}
gp_Pnt p1 = tri.Node(n1);
gp_Pnt p2 = tri.Node(n2);
gp_Pnt p3 = tri.Node(n3);
//Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(p1, p2);
//Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(p2, p3);
//Handle(Geom_TrimmedCurve) aSegment3 = GC_MakeSegment(p3, p1);
TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(p1, p2);
TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(p2, p3);
TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge(p3, p1);
TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(anEdge1, anEdge2, anEdge3);
Handle(AIS_Shape) aShape = new AIS_Shape(aWire);
myAISContext()->Display(aShape, AIS_WireFrame, 0, true);
}
catch (const std::exception& ex)
{
std::cout << ex.what() << std::endl;
}
myView()->FitAll(0.1);
}
Fri, 11/01/2024 - 10:26
Hello, could you share more details? What type of exception? On which line? Do you try OCCT debug version to check stack? Which OCCT version?
Best regards, Dmitrii.
Mon, 11/04/2024 - 02:38
The version is 7.8
TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(p2, p3);
An error occurred at number 583, and proceeded to debug mode.
throw.cpp
RaiseException(EH_EXCEPTION_NUMBER, EXCEPTION_NONCONTINUABLE, _countof(parameters), parameters);
System.Runtime.InteropServices.SEHException: '외부 구성 요소에서 예외를 Throw했습니다.'
Mon, 11/04/2024 - 10:57
I suppose there issue with gp_Dir and (0 0 0) vector or similar mathematic issue. But could you share the value for P2 and P3 at this iteration?
Mon, 11/04/2024 - 23:02
I didn't understand the answer. However, there is a file with the error below. I need to change it to a triangle mesh and save it as igs, but an error occurs during the loop. Sorry for being a beginner.
Could you please write some example code?
Mon, 11/04/2024 - 23:07
There was no answer. I will need to know the value of the variables before crash. Could you share the variables (points) value on crash iteration?
581ss or 583 iteration. I need to know the values of (just in format X1 Y1 Z1 and X2 Y2 Z2)
In my prev message I just share the possible issue in case if points are similar and it is not possible to create an edge with them.
_
Additionally, if you trying to create a triagnles as a wire, you can use "BRepLib_MakePolygon" class.
Best regards, Dmitrii.