Dear Community,
I have a problem within the following lines of code. I am trying to redraw surfaces with the given trims but a diferent refinement. When I have a small amount of surfaces everything works properly, but when there are a lot of surfaces the program stops with an SEHException. But not emediatly and not always. I figured out that the problem comes from the CopyTrimCurves function, because when I decomented this line everything worked good.
So my questions are the following:
-
Can I avoid the CopyTrimCurves function or are I using it wrong?
-
also the way how I get to the right surface depending to the right face seems quite unfancy - is there a better way to do this?
foreach (var surface in ((Brep) element.Geometry).Surfaces)
{
var ud = surface.UserData.Find(typeof (UserDataSurface)) as UserDataSurface;
if (ud == null)
continue;foreach (var support in ud.myElementDataSurface.verticeSupports) { drawPointSupport(e, surface.PointAt(support.u, support.v), support.dispX, support.dispY, support.dispZ); } if (ud.myElementDataSurface.elementProperty == null) continue; var newsurface = surface.Rebuild( ud.myElementDataSurface.elementProperty.refinment.PDeg + surface.Degree(0), ud.myElementDataSurface.elementProperty.refinment.QDeg + surface.Degree(1), ud.myElementDataSurface.elementProperty.refinment.minElementU + surface.ToNurbsSurface().Points.CountU, ud.myElementDataSurface.elementProperty.refinment.minElementV + surface.ToNurbsSurface().Points.CountV); foreach (var face in ((Brep)element.Geometry).Faces) { var gt = ((Brep)element.Geometry).Surfaces[face.SurfaceIndex]; if (gt == surface) { var nsurface = Brep.CopyTrimCurves(face, newsurface, 0.0001); if (nsurface.IsValid) { e.Display.DrawBrepWires(nsurface.ToBrep(), Color.Aqua); } break; }
}
}
Thanks a lot for your help!
Cheers, Tobi