/// <summary> /// Creates fillet surfaces from two individual surfaces. /// </summary> /// <param name="firstSurface">The primary surface to fillet.</param> /// <param name="secondSurface">The secondary surface to fillet.</param> /// <param name="filletRadius">The radius of the fillet.</param> /// <param name="filletType">Whether the fillet is concave or convex.</param> /// <param name="filletTrim">Whether the creation of the fillet trims surrounding surfaces.</param> /// <param name="filletRoute">whether the fillet follows all possible routes.</param> /// <param name="filletCrease">Whether the fillet is created along creases.</param> /// <param name="filletCorners">Whether any corners are Roll, Mitre or Round.</param> /// <returns>The list of created surfaces.</returns> public List <PSSurface> CreateFilletSurfaces( PSSurface firstSurface, PSSurface secondSurface, double filletRadius, FilletTypes filletType, FilletTrimOptions filletTrim, FilletRouteOptions filletRoute, FilletCreaseOptions filletCrease, FilletCornerTypes filletCorners) { // Do filleting operation List <PSSurface> firstListOfSurfaces = new List <PSSurface>(); List <PSSurface> secondListOfSurfaces = new List <PSSurface>(); firstListOfSurfaces.Add(firstSurface); secondListOfSurfaces.Add(secondSurface); return(CreateFilletSurfaces(firstListOfSurfaces, secondListOfSurfaces, filletRadius, filletType, filletTrim, filletRoute, filletCrease, filletCorners)); }
/// <summary> /// Creates a fillet from the two lists of surfaces. /// </summary> /// <param name="firstSurfaces">The primary surfaces to fillet.</param> /// <param name="secondSurfaces">The secondary surfaces to fillet.</param> /// <param name="filletRadius">The radius of the fillet.</param> /// <param name="filletType">Whether the fillet is concave or convex.</param> /// <param name="filletTrim">Whether the creation of the fillet trims surrounding surfaces.</param> /// <param name="filletRoute">whether the fillet follows all possible routes.</param> /// <param name="filletCrease">Whether the fillet is created along creases.</param> /// <param name="filletCorners">Whether any corners are Roll, Mitre or Round.</param> /// <returns>The list of created surfaces.</returns> public List <PSSurface> CreateFilletSurfaces( List <PSSurface> firstSurfaces, List <PSSurface> secondSurfaces, double filletRadius, FilletTypes filletType, FilletTrimOptions filletTrim, FilletRouteOptions filletRoute, FilletCreaseOptions filletCrease, FilletCornerTypes filletCorners) { // Add first surfaces to the selection firstSurfaces[0].AddToSelection(true); foreach (PSSurface surface in firstSurfaces) { surface.AddToSelection(false); } // Setup fillet options _powerSHAPE.DoCommand("CREATE SURFACE FILLET"); _powerSHAPE.DoCommand("RADIUS " + filletRadius); _powerSHAPE.DoCommand(filletType.ToString()); _powerSHAPE.DoCommand(filletTrim.ToString()); _powerSHAPE.DoCommand(filletRoute.ToString()); _powerSHAPE.DoCommand(filletCrease.ToString()); _powerSHAPE.DoCommand("CORNER " + filletCorners); // Add second surface(s) foreach (PSSurface surface in secondSurfaces) { surface.AddToSelection(false); } // Create fillet _powerSHAPE.DoCommand("ACCEPT", "ACCEPT"); // Return any created surfaces List <PSSurface> surfacesToReturn = new List <PSSurface>(); if (_powerSHAPE.ActiveModel.CreatedItems.Count != 0) { foreach (PSSurface createdSurface in _powerSHAPE.ActiveModel.SelectedItems) { surfacesToReturn.Add(createdSurface); Add(createdSurface); } } else { throw new ApplicationException("Filleting of surfaces failed"); } // Return created surfaces return(surfacesToReturn); }