Vertex modification problem

Technical discussions
motif
Posts: 3
Joined: Fri Jul 12, 2019 3:52 am

Vertex modification problem

Postby motif » Wed Mar 11, 2020 3:58 am

Hello

I am trying modification of a shape consisting of planar faces. I have an issue there. I do not see any exceptions. The change just does not take effect. I have reduced my code to this:

Code: Select all

      BRepBuilder_DG myBuilder;
      …
            IPlane_DG pln = (IPlane_DG)m_gen.Create("Plane_DG");
            IBRepFace_DG f = myBuilder.CreateFace1(pln);

            PointDg p0 = new PointDg();
            PointDg p1 = new PointDg(1, 0, 0);
            PointDg p2 = new PointDg(0, 1, 0);
            IBRepWire_DG wire = myBuilder.CreateWire2(p0, p1, p2, true);

            f.AddWire(wire);
           
            IBRepEdge_DG e = wire.GetEdge(0);
            IBRepVertex_DG v = wire.GetVertex(0);

            myBuilder.ModifyVertex2(v, 0.1, e, f);
           
            myModel.AddBRepShape(f as IBRepShape_DG);

Can anybody see a problem?
Thanks in advance

Prashant Kande
Posts: 51
Joined: Mon Apr 04, 2016 4:55 am

Re: Vertex modification problem

Postby Prashant Kande » Thu Mar 12, 2020 3:38 am

Hello motif

I am pretty sure the problem is that curve of the adjacent edge2 is geometrically out of sync. Its second end remains in the old position. So the wire becomes broken. The algorithm does not do anything automatic there.
Try this:

Code: Select all

      …
           myBuilder.ModifyVertex2(v, 0.1, e, f);

           PointDg p0Modified = v.GetPosition1();
            ILine_DG line = m_gen.Create("Line_DG") as ILine_DG;
            line.Init1(p2, pt0Modified);
            IBRepEdge_DG edge2 = wire.GetEdge(2);
            edge2.SetCurve(line as ICurve_DG);
           
            myModel.AddBRepShape(f as IBRepShape_DG);


regards

motif
Posts: 3
Joined: Fri Jul 12, 2019 3:52 am

Re: Vertex modification problem

Postby motif » Thu Mar 12, 2020 9:50 pm

Thanks a lot, Prashant


Return to “General Issues”

Who is online

Users browsing this forum: No registered users and 3 guests