//-------------------------------------------------------------------------------------------------- #endregion #region Make protected override bool MakeInternal(MakeFlags flags = MakeFlags.None) { ClearSubshapeLists(); ContourEdges.Clear(); if (Operands.Count < 1) { Messages.Error("Fillet needs at least one operand shape."); return(false); } var sourceShape = GetOperandBRep(0); if (sourceShape == null) { return(false); } // If no edges are selected, just copy the source shape if (Edges.Length == 0) { return(Skip()); } var makeFillet = new BRepFilletAPI_MakeFillet(sourceShape, ChFi3d_FilletShape.ChFi3d_Rational); // Select edges var edges = GetOcEdges().ToArray(); if (!edges.Any()) { Messages.Error("Edges no longer found. You need to reselect edges to fillet."); return(false); } foreach (var edge in edges) { makeFillet.Add(Radius, edge); } // Get final shape BRep = makeFillet.Shape(); UpdateModifiedSubshapes(sourceShape, makeFillet); UpdateContourEdges(makeFillet, edges); return(base.MakeInternal(flags)); }
//-------------------------------------------------------------------------------------------------- #endregion #region Make protected override bool MakeInternal(MakeFlags flags) { ClearSubshapeLists(); ContourEdges.Clear(); if (Operands.Count < 1) { Messages.Error("Chamfer needs at least one operand shape."); return(false); } var sourceShape = GetOperandBRep(0); if (sourceShape == null) { return(false); } // If no edges are selected, just copy the source shape if (Edges.Length == 0) { return(Skip()); } // Create algo var makeChamfer = new BRepFilletAPI_MakeChamfer(sourceShape); // Select edges var edges = GetOcEdges().ToArray(); if (!edges.Any()) { Messages.Error("Edges no longer found. You need to reselect edges to chamfer."); return(false); } // Get reference faces var faces = FindReferenceFaces(sourceShape, edges, ReverseOrientation); // Go for each edge foreach (var edge in edges) { // Get reference face TopoDS_Face face; if (!faces.TryGetValue(edge, out face)) { Messages.Warning("One edge has no ancestor face. Chamfer cannot operator on free edges."); continue; } switch (_Mode) { case ChamferModes.Symmetric: makeChamfer.Add(Distance, edge); break; case ChamferModes.TwoDistances: makeChamfer.Add(Distance, SecondDistance, edge, face); break; case ChamferModes.DistanceAngle: makeChamfer.AddDA(Distance, Angle.ToRad(), edge, face); break; } } // Get final shape BRep = makeChamfer.Shape(); UpdateModifiedSubshapes(sourceShape, makeChamfer); UpdateContourEdges(makeChamfer, edges); return(base.MakeInternal(flags)); }