private Brep ApplyWallOpen(IEnumerable <StbOpen> opens, StbWall wall, IReadOnlyList <Point3d> wallPts, Brep brep) { if (brep == null) { return(brep); } double thickness = BrepMaker.Wall.GetThickness(_sections, wall); var centerCurve = new PolylineCurve(wallPts); Vector3d normal = Vector3d.CrossProduct(centerCurve.TangentAtEnd, centerCurve.TangentAtStart); var openIds = new List <string>(); if (wall.StbOpenIdList != null) { openIds.AddRange(wall.StbOpenIdList.Select(openId => openId.id)); foreach (string id in openIds) { StbOpen open = opens.First(o => o.id == id); Point3d[] openCurvePts = GetOpenCurvePts(wallPts, open); PolylineCurve[] openCurve = GetOpenCurve(thickness, normal, openCurvePts); Brep openBrep = Brep.CreateFromLoft(openCurve, Point3d.Unset, Point3d.Unset, LoftType.Straight, false)[0].CapPlanarHoles(_tolerance[0]); CheckBrepOrientation(openBrep); brep = Brep.CreateBooleanDifference(brep, openBrep, 1)[0]; } } return(brep); }
private static Point3d[] GetOpenCurvePts(IReadOnlyList <Point3d> wallPts, StbOpen open) { var openXVec = new Vector3d(wallPts[1] - wallPts[0]); openXVec.Unitize(); Vector3d openYVec = Vector3d.ZAxis; var openCurvePts = new Point3d[5]; openCurvePts[0] = wallPts[0] + openXVec * open.position_X + openYVec * open.position_Y; openCurvePts[1] = openCurvePts[0] + openXVec * open.length_X; openCurvePts[2] = openCurvePts[1] + openYVec * open.length_Y; openCurvePts[3] = openCurvePts[0] + openYVec * open.length_Y; openCurvePts[4] = openCurvePts[0]; return(openCurvePts); }