/// <summary> /// Creates a revolved surface from a list of wireframe. /// </summary> /// <param name="rotationAxis">The axis around which to revolve the surface.</param> /// <param name="angleOfRevolution">The angle round which to revolve.</param> /// <param name="wireframe">The wireframe representing the profile of the surface.</param> /// <returns>A revolved surface.</returns> public PSSurfaceRevolution CreateRevolvedSurface( Axes rotationAxis, Geometry.Degree angleOfRevolution, PSWireframe wireframe) { // Set the principal plane _powerSHAPE.SetActivePlane(rotationAxis.AxisToPlane()); // Select the wireframe wireframe.AddToSelection(true); // Create revolved surface _powerSHAPE.DoCommand("CREATE SURFACE REVOLUTION"); // Check that surface has been created PSSurfaceRevolution createdSurface = null; if (_powerSHAPE.ActiveModel.SelectedItems.Count == 0) { throw new ApplicationException("No surface was created from the revolution"); } createdSurface = (PSSurfaceRevolution)_powerSHAPE.ActiveModel.SelectedItems[0]; // Change the revolution angle if required if (angleOfRevolution != 360) { createdSurface.Angle = angleOfRevolution; } return(createdSurface); }
internal PSSurfaceRevolution( PSAutomation powershape, Planes principalPlane, PSWireframe[] wireframeToExtrude) : base(powershape) { // Clear CreatedItems _powerSHAPE.ActiveModel.ClearCreatedItems(); // Add the wireframe to the selection _powerSHAPE.ActiveModel.ClearSelectedItems(); foreach (PSWireframe wireframe in wireframeToExtrude) { wireframe.AddToSelection(false); } // Create a revolution using the principal plane and wireframe specified _powerSHAPE.SetActivePlane(principalPlane); _powerSHAPE.DoCommand("CREATE SURFACE REVOLUTION"); // Get created revolution id PSSurfaceRevolution newRevolution = (PSSurfaceRevolution)_powerSHAPE.ActiveModel.CreatedItems[0]; _id = newRevolution.Id; }