Page 1 of 1

Exception face from wire

Posted: Wed Oct 26, 2022 2:41 am
by Stu Abinavski
Hi everyone.

I am trying to create a face from wire which include the 4 edges below. But fail to create a face.

edge0
(1.00714, 3.0999, 1.0)
(18.643, 2.5, 0.6)
edge1
(18.643, 2.5, 0.6)
(1.653, 2.5, 0.5799)

(1.6536, 2.5, 0.579)
(1.65365, 3.15, 1.0)

x=1.65365, 3.15, 1.0)
x=19.24299, 3.0999, 1.0)

I use IBRepFace_DG.AddNewWire() and IBRepWire_DG.AddEdge(). Which seems to be working, but IBRepFace_DG.GetNormal() gives me an exception.

Thanks for any help

Re: Exception face from wire

Posted: Thu Oct 27, 2022 1:08 am
by Sergei_O
Hello

You do not mention any surface. You probably mean a planar face? I suggest checking that it is the case up to 1e-10 tolerance.

You could do this by constructing a line ILine_DG for each two consecutive edges and using ILine_DG.GetLineIntersection().
If the method returns false, two edges do not intersect, so this is the problem. This way you would get four corner vertices and you could check if they are coplanar.
This can be done by constructing a plane through the first three with IPlane_DG.Init() and using IPlane_DG.GetPointLocation() on the fourth.

This thread may be relevant also: Create face from spline curves

Regards