I have a b-spline and I need to create a surface of revolution from it without using sketches (by using IBody2.CreateRevolutionSurface). Here is a C# sample code:
var part = SwApp.IActiveDoc2 as IPartDoc;
var selMgr = SwApp.IActiveDoc2.SelectionManager as ISelectionMgr;
var selCurve = selMgr.GetSelectedObject6(1, -1) as ISketchSegment;
if (selCurve != null)
{
var swCurveIn = (ICurve)selCurve.GetCurve();
var body = part.ICreateNewBody2();
double[] point = new double[] { 0, 0, 0 };
double[] axis = new double[] { 0, 0, 1 };
double[] coords = new double[] { 0, Math.PI };
var surface = body.CreateRevolutionSurface(swCurveIn, point, axis, coords) as ISurface;
}
I create a b-spline sketch, select it and run this code.
Here is an example of spline I create. Line is just a center line.
CreateRevolutionSurface always returns null no matter what point and axis I take. But it works fine if I use for example line, arc or ellipse.
Is it possible to create a revolve from spline using CreateRevolutionSurface? If yes, please share a code sample in any language.
Thanks
SolidworksApi macros