Clockwise curve

Everything DG Kernel: Technical discussions and issues
Post Reply
Mito
Posts: 2
Joined: Thu Jan 30, 2025 7:11 am

Clockwise curve

Post by Mito »

I want to create a wire that is a mixture of counterclockwise and clockwise.
Clockwise curves do not work in the following code.
I am testing this by copying it into "InterfaceTests" > "IEntityTest.cs" from the sample.

Code: Select all

IBRepWire_DG iWire;
{
    IBRepBuilder_DG iBuilder = m_gen.Create<IBRepBuilder_DG>();

    IPlane_DG iPlane = m_gen.Create<IPlane_DG>();
    IBRepFace_DG iFace = iBuilder.CreateFace(iPlane);

    IPointArray_DG points = m_gen.Create<IPointArray_DG>();
    points.Add(new PointDg(0, 0, 0));
    points.Add(new PointDg(50, 0, 0));
    points.Add(new PointDg(100, 50, 0));
    points.Add(new PointDg(100, 100, 0));
    points.Add(new PointDg(150, 150, 0));
    points.Add(new PointDg(0, 150, 0));
    points.Add(new PointDg(0, 0, 0));

    iWire = iBuilder.CreateWire(points, true);
    iFace.AddWire(iWire);

    // counterclockwise
    IBRepEdge_DG edge1 = iWire.GetEdge(1);
    ICircle2d_DG circle1 = m_gen.Create<ICircle2d_DG>();
    circle1.Init(new T2DDg(50, 50), 50);
    ICurve2d_DG curve1 = circle1.As<ICurve2d_DG>();
    curve1.ParameterRange = new RangeDg(1.5 * Math.PI, 2.0 * Math.PI);
    iBuilder.ModifyEdge(edge1, curve1, iFace);

    // clockwise
    IBRepEdge_DG edge3 = iWire.GetEdge(3);
    ICircle2d_DG circle3 = m_gen.Create<ICircle2d_DG>();
    circle3.Init(new T2DDg(150, 100), 50);
    ICurve2d_DG curve3 = circle3.As<ICurve2d_DG>();
    curve3.ParameterRange = new RangeDg(0.5 * Math.PI, Math.PI);
    iBuilder.ModifyEdge(edge3, curve3, iFace);
}

IBRepShape_DG iShapeExtrude;
{
    IBRepBuilderEx_DG iBuilderEx = m_gen.Create<IBRepBuilderEx_DG>();

    IBRepShape_DG iShape = m_gen.Create<IBRepFace_DG>(iWire).As<IBRepShape_DG>();
    iShapeExtrude = iBuilderEx.Extrude(iShape, new VectDg(0, 0, 1000));
}

IEntity_DG iEntity = m_iModel.AddBRepShape(iShapeExtrude);
this.Display(iEntity);
image.png
image.png (3.73 KiB) Viewed 27026 times
Post Reply