Mstn CE 在COM接口中那个可以画构建棱台实体?

各位老师:

           再上一个帖子中问过.NET接口中创建棱台实体..

那在COM接口中是否也有函数可以画棱台实体??

Parents Reply Children
  • 谢谢 郭工 符工 BsplineSurface.FromCrossSections可行

    Point3d[] aFitPoints = new Point3d[4];
    InterpolationCurve oFitCurve = new InterpolationCurveClass();
    BsplineCurve[] aCurves = new BsplineCurve[2];
    //创建断面1
    aFitPoints[0] = app.Point3dFromXYZ(50, 50, 0);
    aFitPoints[1] = app.Point3dFromXYZ(50, -50, 0);
    aFitPoints[2] = app.Point3dFromXYZ(-50, -50, 0);
    aFitPoints[3] = app.Point3dFromXYZ(-50, 50, 0);
    
    ShapeElement s1 = app.CreateShapeElement1(null, aFitPoints);
    app.ActiveModelReference.AddElement(s1);
    aCurves[0] = new BsplineCurveClass();
    aCurves[0].FromElement(s1);
    //创建断面2
    aFitPoints[0] = app.Point3dFromXYZ(20, 20, 50);
    aFitPoints[1] = app.Point3dFromXYZ(20, -20, 50);
    aFitPoints[2] = app.Point3dFromXYZ(-20, -20, 50);
    aFitPoints[3] = app.Point3dFromXYZ(-20, 20, 50);
    ShapeElement s2 = app.CreateShapeElement1(null, aFitPoints);
    app.ActiveModelReference.AddElement(s2);
    aCurves[1] = new BsplineCurveClass();
    aCurves[1].FromElement(s2);
    
    //创建侧面
    BsplineSurface surface = new BsplineSurfaceClass();
    surface.FromCrossSections(aCurves, MsdBsplineSurfaceDirection.U, 4, false, true);
    BsplineSurfaceElement oSurface = app.CreateBsplineSurfaceElement1(null, surface);
    oSurface.Color = 4;
    ElementEnumerator ee= app.SmartSolid.ConvertToSmartSolidElement(oSurface);
    SmartSolidElement sse = null;
    while (ee.MoveNext()) {
        if (ee.Current.IsSmartSolidElement) {
            sse = ee.Current.AsSmartSolidElement;
            sse.CapSurface();
            app.ActiveModelReference.AddElement(sse);
        }
    }

    Answer Verified By: 超 上官